mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 10:11:03 +00:00
Fix wide character output for 64bit wide characters.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22432 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9a3ea5ee3b
commit
5c319cebe7
1 changed files with 22 additions and 5 deletions
|
@ -447,18 +447,35 @@ handle_printf_atsign (FILE *stream,
|
||||||
#else
|
#else
|
||||||
string_object = *((id*) ptr);
|
string_object = *((id*) ptr);
|
||||||
#endif
|
#endif
|
||||||
|
string_object = [string_object description];
|
||||||
if (info->wide)
|
if (info->wide)
|
||||||
{
|
{
|
||||||
len = fwprintf(stream, L"%*ls",
|
if (sizeof(wchar_t) == 4)
|
||||||
(info->left ? - info->width : info->width),
|
{
|
||||||
[[string_object description]
|
unsigned length = [string_object length];
|
||||||
cStringUsingEncoding: NSUnicodeStringEncoding]);
|
wchar_t buf[length + 1];
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
buf[i] = [string_object characterAtIndex: i];
|
||||||
|
}
|
||||||
|
buf[i] = 0;
|
||||||
|
len = fwprintf(stream, L"%*ls",
|
||||||
|
(info->left ? - info->width : info->width), buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len = fwprintf(stream, L"%*ls",
|
||||||
|
(info->left ? - info->width : info->width),
|
||||||
|
[string_object cStringUsingEncoding: NSUnicodeStringEncoding]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = fprintf(stream, "%*s",
|
len = fprintf(stream, "%*s",
|
||||||
(info->left ? - info->width : info->width),
|
(info->left ? - info->width : info->width),
|
||||||
[[string_object description] lossyCString]);
|
[string_object lossyCString]);
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue