From: johanknol Date: Sat, 19 Aug 2000 12:10:54 +0000 (+0000) Subject: fixed the printf("%d", int(0)) bug X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=e26ddff15c944166ac53bc064cb7c6a42560f48d;p=fw%2Fsdcc fixed the printf("%d", int(0)) bug git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@323 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/device/lib/vprintf.c b/device/lib/vprintf.c index 12a7cdb8..505576ef 100644 --- a/device/lib/vprintf.c +++ b/device/lib/vprintf.c @@ -306,9 +306,9 @@ get_conversion_spec: length=0; lsd = 1; - while( (value.byte[0] != 0) || (value.byte[1] != 0) || - (value.byte[2] != 0) || (value.byte[3] != 0) ) - { + + //jwk20000814: do this at least once, e.g.: printf ("%d", (int)0); + do { value.byte[4] = 0; calculate_digit(); @@ -328,8 +328,9 @@ _endasm; length++; lsd = ~lsd; - } - + } while( (value.byte[0] != 0) || (value.byte[1] != 0) || + (value.byte[2] != 0) || (value.byte[3] != 0) ); + if (width == 0) { // default width. We set it to 1 to output