From: Laurent Mazet Date: Sun, 13 Apr 2025 13:12:16 +0000 (+0200) Subject: full adaptation to c99 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=b8ffe6d92266877dc12facb7ba4f1a0b56cb4f72;p=ascii.git full adaptation to c99 --- diff --git a/fdprintf.c b/fdprintf.c index 46f27ac..25f4d59 100644 --- a/fdprintf.c +++ b/fdprintf.c @@ -46,11 +46,10 @@ char *itoa (char *str, unsigned u, unsigned int sz) double tenpower(int n) { double t = 1.0; - int i; - for (i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { t *= 10; } - for (i = 0; i > n; i--) { + for (int i = 0; i > n; i--) { t /= 10; } return t; @@ -88,7 +87,7 @@ int fdprintf (int fd, const char *fmt, ...) char *s; double f = 0.0; int d = 0; - unsigned int u; + unsigned long long int u; char c = *fmt++; /* copy standard char */ @@ -97,7 +96,7 @@ int fdprintf (int fd, const char *fmt, ...) } else { int t = 0; char w = '0'; - int i, sz = 0; + int sz = 0; void *p = NULL; /* stamp */ @@ -177,7 +176,7 @@ int fdprintf (int fd, const char *fmt, ...) } else { u = (uintptr_t)p; } - for (i = sz, t = 1; i > 0; i--) { + for (int i = sz, t = 1; i > 0; i--) { char x = (char)((u >> (i * 4 - 4)) & 0xf); if ((t == 1) && (x == 0)) { *str++ = w;