mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-04 18:40:47 +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
52de73a626
commit
9b072f06d4
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>
|
2009-07-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* GSHTTPURLHandle.m:
|
* GSHTTPURLHandle.m:
|
||||||
|
|
|
@ -394,24 +394,30 @@ BOOL GSDebugSet(NSString *level)
|
||||||
|
|
||||||
@implementation NSString(GSCompatibility)
|
@implementation NSString(GSCompatibility)
|
||||||
|
|
||||||
// From GNUStep
|
#ifndef MAC_OS_X_VERSION_10_5
|
||||||
/**
|
/**
|
||||||
* If the string consists of the words 'true' or 'yes' (case insensitive)
|
* Returns YES when scanning the receiver's text from left to right finds a
|
||||||
* or begins with a non-zero numeric value, return YES, otherwise return
|
* digit in the range 1-9 or a letter in the set ('Y', 'y', 'T', 't').<br />
|
||||||
* NO.
|
* 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
|
- (BOOL) boolValue
|
||||||
{
|
{
|
||||||
if ([self caseInsensitiveCompare: @"YES"] == NSOrderedSame)
|
static NSCharacterSet *yes = nil;
|
||||||
|
|
||||||
|
if (yes == nil)
|
||||||
|
{
|
||||||
|
yes = RETAIN([NSCharacterSet characterSetWithCharactersInString:
|
||||||
|
@"123456789yYtT"]);
|
||||||
|
}
|
||||||
|
if ([self rangeOfCharacterFromSet: yes].length > 0)
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
if ([self caseInsensitiveCompare: @"true"] == NSOrderedSame)
|
return NO;
|
||||||
{
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
return [self intValue] != 0 ? YES : NO;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
- (NSString*) substringFromRange:(NSRange)range
|
- (NSString*) substringFromRange:(NSRange)range
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue