[BUG] wprintf(L"%s", str) expects str to be wide
Craig Howland
howland@LGSInnovations.com
Fri Jan 11 15:21:00 GMT 2013
Corinna:
Are we looking at the same place? Lines 1200-1217 of
libc/stdio/vfwprintf.c version 1.10 are what I looked at. I only see wide
functions there. I'll quote from line 1199 to get the #endif:
#endif /* _MB_CAPABLE */
if (prec >= 0) {
/*
* can't use wcslen; can only look for the
* NUL in the first `prec' characters, and
* strlen () will go further.
*/
wchar_t *p = wmemchr (cp, L'\0', prec);
if (p != NULL) {
size = p - cp;
if (size > prec)
size = prec;
} else
size = prec;
} else
size = wcslen (cp);
break;
Craig
On 01/11/2013 10:07 AM, Corinna Vinschen wrote:
> On Jan 11 09:52, Craig Howland wrote:
>> Corinna:
>> It appears, taking a quick glance at the source, that the string
>> is only treated as regular characters if _MB_CAPABLE is
>> defined--otherwise it falls into a wide-character-only case. This
>> could perhaps explain the differing results.
>> Craig
> The _MB_CAPABLE code only handles the case which converts wide chars
> into multibyte chars. The default code right after the #endif handles
> the incoming string as plain byte string.
>
>
> Corinna
>
More information about the Newlib
mailing list