mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
Fix for initialization of strings from data in a generic non-unicode encod
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9560 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e557cb2ee9
commit
1641dc2d84
1 changed files with 5 additions and 2 deletions
|
@ -1076,8 +1076,10 @@ handle_printf_atsign (FILE *stream,
|
||||||
unsigned count;
|
unsigned count;
|
||||||
const unsigned char *b;
|
const unsigned char *b;
|
||||||
|
|
||||||
if (len < 2)
|
if (len < 1 || (len < 2 && encoding == NSUnicodeStringEncoding))
|
||||||
return [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO];
|
{
|
||||||
|
return [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO];
|
||||||
|
}
|
||||||
|
|
||||||
b = [data bytes];
|
b = [data bytes];
|
||||||
u = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*(len+1));
|
u = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*(len+1));
|
||||||
|
@ -3171,6 +3173,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
unsigned count;
|
unsigned count;
|
||||||
|
|
||||||
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
NSStringEncoding enc;
|
NSStringEncoding enc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue