bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix, Base/GDL2 GSCompatibility.m (-boolValue)


From: Georg Fleischmann
Subject: Fix, Base/GDL2 GSCompatibility.m (-boolValue)
Date: Fri, 17 Jul 2009 10:50:25 +0800


here is a patch for Base to make GDL2 on Cocoa work with boolean values from EOModels. The boolean values in my EOModel files are stored as "Y" only, not a complete "Yes" ( allowsNull = Y; ). This ("Y") works fine on a complete GNUstep system, but fails with the Compatibility code that is only allowing a complete "YES" (or "TRUE").

The attached patch makes this work for me with Cocoa.
I tried to make it similar to the latest boolValue method in GSString, testing for "123456789yYtT".

Best wishes,
Georg

PS: I am still using Base-Version 1.15.0 on Apple, because the current base-versions doesn't seem to compile any more with Mac OS 10.4.11. Anyway, [GSCompatibility -boolValue] didn't change since then.



*** Source/Additions/GSCompatibility.m.old      Thu Apr 12 22:27:47 2007
--- Source/Additions/GSCompatibility.m  Fri Jul 17 10:29:29 2009
***************
*** 390,404 ****
   */
  - (BOOL) boolValue
  {
!   if ([self caseInsensitiveCompare: @"YES"] == NSOrderedSame)
      {
!         return YES;
!     }
!   if ([self caseInsensitiveCompare: @"true"] == NSOrderedSame)
!     {
!         return YES;
      }
!   return [self intValue] != 0 ? YES : NO;
  }

  - (NSString*) substringFromRange:(NSRange)range
--- 390,405 ----
   */
  - (BOOL) boolValue
  {
!   if ([self length])
      {
!       unichar uc = [self characterAtIndex:0];
!
!       if (uc <= 0x7F && strchr("123456789yYtT", (char)uc) != 0)
!         {
!           return YES;
!         }
      }
!   return NO;
  }

  - (NSString*) substringFromRange:(NSRange)range





reply via email to

[Prev in Thread] Current Thread [Next in Thread]