compatibility fix for macos-x

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19514 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-06-14 05:27:54 +00:00
parent c2c10187fe
commit d1daf27fd2
2 changed files with 32 additions and 30 deletions

View file

@ -1,3 +1,8 @@
2004-06-14 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSDictionary.m: MacOS-X compatibility fix for keyed encoding
of empty dictionary.
2004-06-10 Adam Fedor <fedor@gnu.org> 2004-06-10 Adam Fedor <fedor@gnu.org>
* Version 1.9.2 * Version 1.9.2

View file

@ -182,16 +182,13 @@ static SEL appSel;
if ([aCoder allowsKeyedCoding]) if ([aCoder allowsKeyedCoding])
{ {
if (count > 0)
{
NSEnumerator *enumerator = [self keyEnumerator];
id key; id key;
unsigned i;
if ([aCoder class] == [NSKeyedArchiver class]) if ([aCoder class] == [NSKeyedArchiver class])
{ {
NSArray *keys = [self allKeys]; NSArray *keys = [self allKeys];
id objects = [NSMutableArray arrayWithCapacity: count]; id objects = [NSMutableArray arrayWithCapacity: count];
unsigned i;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
@ -203,10 +200,11 @@ static SEL appSel;
[(NSKeyedArchiver*)aCoder _encodeArrayOfObjects: objects [(NSKeyedArchiver*)aCoder _encodeArrayOfObjects: objects
forKey: @"NS.objects"]; forKey: @"NS.objects"];
} }
else else if (count > 0)
{ {
unsigned i = 0; NSEnumerator *enumerator = [self keyEnumerator];
i = 0;
while ((key = [enumerator nextObject]) != nil) while ((key = [enumerator nextObject]) != nil)
{ {
NSString *s; NSString *s;
@ -219,7 +217,6 @@ static SEL appSel;
} }
} }
} }
}
else else
{ {
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &count]; [aCoder encodeValueOfObjCType: @encode(unsigned) at: &count];