From e36f0587b10476065fba1e8a038d9dfaabe63445 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Mon, 25 Feb 2019 21:27:12 -0500 Subject: compile without warnings under -Wall -Wextra --- src/nonstd/_printf.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/nonstd/_printf.h') diff --git a/src/nonstd/_printf.h b/src/nonstd/_printf.h index fa132367..95a4c94c 100644 --- a/src/nonstd/_printf.h +++ b/src/nonstd/_printf.h @@ -90,14 +90,6 @@ int (__printf)(struct io_options *opt, const char * format, va_list arg) } for (i = 0; format[i] != 0; i++) { - if (format[i] != '%') { - if (nout < (int)n) { - s[nout] = format[i]; - } - nout++; - continue; - } - /* // zero of more flags "-+ #0" // optional width "*" or decimal integer @@ -113,6 +105,14 @@ int (__printf)(struct io_options *opt, const char * format, va_list arg) int base = 10; enum { def, hh, h, l, ll, j, z, t, L } length = def; + if (format[i] != '%') { + if (nout < (int)n) { + s[nout] = format[i]; + } + nout++; + continue; + } + while (step == 0) { i++; switch (format[i]) { @@ -197,7 +197,11 @@ int (__printf)(struct io_options *opt, const char * format, va_list arg) case hh: argint = (signed char)va_arg(arg, int); break; case h: argint = (short int)va_arg(arg, int); break; case l: argint = va_arg(arg, long int); break; + + #if defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ case ll: argint = va_arg(arg, long long int); break; + #endif + case j: argint = va_arg(arg, intmax_t); break; case z: argint = va_arg(arg, size_t); break; case t: argint = va_arg(arg, ptrdiff_t); break; -- cgit v1.2.1