Author: rfm
Date: Wed Mar 23 11:47:24 2016
New Revision: 39595
URL: http://svn.gna.org/viewcvs/gnustep?rev=39595&view=rev
Log:
minor property list generation improvement
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Source/NSPropertyList.m
Modified: libs/base/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=39595&r1=39594&r2=39595&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Wed Mar 23 11:47:24 2016
@@ -1,3 +1,9 @@
+2016-03-23 Richard Frith-Macdonald <[email protected]>
+
+ * 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 <[email protected]>
* Documentation/ReleaseNotes.gsdoc:
Modified: libs/base/trunk/Source/NSPropertyList.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSPropertyList.m?rev=39595&r1=39594&r2=39595&view=diff
==============================================================================
--- libs/base/trunk/Source/NSPropertyList.m (original)
+++ libs/base/trunk/Source/NSPropertyList.m Wed Mar 23 11:47:24 2016
@@ -499,7 +499,7 @@
- (id) initWithPropertyList: (id)aPropertyList
intoData: (NSMutableData *)destination;
- (void) generate;
-- (void) storeObject: (id)object;
+- (BOOL) storeObject: (id)object;
- (void) cleanup;
@end
@@ -1500,11 +1500,6 @@
}
}
-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 @@
}
}
-- (void) writeObjects
+- (BOOL) writeObjects
{
id object;
const char *prefix = "bplist00";
@@ -3498,12 +3493,16 @@
while ([objectsToDoList count] != 0)
{
object = [objectsToDoList objectAtIndex: 0];
- [self storeObject: object];
+ if (NO == [self storeObject: object])
+ {
+ return NO;
+ }
[objectsToDoList removeObjectAtIndex: 0];
}
-}
-
-- (void) markOffset: (unsigned int) offset for: (id)object
+ return YES;
+}
+
+- (BOOL) markOffset: (unsigned int) offset for: (id)object
{
int oid;
@@ -3516,11 +3515,11 @@
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 @@
}
}
-- (void) storeObject: (id)object
-{
- [self markOffset: [dest length] for: object];
+- (BOOL) storeObject: (id)object
+{
+ if (NO == [self markOffset: [dest length] for: object])
+ {
+ return NO;
+ }
if ([object isKindOfClass: NSStringClass])
{
@@ -4072,6 +4074,7 @@
{
NSLog(@"Unknown object class %@", object);
}
+ return YES;
}
- (void) generate
@@ -4085,15 +4088,17 @@
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];
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs