mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
minor property list generation improvement
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39595 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
28893e01ae
commit
d5e55c0470
2 changed files with 28 additions and 17 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2016-03-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSPropertyList.m: Remove unused function. Change binary
|
||||||
|
plist generation to return NO if our index table needs to grow,
|
||||||
|
rather than raising exceptions during normal operation.
|
||||||
|
|
||||||
2016-03-20 Richard Frith-Macdonald <rfm@gnu.org>
|
2016-03-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Documentation/ReleaseNotes.gsdoc:
|
* Documentation/ReleaseNotes.gsdoc:
|
||||||
|
|
|
@ -499,7 +499,7 @@ foundIgnorableWhitespace: (NSString *)string
|
||||||
- (id) initWithPropertyList: (id)aPropertyList
|
- (id) initWithPropertyList: (id)aPropertyList
|
||||||
intoData: (NSMutableData *)destination;
|
intoData: (NSMutableData *)destination;
|
||||||
- (void) generate;
|
- (void) generate;
|
||||||
- (void) storeObject: (id)object;
|
- (BOOL) storeObject: (id)object;
|
||||||
- (void) cleanup;
|
- (void) cleanup;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1500,11 +1500,6 @@ encodeBase64(NSData *source, NSMutableData *dest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void Append(void *bytes, unsigned length, NSMutableData *dst)
|
|
||||||
{
|
|
||||||
[dst appendBytes: bytes length: length];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output a string escaped for OpenStep style property lists.
|
* Output a string escaped for OpenStep style property lists.
|
||||||
* The result is ascii data.
|
* The result is ascii data.
|
||||||
|
@ -3488,7 +3483,7 @@ isEqualFunc(const void *item1, const void *item2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) writeObjects
|
- (BOOL) writeObjects
|
||||||
{
|
{
|
||||||
id object;
|
id object;
|
||||||
const char *prefix = "bplist00";
|
const char *prefix = "bplist00";
|
||||||
|
@ -3498,12 +3493,16 @@ isEqualFunc(const void *item1, const void *item2,
|
||||||
while ([objectsToDoList count] != 0)
|
while ([objectsToDoList count] != 0)
|
||||||
{
|
{
|
||||||
object = [objectsToDoList objectAtIndex: 0];
|
object = [objectsToDoList objectAtIndex: 0];
|
||||||
[self storeObject: object];
|
if (NO == [self storeObject: object])
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
[objectsToDoList removeObjectAtIndex: 0];
|
[objectsToDoList removeObjectAtIndex: 0];
|
||||||
}
|
}
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) markOffset: (unsigned int) offset for: (id)object
|
- (BOOL) markOffset: (unsigned int) offset for: (id)object
|
||||||
{
|
{
|
||||||
int oid;
|
int oid;
|
||||||
|
|
||||||
|
@ -3516,11 +3515,11 @@ isEqualFunc(const void *item1, const void *item2,
|
||||||
oid--;
|
oid--;
|
||||||
if (oid >= table_size)
|
if (oid >= table_size)
|
||||||
{
|
{
|
||||||
[NSException raise: NSRangeException
|
return NO;
|
||||||
format: @"Object table index out of bounds %d.", oid];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
table[oid] = offset;
|
table[oid] = offset;
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) writeObjectTable
|
- (void) writeObjectTable
|
||||||
|
@ -4040,9 +4039,12 @@ isEqualFunc(const void *item1, const void *item2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) storeObject: (id)object
|
- (BOOL) storeObject: (id)object
|
||||||
{
|
{
|
||||||
[self markOffset: [dest length] for: object];
|
if (NO == [self markOffset: [dest length] for: object])
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
if ([object isKindOfClass: NSStringClass])
|
if ([object isKindOfClass: NSStringClass])
|
||||||
{
|
{
|
||||||
|
@ -4072,6 +4074,7 @@ isEqualFunc(const void *item1, const void *item2,
|
||||||
{
|
{
|
||||||
NSLog(@"Unknown object class %@", object);
|
NSLog(@"Unknown object class %@", object);
|
||||||
}
|
}
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) generate
|
- (void) generate
|
||||||
|
@ -4085,15 +4088,17 @@ isEqualFunc(const void *item1, const void *item2,
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
[self setup];
|
[self setup];
|
||||||
[self writeObjects];
|
done = [self writeObjects];
|
||||||
done = YES;
|
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
{
|
{
|
||||||
[self cleanup];
|
|
||||||
index_size += 1;
|
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER
|
NS_ENDHANDLER
|
||||||
|
if (NO == done)
|
||||||
|
{
|
||||||
|
[self cleanup];
|
||||||
|
index_size += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[self writeObjectTable];
|
[self writeObjectTable];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue