X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=strutil.c;h=17d59e8d8850dba638ccb4a3eac35ec9f45bbfe5;hb=8a2aaffa02d333219ba9159b581a2a7482e5185f;hp=acd0032790417e89cc86520a07789b4c4e2c4179;hpb=df823ac4445ed6f708136e208c8b8bd4930f4a9e;p=libsigrok.git 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))