diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2002-02-22 21:22:24 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2002-02-22 21:22:24 +0300 |
commit | a6790c5f113e0fa5daf45d0815876509cd7f546b (patch) | |
tree | acd88e4558f12d7ee473983670e6e3a5f55cca8c | |
parent | 76135eab62d6f7ebee7b2bf80060dc10934b8ea5 (diff) |
* smallprint.c (rn): Allow long long values.
(__small_vsprintf): Add 'D', 'U' and 'X' formats for long long
parameters.
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/smallprint.c | 15 |
2 files changed, 18 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b74de2f63..e8958d079 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2001-02-22 Corinna Vinschen <corinna@vinschen.de> + + * smallprint.c (rn): Allow long long values. + (__small_vsprintf): Add 'D', 'U' and 'X' formats for long long + parameters. + 2002-02-19 Christopher Faylor <cgf@redhat.com> * fhandler.cc (fhandler_base::puts_readahead): Remove default parameter diff --git a/winsup/cygwin/smallprint.c b/winsup/cygwin/smallprint.c index d6be72a6c..97a2b6ce1 100644 --- a/winsup/cygwin/smallprint.c +++ b/winsup/cygwin/smallprint.c @@ -19,11 +19,11 @@ int __small_sprintf (char *dst, const char *fmt,...); int __small_vsprintf (char *dst, const char *fmt, va_list ap); static char * -rn (char *dst, int base, int dosign, int val, int len, int pad) +rn (char *dst, int base, int dosign, long long val, int len, int pad) { - /* longest number is 4294967295, 10 digits */ + /* longest number is ULLONG_MAX, 18446744073709551615, 20 digits */ unsigned uval; - char res[10]; + char res[20]; static const char str[16] = "0123456789ABCDEF"; int l = 0; @@ -126,9 +126,15 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) case 'd': dst = rn (dst, 10, addsign, va_arg (ap, int), len, pad); break; + case 'D': + dst = rn (dst, 10, addsign, va_arg (ap, long long), len, pad); + break; case 'u': dst = rn (dst, 10, 0, va_arg (ap, int), len, pad); break; + case 'U': + dst = rn (dst, 10, 0, va_arg (ap, long long), len, pad); + break; case 'p': *dst++ = '0'; *dst++ = 'x'; @@ -136,6 +142,9 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) case 'x': dst = rn (dst, 16, 0, va_arg (ap, int), len, pad); break; + case 'X': + dst = rn (dst, 16, 0, va_arg (ap, long long), len, pad); + break; case 'P': if (!GetModuleFileName (NULL, tmp, MAX_PATH)) s = "cygwin program"; |