* smallprint.c (rn): Allow long long values.
(__small_vsprintf): Add 'D', 'U' and 'X' formats for long long parameters.
This commit is contained in:
parent
76135eab62
commit
a6790c5f11
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in New Issue