From: Bert Vermeulen Date: Mon, 13 Jan 2014 21:22:40 +0000 (+0100) Subject: Use PRIu64 for format in pretty-printer. X-Git-Tag: libsigrok-0.3.0~301 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=69d83be9bf4b6aa7e6cabdf5ce1b6452182fa55b;p=libsigrok.git Use PRIu64 for format in pretty-printer. Thanks to Marcus Comstedt for the fix. --- diff --git a/strutil.c b/strutil.c index acd00327..17d59e8d 100644 --- a/strutil.c +++ b/strutil.c @@ -192,7 +192,7 @@ SR_API char *sr_si_string_u64(uint64_t x, const char *unit) SR_GHZ(1000), SR_GHZ(1000 * 1000), SR_GHZ(1000 * 1000 * 1000), }; const char *p, prefix[] = "\0kMGTPE"; - char fmt[8], fract[20] = "", *f; + char fmt[16], fract[20] = "", *f; if (unit == NULL) unit = ""; @@ -200,7 +200,7 @@ SR_API char *sr_si_string_u64(uint64_t x, const char *unit) for (i = 0; (quot = x / divisor[i]) >= 1000; i++); if (i) { - sprintf(fmt, ".%%0%dlu", i * 3); + sprintf(fmt, ".%%0%d"PRIu64, i * 3); f = fract + sprintf(fract, fmt, x % divisor[i]) - 1; while (f >= fract && strchr("0.", *f))