From: Glenn Burkhardt Date: Tue, 30 Sep 2003 16:07:49 +0000 (+0000) Subject: [bug #4296] PUTD() macro can't hack 10 digit values X-Git-Tag: RELEASE_1_2~70 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=cc9d0626d137ec556f12d133cf106ac7c4c5b5a7;p=mmh [bug #4296] PUTD() macro can't hack 10 digit values Once the number exceeded 1000000000, the conversion would fail. An execution of dp -format "%(clock{text})" "Tue, 01 Jul 2003 21:38:05 +0700" would erroneously print 749660476, instead of 1057070285. The macros PUTD() and PUTDF() have been replaced by snprintf() calls; These macros should never have been written in the first place, when system functions exist to do the work. --- diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 4f79bf6..0a2397b 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -511,10 +511,7 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat) value = dat[fmt->f_value]; break; case FT_LV_STRLEN: - if (str != NULL) - value = strlen(str); - else - value = 0; + value = strlen(str); break; case FT_LV_CHAR_LEFT: value = width - (cp - scanl);