changeset 1045:2c741788379c

* src/output/vfnprintf.cxx (SARG): Cast size_t to long. This seems to stop gcc from producing wrong code for the plain int clause. The wrong code causes negative numbers to be printed as positive because the sign extend from 32 bits to 64 bits is wrong.
author asl
date Tue, 10 Jun 2003 10:27:13 +0000
parents c7f6f3f06207
children b3844239133a
files packages/language/c/libc/stdio/current/ChangeLog packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/packages/language/c/libc/stdio/current/ChangeLog
+++ b/packages/language/c/libc/stdio/current/ChangeLog
@@ -1,3 +1,11 @@
+2003-06-10  Andrew Lunn  <andrew.lunn@ascom.ch>
+	    Knud Wöhler  <woehler@ossi.fho-emden.de>    
+	
+	* src/output/vfnprintf.cxx (SARG): Cast size_t to long. This seems
+	to stop gcc from producing wrong code for the plain int clause. The 
+	wrong code causes negative numbers to be printed as positive because
+	the sign extend from 32 bits to 64 bits is wrong.
+
 2003-03-06  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/input/fread.cxx (fread): Simple EOF should not set error.
--- a/packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx
+++ b/packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx
@@ -240,7 +240,7 @@ CYG_MACRO_END
         (flags&QUADINT ? va_arg(arg, cyg_int64) : \
             flags&LONGINT ? va_arg(arg, long) : \
             flags&SHORTINT ? (long)(short)va_arg(arg, int) : \
-            flags&SIZET ? va_arg(arg, size_t) : \
+            flags&SIZET ? (long)va_arg(arg, size_t) : \
             (long)va_arg(arg, int))
 #define UARG() \
         (flags&QUADINT ? va_arg(arg, cyg_uint64) : \