* GSWeb.framework/GSUtils.m (boolValueWithDefaultFor): Do not

reimplement defaults bool evaluation semantics differently
        from -base / Foundation.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@19520 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ayers 2004-06-15 10:06:41 +00:00
parent 64c1977fe6
commit 30f4cf019c
2 changed files with 13 additions and 16 deletions

View file

@ -1,4 +1,11 @@
2004-06-14 David Wetzel <dave@turbocat.de>
2004-05-18 David Ayers <d.ayers@inode.at>
* GSWeb.framework/GSUtils.m (boolValueWithDefaultFor): Do not
reimplement defaults bool evaluation semantics differently from
-base / Foundation.
2004-06-14 David Wetzel <dave@turbocat.de>
* GSWeb.framework/GSWElementIDString.m
added setString: (original code from Philip Moetteli,
debugged with David Ayers)
@ -7,7 +14,8 @@
in appendContentString: append string only if not nil
(patch from Philip Moetteli)
2004-06-01 David Wetzel <dave@turbocat.de>
2004-06-01 David Wetzel 2004-05-18 David Ayers <d.ayers@inode.at>
<dave@turbocat.de>
* GSWeb.framework/GSWDeclarationParser.m:
supports 'true' and 'false' now. Will be transformed into YES and NO

View file

@ -84,30 +84,19 @@ BOOL boolValueFor(id anObject)
//--------------------------------------------------------------------
BOOL boolValueWithDefaultFor(id anObject,BOOL defaultValue)
{
int length=0;
int length=0;
if (anObject)
{
if (/*anObject==BNYES ||*/ anObject==NSTYES)
return YES;
else if (/*anObject==BNNO ||*/ anObject==NSTNO)
return NO;
//@protocol NSString
if ([anObject isKindOfClass:[NSString class]]) {
length=[anObject length];
if (length>0) {
if (length<4) { // YES / NO?
return ([anObject caseInsensitiveCompare: @"NO"]!=NSOrderedSame);
}
if (length<6) { // true / false
return ([anObject caseInsensitiveCompare: @"false"]!=NSOrderedSame);
}
}
}
else if ([anObject respondsToSelector:@selector(boolValue)])
return ([anObject boolValue]!=NO);
else if ([anObject respondsToSelector:@selector(intValue)])
return ([anObject intValue]!=0);
else if ([anObject respondsToSelector:@selector(unsignedCharValue)]) //BOOL is unsigned char
/* BOOL is unsigned char. */
else if ([anObject respondsToSelector:@selector(unsignedCharValue)])
return ([anObject unsignedCharValue]!=0);
else
return defaultValue;