diff --git a/ChangeLog b/ChangeLog index b7062e2f5..b3d5b6573 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-09-08 Richard Frith-Macdonald + + * Source/GSCompatibility.m: GSXMLPlMake() unused argument removed. + * Source/NSData.m: Unused and commented out XML plist code removed. + * Source/NSString.m: ditto + * Source/NSArray.m: Generate XML plists only when writing to file, + not for the -description... methods. This is what MacOS-X does. + * Source/NSDictionary.m: ditto + 2001-09-05 Adam Fedor * configure.in: Define BROKEN_NESTED_FUNCTIONS if compiler sucks. diff --git a/Source/GSCompatibility.m b/Source/GSCompatibility.m index f67ff0c6b..2ee08ebb0 100644 --- a/Source/GSCompatibility.m +++ b/Source/GSCompatibility.m @@ -495,7 +495,7 @@ XMLPlObject(NSMutableString *dest, id obj, NSDictionary *loc, unsigned lev) } NSString* -GSXMLPlMake(id obj, NSDictionary *loc, unsigned lev) +GSXMLPlMake(id obj, NSDictionary *loc) { NSMutableString *dest; diff --git a/Source/NSArray.m b/Source/NSArray.m index 3830f062f..545416e84 100644 --- a/Source/NSArray.m +++ b/Source/NSArray.m @@ -728,25 +728,14 @@ static int compare(id elem1, id elem2, void* context) - (NSString*) descriptionWithLocale: (NSDictionary*)locale indent: (unsigned int)level { - extern BOOL GSMacOSXCompatiblePropertyLists(); + NSMutableString *result; - if (GSMacOSXCompatiblePropertyLists() == YES) - { - extern NSString *GSXMLPlMake(id obj, NSDictionary *loc, unsigned lev); - - return GSXMLPlMake(self, locale, level); - } - else - { - NSMutableString *result; - - result = [[NSMutableString alloc] initWithCapacity: 20*[self count]]; - result = AUTORELEASE(result); - [self descriptionWithLocale: locale - indent: level - to: (id)result]; - return result; - } + result = [[NSMutableString alloc] initWithCapacity: 20*[self count]]; + result = AUTORELEASE(result); + [self descriptionWithLocale: locale + indent: level + to: (id)result]; + return result; } static NSString *indentStrings[] = { @@ -841,11 +830,29 @@ static NSString *indentStrings[] = { - (BOOL) writeToFile: (NSString *)path atomically: (BOOL)useAuxiliaryFile { + extern BOOL GSMacOSXCompatiblePropertyLists(); NSDictionary *loc; NSString *desc; loc = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]; - desc = [self descriptionWithLocale: loc indent: 0]; + + if (GSMacOSXCompatiblePropertyLists() == YES) + { + extern NSString *GSXMLPlMake(id obj, NSDictionary *loc); + + desc = GSXMLPlMake(self, loc); + } + else + { + NSMutableString *result; + + result = [[NSMutableString alloc] initWithCapacity: 20*[self count]]; + result = AUTORELEASE(result); + [self descriptionWithLocale: loc + indent: 0 + to: (id)result]; + desc = result; + } return [desc writeToFile: path atomically: useAuxiliaryFile]; } diff --git a/Source/NSData.m b/Source/NSData.m index e353a4b53..4913e6052 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -571,15 +571,6 @@ failure: NSZone *z; extern BOOL GSMacOSXCompatiblePropertyLists(); -/* Don't think we want this - if (GSMacOSXCompatiblePropertyLists() == YES) - { - extern NSString *GSXMLPlMake(id obj, NSDictionary *loc, unsigned lev); - - return GSXMLPlMake(self, nil, 0); - } -*/ - src = [self bytes]; length = [self length]; z = [self zone]; diff --git a/Source/NSDictionary.m b/Source/NSDictionary.m index f2b7e5a52..5a3ab9333 100644 --- a/Source/NSDictionary.m +++ b/Source/NSDictionary.m @@ -622,11 +622,29 @@ compareIt(id o1, id o2, void* context) - (BOOL) writeToFile: (NSString *)path atomically: (BOOL)useAuxiliaryFile { + extern BOOL GSMacOSXCompatiblePropertyLists(); NSDictionary *loc; NSString *desc; loc = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]; - desc = [self descriptionWithLocale: loc indent: 0]; + + if (GSMacOSXCompatiblePropertyLists() == YES) + { + extern NSString *GSXMLPlMake(id obj, NSDictionary *loc); + + desc = GSXMLPlMake(self, loc); + } + else + { + NSMutableString *result; + + result = AUTORELEASE([[NSMutableString alloc] initWithCapacity: + 20*[self count]]); + [self descriptionWithLocale: loc + indent: 0 + to: (id)result]; + desc = result; + } return [desc writeToFile: path atomically: useAuxiliaryFile]; } @@ -686,25 +704,14 @@ compareIt(id o1, id o2, void* context) - (NSString*) descriptionWithLocale: (NSDictionary*)locale indent: (unsigned int)level { - extern BOOL GSMacOSXCompatiblePropertyLists(); + NSMutableString *result; - if (GSMacOSXCompatiblePropertyLists() == YES) - { - extern NSString *GSXMLPlMake(id obj, NSDictionary *loc, unsigned lev); - - return GSXMLPlMake(self, locale, level); - } - else - { - NSMutableString *result; - - result = AUTORELEASE([[NSMutableString alloc] initWithCapacity: - 20*[self count]]); - [self descriptionWithLocale: locale - indent: level - to: (id)result]; - return result; - } + result = AUTORELEASE([[NSMutableString alloc] initWithCapacity: + 20*[self count]]); + [self descriptionWithLocale: locale + indent: level + to: (id)result]; + return result; } static NSString *indentStrings[] = { diff --git a/Source/NSString.m b/Source/NSString.m index e2ea5d904..dc812c24a 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -3172,18 +3172,6 @@ handle_printf_atsign (FILE *stream, to: (id)output { unsigned length; -/* - * Don't think the following should be there. - extern BOOL GSMacOSXCompatiblePropertyLists(); - - if (GSMacOSXCompatiblePropertyLists() == YES) - { - extern NSString *GSXMLPlMake(id obj, NSDictionary *loc, unsigned lev); - - [output appendString: GSXMLPlMake(self, aLocale, level)]; - return; - } -*/ if ((length = [self length]) == 0) {