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:
Nicola Pero 2001-04-11 16:51:17 +00:00
parent 04635e37a5
commit 1ccb1ba60b

View file

@ -1076,8 +1076,10 @@ handle_printf_atsign (FILE *stream,
unsigned count;
const unsigned char *b;
if (len < 2)
return [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO];
if (len < 1 || (len < 2 && encoding == NSUnicodeStringEncoding))
{
return [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO];
}
b = [data bytes];
u = NSZoneMalloc(GSObjCZone(self), sizeof(unichar)*(len+1));
@ -3171,6 +3173,7 @@ handle_printf_atsign (FILE *stream,
unsigned count;
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
if (count > 0)
{
NSStringEncoding enc;