fix mutability errors and tiny leak

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36895 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2013-07-16 10:03:40 +00:00
parent 86fb7a7a64
commit 378cc9a352

View file

@ -787,7 +787,15 @@ static inline id parseQuotedString(pldata* pld)
}
if (pld->pos - start - shrink == 0)
{
obj = @"";
if (pld->key == NO
&& pld->opt == NSPropertyListMutableContainersAndLeaves)
{
obj = [GSMutableString new];
}
else
{
obj = @"";
}
}
else
{
@ -892,8 +900,8 @@ static inline id parseQuotedString(pldata* pld)
NSZoneFree(NSDefaultMallocZone(), temp);
length = k;
if (pld->key ==
NO && pld->opt == NSPropertyListMutableContainersAndLeaves)
if (pld->key == NO
&& pld->opt == NSPropertyListMutableContainersAndLeaves)
{
obj = [GSMutableString alloc];
obj = [obj initWithCharactersNoCopy: chars
@ -902,7 +910,7 @@ static inline id parseQuotedString(pldata* pld)
}
else
{
obj = [GSMutableString alloc];
obj = [GSString alloc];
obj = [obj initWithCharactersNoCopy: chars
length: length
freeWhenDone: YES];
@ -943,7 +951,7 @@ static inline id parseUnquotedString(pldata *pld)
}
else
{
obj = [GSMutableString alloc];
obj = [GSString alloc];
obj = [obj initWithCharactersNoCopy: chars
length: length
freeWhenDone: YES];
@ -1278,7 +1286,7 @@ static id parsePlItem(pldata* pld)
if (skipSpace(pld) == YES)
{
pld->err = @"extra data after parsed string";
result = nil; // Not at end of string.
DESTROY(result); // Not at end of string.
}
else
{