Extension for binary property lists to load bigger lists.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18635 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
FredKiefer 2004-02-21 00:49:43 +00:00
parent 892b775251
commit 67e7904ae5
2 changed files with 22 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2004-02-21 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPropertyList.m: (GSBinaryPLParser
-initWithData:mutability:, -offsetForIndex:, -readObjectIndexAt:)
Added support for binary pls with size == 3.
2004-02-19 Richard Frith-Macdonald <rfm@gnu.org> 2004-02-19 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSMime.m: added a couple of uuencoding methods. * Source/Additions/GSMime.m: added a couple of uuencoding methods.

View file

@ -2301,11 +2301,14 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
// FIXME: Get more of the details // FIXME: Get more of the details
[plData getBytes: postfix range: NSMakeRange(length-32, 32)]; [plData getBytes: postfix range: NSMakeRange(length-32, 32)];
size = postfix[6]; size = postfix[6];
if (size < 1 || size > 2) table_start = 256*256*postfix[29] + 256*postfix[30] + postfix[31];
if (size < 1 || size > 3)
{ {
[NSException raise: NSGenericException
format: @"Unknown table size %d", size];
DESTROY(self); // Bad format DESTROY(self); // Bad format
} }
else if ((table_start = 256*postfix[30] + postfix[31]) > length - 32) else if (table_start > length - 32)
{ {
DESTROY(self); // Bad format DESTROY(self); // Bad format
} }
@ -2347,8 +2350,16 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
} }
else else
{ {
[NSException raise: NSGenericException unsigned char buffer[size];
format: @"Unknown table size %d", size]; int i;
unsigned num = 0;
[data getBytes: &buffer range: NSMakeRange(table_start + size*index, size)];
for (i = 0; i < size; i++)
{
num = num*256 + buffer[i];
}
return num;
} }
return 0; return 0;
} }
@ -2363,7 +2374,7 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
*counter += 1; *counter += 1;
return oid; return oid;
} }
else if (size == 2) else if ((size == 2) || (size == 3))
{ {
unsigned short oid; unsigned short oid;