Mercurial > hg > th-libs
diff th_string.c @ 457:85fa3d333556
Actually, revert the boolean changes .. meh.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Jan 2018 23:09:29 +0200 |
parents | 347bfd3e017e |
children | 694c85f4e354 |
line wrap: on
line diff
--- a/th_string.c Tue Jan 02 22:57:47 2018 +0200 +++ b/th_string.c Tue Jan 02 23:09:29 2018 +0200 @@ -200,7 +200,7 @@ int th_vprintf_put_int_format(th_vprintf_ctx *ctx, th_vprintf_putch vputch, char *buf, int f_flags, int f_width, int f_prec, int f_len, int vret, - bool f_neg, bool f_unsig, char *(f_alt)(const char *buf, const size_t blen, const int vret, const int flags)) + BOOL f_neg, BOOL f_unsig, char *(f_alt)(const char *buf, const size_t blen, const int vret, const int flags)) { int ret = 0, nwidth, nprec; char f_sign, *f_altstr; @@ -297,11 +297,11 @@ int th_vprintf_put_int(th_vprintf_ctx *ctx, th_vprintf_putch vputch, va_list ap, const int f_radix, int f_flags, int f_width, int f_prec, - const bool f_unsig, char *(f_alt)(const char *buf, const size_t blen, const int vret, const int flags)) + const BOOL f_unsig, char *(f_alt)(const char *buf, const size_t blen, const int vret, const int flags)) { char buf[64]; int f_len = 0, vret; - bool f_neg = false; + BOOL f_neg = FALSE; if (f_flags & TH_PF_LONGLONG) { @@ -364,7 +364,7 @@ memcpy(&val, &pval, sizeof(int64_t)); // We have sign, exponent and mantissa - bool f_sign = (val >> 63) & 0x01; + BOOL f_sign = (val >> 63) & 0x01; int64_t d_exp = (val >> 52) & 0x7ff; uint64_t d_man = val & 0x0fffffffffffff; @@ -408,7 +408,7 @@ else { int f_width = -1, f_prec = -1, f_flags = 0; - bool end = false; + BOOL end = FALSE; fmt++; @@ -442,7 +442,7 @@ break; default: - end = true; + end = TRUE; break; } if (!end) fmt++; @@ -525,7 +525,7 @@ break; case 'o': - if ((ret = th_vprintf_put_int(ctx, vputch, ap, 8, f_flags, f_width, f_prec, true, th_vprintf_altfmt_oct)) == EOF) + if ((ret = th_vprintf_put_int(ctx, vputch, ap, 8, f_flags, f_width, f_prec, TRUE, th_vprintf_altfmt_oct)) == EOF) goto out; break; @@ -540,7 +540,7 @@ case 'X': if (*fmt == 'X') f_flags |= TH_PF_UPCASE; - if ((ret = th_vprintf_put_int(ctx, vputch, ap, 16, f_flags, f_width, f_prec, true, th_vprintf_altfmt_hex)) == EOF) + if ((ret = th_vprintf_put_int(ctx, vputch, ap, 16, f_flags, f_width, f_prec, TRUE, th_vprintf_altfmt_hex)) == EOF) goto out; break; @@ -554,7 +554,7 @@ f_flags |= TH_PF_LONGLONG; #endif f_flags |= TH_PF_ALT | TH_PF_POINTER; - if ((ret = th_vprintf_put_int(ctx, vputch, ap, 16, f_flags, f_width, f_prec, true, th_vprintf_altfmt_hex)) == EOF) + if ((ret = th_vprintf_put_int(ctx, vputch, ap, 16, f_flags, f_width, f_prec, TRUE, th_vprintf_altfmt_hex)) == EOF) goto out; break; @@ -990,15 +990,15 @@ } -bool th_get_boolean(const char *str, bool *value) +BOOL th_get_boolean(const char *str, BOOL *value) { if (!th_strcasecmp(str, "yes") || !th_strcasecmp(str, "on") || !th_strcasecmp(str, "true") || !th_strcasecmp(str, "1")) { - *value = true; - return true; + *value = TRUE; + return TRUE; } else if (!th_strcasecmp(str, "no") || @@ -1006,11 +1006,11 @@ !th_strcasecmp(str, "false") || !th_strcasecmp(str, "0")) { - *value = false; - return true; + *value = FALSE; + return TRUE; } else - return false; + return FALSE; } @@ -1024,14 +1024,14 @@ void th_print_wrap(FILE *fh, const char *str, int spad, int rpad, int width) { size_t pos = 0; - bool first = true; + BOOL first = TRUE; while (str[pos]) { // Pre-pad line int linelen = first ? spad : rpad; th_pad(fh, first ? 0 : rpad); - first = false; + first = FALSE; // Skip whitespace at line start while (th_isspace(str[pos]) || str[pos] == '\n') pos++;