diff --git a/ChangeLog b/ChangeLog index a1c8dcb32..b3e55e433 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-07-27 David Ayers + + * Source/Additions/GSCompatibility.m ([-boolValue]): Only compile + for OS X Versions below 10.5 and sync implementation with -base. + Reported by: Georg Fleischmann + 2009-07-23 Richard Frith-Macdonald * GSHTTPURLHandle.m: diff --git a/Source/Additions/GSCompatibility.m b/Source/Additions/GSCompatibility.m index 5a64a8463..7c1e9e210 100644 --- a/Source/Additions/GSCompatibility.m +++ b/Source/Additions/GSCompatibility.m @@ -394,24 +394,30 @@ BOOL GSDebugSet(NSString *level) @implementation NSString(GSCompatibility) -// From GNUStep +#ifndef MAC_OS_X_VERSION_10_5 /** - * If the string consists of the words 'true' or 'yes' (case insensitive) - * or begins with a non-zero numeric value, return YES, otherwise return - * NO. + * Returns YES when scanning the receiver's text from left to right finds a + * digit in the range 1-9 or a letter in the set ('Y', 'y', 'T', 't').
+ * Any trailing characters are ignored.
+ * Any leading whitespace or zeros or signs are also ignored.
+ * Returns NO if the above conditions are not met. */ - (BOOL) boolValue { - if ([self caseInsensitiveCompare: @"YES"] == NSOrderedSame) + static NSCharacterSet *yes = nil; + + if (yes == nil) { - return YES; + yes = RETAIN([NSCharacterSet characterSetWithCharactersInString: + @"123456789yYtT"]); } - if ([self caseInsensitiveCompare: @"true"] == NSOrderedSame) + if ([self rangeOfCharacterFromSet: yes].length > 0) { - return YES; + return YES; } - return [self intValue] != 0 ? YES : NO; + return NO; } +#endif - (NSString*) substringFromRange:(NSRange)range {