Fix a variety of dumb bugs.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14268 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-08-14 07:36:25 +00:00
parent d544659c91
commit 5606926df2
8 changed files with 37 additions and 8 deletions

View file

@ -1,3 +1,12 @@
2002-08-14 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSString.m: Allow 'true' as boolean value
* Source/NSConcreteNumber.m: Output 'YES' as boolean in description.
* Source/NSNotificationCenter.m: Fix dumb memory leak.
* Source/NSNumber.m: Output 'YES' as boolean in description.
* Source/NSUserDefaults.m: Set 'YES' as boolean string.
* Headers/Foundation/NSObject.h: Fix v dumb memory leak.
2002-08-11 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: Check for libxml version 2.3.0 or greater to ensure

View file

@ -392,7 +392,7 @@ id __object = (id)(object); (__object != nil) ? [__object retain] : nil; })
#endif
#ifndef TEST_RELEASE
#define TEST_RELEASE(object) ({\
id __object = (id)(object); if (__object != nil) [__object retain]; })
id __object = (id)(object); if (__object != nil) [__object release]; })
#endif
#ifndef TEST_AUTORELEASE
#define TEST_AUTORELEASE(object) ({\

View file

@ -548,6 +548,14 @@ boolValue_c(ivars self)
{
return YES;
}
else if (len == 4
&& (self->_contents.c[0] == 'T' || self->_contents.c[0] == 't')
&& (self->_contents.c[1] == 'R' || self->_contents.c[1] == 'r')
&& (self->_contents.c[2] == 'U' || self->_contents.c[2] == 'u')
&& (self->_contents.c[3] == 'E' || self->_contents.c[3] == 'e'))
{
return YES;
}
else
{
unsigned char buf[len+1];
@ -580,6 +588,14 @@ boolValue_u(ivars self)
{
return YES;
}
else if (l == 4
&& (buf[0] == 'T' || buf[0] == 't')
&& (buf[1] == 'R' || buf[1] == 'r')
&& (buf[2] == 'U' || buf[2] == 'u')
&& (buf[3] == 'E' || buf[3] == 'e'))
{
return YES;
}
else
{
return atoi(buf);

View file

@ -376,7 +376,7 @@
- (NSString*) descriptionWithLocale: (NSDictionary*)locale
{
#if TYPE_ORDER == 0
return (data) ? @"true" : @"false";
return (data) ? @"YES" : @"NO";
#else
NSString *result = [NSString alloc];

View file

@ -954,7 +954,7 @@ static NSNotificationCenter *default_center = nil;
[NSException raise: NSInvalidArgumentException
format: @"Tried to post a notification with no name."];
}
object = TEST_RETAIN([notification object]);
object = [notification object];
if (object != nil)
{
object = CHEATGC(object);

View file

@ -683,7 +683,7 @@ static Class doubleNumberClass;
switch (info->typeLevel)
{
case 0:
return [self boolValue] ? @"true" : @"false";
return [self boolValue] ? @"YES" : @"NO";
break;
case 1:

View file

@ -1258,7 +1258,7 @@ static BOOL double_release_check_enabled = NO;
}
/**
* Returns a flag to differnetiate between 'true' objects, and objects
* Returns a flag to differentiate between 'true' objects, and objects
* which are proxies for other objects (ie they forward messages to the
* other objects).<br />
* The default implementation returns NO.

View file

@ -814,7 +814,10 @@ static NSString *pathForUser(NSString *user)
* and returns its boolean representation.<br />
* Returns NO if it is not a boolean.<br />
* The text 'yes' or 'true' or any non zero numeric value is considered
* to be a boolean YES. Other string values are NO.
* to be a boolean YES. Other string values are NO.<br />
* NB. This differs slightly from the documented behavior for MacOS-X
* (August 2002) in that the GNUstep version accepts the string 'TRUE'
* as equivalent to 'YES'.
*/
- (BOOL) boolForKey: (NSString*)defaultName
{
@ -949,8 +952,9 @@ static NSString *pathForUser(NSString *user)
}
/**
* Sets a boolean value for defaultName in the application domain.
* <br />Calls -setObject:forKey: to make the change.
* Sets a boolean value for defaultName in the application domain.<br />
* The boolean value is stored as a string - either YES or NO.
* Calls -setObject:forKey: to make the change.
*/
- (void) setBool: (BOOL)value forKey: (NSString*)defaultName
{