mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
2009-07-27 David Ayers <ayers@fsfe.org>
* Source/Additions/GSCompatibility.m ([-boolValue]): Only compile for OS X Versions below 10.5 and sync implementation with -base. Reported by: Georg Fleischmann git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28413 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3bf7a26b78
commit
f07bf5fa53
2 changed files with 21 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
|||
2009-07-27 David Ayers <ayers@fsfe.org>
|
||||
|
||||
* 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 <rfm@gnu.org>
|
||||
|
||||
* GSHTTPURLHandle.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').<br />
|
||||
* Any trailing characters are ignored.<br />
|
||||
* Any leading whitespace or zeros or signs are also ignored.<br />
|
||||
* 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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue