mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
* Source/NSPropertyList.m (GSBinaryPLParser -objectAtIndex:):
Use long long for all integer types. Before we used signed types which resulted wrong values for negative integers. * Source/NSKeyedUnarchiver.m (-_decodeObject:): Handle the string "$null" as nil all the times. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33934 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6b8dc7ef6c
commit
926f3ccb03
3 changed files with 19 additions and 20 deletions
|
@ -1,3 +1,11 @@
|
|||
2011-10-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSPropertyList.m (GSBinaryPLParser -objectAtIndex:): Use
|
||||
long long for all integer types. Before we used signed types which
|
||||
resulted wrong values for negative integers.
|
||||
* Source/NSKeyedUnarchiver.m (-_decodeObject:): Handle the string
|
||||
"$null" as nil all the times.
|
||||
|
||||
2011-10-03 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSHost.m: Update to use inet_pton() and inet_ntop() and to
|
||||
|
|
|
@ -259,11 +259,12 @@ static NSMapTable *globalClassMap = 0;
|
|||
GSIArraySetItemAtIndex(_objMap, (GSIArrayItem)obj, index);
|
||||
}
|
||||
|
||||
if (obj == nil)
|
||||
if ((obj == nil) || [@"$null" isEqual: obj])
|
||||
{
|
||||
// Record NilMarker for decoded object.
|
||||
o = GSIArrayItemAtIndex(_objMap, 0).obj;
|
||||
GSIArraySetItemAtIndex(_objMap, (GSIArrayItem)o, index);
|
||||
obj = nil;
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
@ -500,8 +501,8 @@ static NSMapTable *globalClassMap = 0;
|
|||
if (i > INT_MAX || i < INT_MIN)
|
||||
{
|
||||
[NSException raise: NSRangeException
|
||||
format: @"[%@ +%@]: value for key(%@) is out of range",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd), aKey];
|
||||
format: @"[%@ +%@]: value %ld for key(%@) is out of range",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd), i, aKey];
|
||||
}
|
||||
#endif
|
||||
return (int)i;
|
||||
|
|
|
@ -2998,28 +2998,18 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
unsigned i;
|
||||
unsigned char buffer[16];
|
||||
|
||||
if (len > sizeof(unsigned long long))
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Stored number too long (%d bytes) in property list", len];
|
||||
}
|
||||
|
||||
[data getBytes: buffer range: NSMakeRange(counter, len)];
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
num = (num << 8) + buffer[i];
|
||||
}
|
||||
|
||||
if (next == 0x10)
|
||||
{
|
||||
result = [NSNumber numberWithUnsignedChar: (unsigned char)num];
|
||||
}
|
||||
else if (next == 0x11)
|
||||
{
|
||||
result = [NSNumber numberWithUnsignedShort: (unsigned short)num];
|
||||
}
|
||||
else if ((next == 0x12) || (next == 13))
|
||||
{
|
||||
result = [NSNumber numberWithUnsignedInt: (unsigned int)num];
|
||||
}
|
||||
else
|
||||
{
|
||||
result = [NSNumber numberWithUnsignedLongLong: num];
|
||||
}
|
||||
result = [NSNumber numberWithLongLong: (long long)num];
|
||||
}
|
||||
else if (next == 0x22)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue