diff options
author | Christopher Faylor <me@cgf.cx> | 2012-05-17 06:18:41 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2012-05-17 06:18:41 +0400 |
commit | fe66a97ae47bfa1529fd3c2111a9351d85808894 (patch) | |
tree | 249d56621b130fe512eb6f885f8e3a45e7acb8e9 /winsup/cygwin/smallprint.cc | |
parent | 53b7c465ed504059aeb570d612fd98fd8565094f (diff) |
* DevNotes: Add entry cgf-000009.
* smallprint.cc (__small_vsprintf): Always treat '%c' and '%C' as characters.
Don't decode them if they are > 127.
(__small_vswprintf): Ditto.
Diffstat (limited to 'winsup/cygwin/smallprint.cc')
-rw-r--r-- | winsup/cygwin/smallprint.cc | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc index 1ca7ca817..e7a9f530f 100644 --- a/winsup/cygwin/smallprint.cc +++ b/winsup/cygwin/smallprint.cc @@ -146,17 +146,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) l_opt = true; continue; case 'c': - { - int c = va_arg (ap, int); - if (c > ' ' && c <= 127) - *dst++ = c; - else - { - *dst++ = '0'; - *dst++ = 'x'; - dst = __rn (dst, 16, 0, c, len, pad, LMASK); - } - } + *dst++ = (char) (va_arg (ap, int) & 0xff); break; case 'C': { @@ -164,14 +154,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) char buf[4], *c; sys_wcstombs (buf, 4, &wc, 1); for (c = buf; *c; ++c) - if (isprint (*c)) - *dst++ = *c; - else - { - *dst++ = '0'; - *dst++ = 'x'; - dst = __rn (dst, 16, 0, *c, len, pad, LMASK); - } + *dst++ = *c; } case 'E': strcpy (dst, "Win32 error "); @@ -445,17 +428,7 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) continue; case L'c': case L'C': - { - unsigned int c = va_arg (ap, unsigned int); - if (c > L' ' && c <= 127) - *dst++ = c; - else - { - *dst++ = L'0'; - *dst++ = L'x'; - dst = __wrn (dst, 16, 0, c, len, pad, LMASK); - } - } + *dst++ = va_arg (ap, unsigned); break; case L'E': wcscpy (dst, L"Win32 error "); |