diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 63fba2379..6e1ad17e2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2005-01-31 Christopher Faylor + + * smallprint.c (rnarg): Use long rather than unsigned long so that we + get proper sign extension. + 2005-01-31 Corinna Vinschen * environ.cc (set_traverse): New function. diff --git a/winsup/cygwin/smallprint.c b/winsup/cygwin/smallprint.c index 43d0decd4..6ad95c6e4 100644 --- a/winsup/cygwin/smallprint.c +++ b/winsup/cygwin/smallprint.c @@ -21,7 +21,7 @@ int __small_vsprintf (char *dst, const char *fmt, va_list ap); #define LLMASK (0xffffffffffffffffULL) #define LMASK (0xffffffff) -#define rnarg(dst, base, dosign, len, pad) __rn ((dst), (base), (dosign), va_arg (ap, unsigned), len, pad, LMASK) +#define rnarg(dst, base, dosign, len, pad) __rn ((dst), (base), (dosign), va_arg (ap, long), len, pad, LMASK) #define rnargLL(dst, base, dosign, len, pad) __rn ((dst), (base), (dosign), va_arg (ap, unsigned long long), len, pad, LLMASK) static char * __rn (char *, int, int, long long, int, int, @@ -59,13 +59,11 @@ __rn (char *dst, int base, int dosign, long long val, int len, int pad, unsigned } while (uval); - while (len -- > l) + while (len-- > l) *dst++ = pad; while (l > 0) - { - *dst++ = res[--l]; - } + *dst++ = res[--l]; return dst; }