mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +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
dbdb1525b2
commit
eea571011b
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>
|
||||
|
||||
* Documentation/ReleaseNotes.gsdoc:
|
||||
|
|
|
@ -499,7 +499,7 @@ foundIgnorableWhitespace: (NSString *)string
|
|||
- (id) initWithPropertyList: (id)aPropertyList
|
||||
intoData: (NSMutableData *)destination;
|
||||
- (void) generate;
|
||||
- (void) storeObject: (id)object;
|
||||
- (BOOL) storeObject: (id)object;
|
||||
- (void) cleanup;
|
||||
|
||||
@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.
|
||||
* The result is ascii data.
|
||||
|
@ -3488,7 +3483,7 @@ isEqualFunc(const void *item1, const void *item2,
|
|||
}
|
||||
}
|
||||
|
||||
- (void) writeObjects
|
||||
- (BOOL) writeObjects
|
||||
{
|
||||
id object;
|
||||
const char *prefix = "bplist00";
|
||||
|
@ -3498,12 +3493,16 @@ isEqualFunc(const void *item1, const void *item2,
|
|||
while ([objectsToDoList count] != 0)
|
||||
{
|
||||
object = [objectsToDoList objectAtIndex: 0];
|
||||
[self storeObject: object];
|
||||
if (NO == [self storeObject: object])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
[objectsToDoList removeObjectAtIndex: 0];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) markOffset: (unsigned int) offset for: (id)object
|
||||
- (BOOL) markOffset: (unsigned int) offset for: (id)object
|
||||
{
|
||||
int oid;
|
||||
|
||||
|
@ -3516,11 +3515,11 @@ isEqualFunc(const void *item1, const void *item2,
|
|||
oid--;
|
||||
if (oid >= table_size)
|
||||
{
|
||||
[NSException raise: NSRangeException
|
||||
format: @"Object table index out of bounds %d.", oid];
|
||||
return NO;
|
||||
}
|
||||
|
||||
table[oid] = offset;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (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])
|
||||
{
|
||||
|
@ -4072,6 +4074,7 @@ isEqualFunc(const void *item1, const void *item2,
|
|||
{
|
||||
NSLog(@"Unknown object class %@", object);
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) generate
|
||||
|
@ -4085,15 +4088,17 @@ isEqualFunc(const void *item1, const void *item2,
|
|||
NS_DURING
|
||||
{
|
||||
[self setup];
|
||||
[self writeObjects];
|
||||
done = YES;
|
||||
done = [self writeObjects];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
[self cleanup];
|
||||
index_size += 1;
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
if (NO == done)
|
||||
{
|
||||
[self cleanup];
|
||||
index_size += 1;
|
||||
}
|
||||
}
|
||||
|
||||
[self writeObjectTable];
|
||||
|
|
Loading…
Reference in a new issue