mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
NSOrderedSet: Fix keyed encoding to match Apple platforms
This commit is contained in:
parent
37913d006d
commit
810061f6e7
2 changed files with 18 additions and 27 deletions
|
@ -1,3 +1,7 @@
|
|||
2023-05-04 Frederik Seiffert <frederik@algoriddim.com>
|
||||
|
||||
* Source/NSOrderedSet.m: Fix keyed encoding to match Apple platforms.
|
||||
|
||||
2023-05-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSFileHandle.m: Ignore notificaton that a descriptor is
|
||||
|
|
|
@ -179,30 +179,17 @@ static SEL remSel;
|
|||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
if ([aCoder class] == [NSKeyedArchiver class])
|
||||
{
|
||||
/* HACK ... MacOS-X seems to code differently if the coder is an
|
||||
* actual instance of NSKeyedArchiver
|
||||
*/
|
||||
NSArray *array = [self array];
|
||||
|
||||
[(NSKeyedArchiver*)aCoder _encodeArrayOfObjects: array
|
||||
forKey: @"NS.objects"];
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned i = 0;
|
||||
NSEnumerator *e = [self objectEnumerator];
|
||||
id o;
|
||||
|
||||
while ((o = [e nextObject]) != nil)
|
||||
{
|
||||
NSString *key;
|
||||
|
||||
key = [NSString stringWithFormat: @"NS.object.%u", i++];
|
||||
[(NSKeyedArchiver*)aCoder encodeObject: o forKey: key];
|
||||
}
|
||||
}
|
||||
unsigned i = 0;
|
||||
NSEnumerator *e = [self objectEnumerator];
|
||||
id o;
|
||||
|
||||
while ((o = [e nextObject]) != nil)
|
||||
{
|
||||
NSString *key;
|
||||
|
||||
key = [NSString stringWithFormat: @"NS.object.%u", i++];
|
||||
[(NSKeyedArchiver*)aCoder encodeObject: o forKey: key];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -212,9 +199,9 @@ static SEL remSel;
|
|||
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||
while ((o = [e nextObject]) != nil)
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &o];
|
||||
}
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &o];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue