mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Tolerate null pointer arguments for returning information.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20063 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
eecc49af68
commit
d427f1afd3
4 changed files with 36 additions and 16 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-09-14 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSDateFormatter.m:
|
||||
* Source/NSNumberFormatter.m:
|
||||
Tolerate being given null pointers to return values in.
|
||||
|
||||
2004-09-13 Adrian Robert <arobert@cogsci.ucsd.edu>
|
||||
|
||||
* Tools/gsdoc-1_0_1.rnc: Added usage information.
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
- (NSString*) editingStringForObjectValue: (id)anObject;
|
||||
|
||||
/**
|
||||
/** <override-subclass />
|
||||
* Primary method for converting a string to an object through parsing.
|
||||
* anObject and error are output parameters; you should allocate memory for
|
||||
* one pointer each for the variables passed into these methods. The
|
||||
|
@ -106,7 +106,7 @@
|
|||
errorDescription: (NSString**)error;
|
||||
|
||||
|
||||
/**
|
||||
/** <override-subclass />
|
||||
* Primary method for converting an object to a string through formatting.
|
||||
* Object will be converted to string according to the formatter's
|
||||
* implementation and init parameters. There is no default handling if the
|
||||
|
|
|
@ -90,11 +90,17 @@
|
|||
}
|
||||
if (d == nil)
|
||||
{
|
||||
*error = @"Couldn't convert to date";
|
||||
if (error)
|
||||
{
|
||||
*error = @"Couldn't convert to date";
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
*anObject = d;
|
||||
if (anObject)
|
||||
{
|
||||
*anObject = d;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -116,8 +122,14 @@
|
|||
newEditingString: (NSString**)newString
|
||||
errorDescription: (NSString**)error
|
||||
{
|
||||
*newString = nil;
|
||||
*error = nil;
|
||||
if (newString)
|
||||
{
|
||||
*newString = nil;
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
*error = nil;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,6 +131,7 @@
|
|||
[encoder encodeObject: _attributesForPositiveValues];
|
||||
[encoder encodeObject: _attributesForNegativeValues];
|
||||
}
|
||||
|
||||
- (NSString*) format
|
||||
{
|
||||
if (_attributedStringForZero != nil)
|
||||
|
@ -149,20 +150,15 @@
|
|||
forString: (NSString*)string
|
||||
errorDescription: (NSString**)error
|
||||
{
|
||||
if (anObject == NULL)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"NULL Object pointer to NSNumberFormatter"];
|
||||
/* NO RETURN. */
|
||||
return NO;
|
||||
}
|
||||
|
||||
/* FIXME: This is just a quick hack implementation. */
|
||||
NSLog(@"NSNumberFormatter-getObjectValue:forString:... not implemented");
|
||||
if (_positiveFormat == nil && _negativeFormat == nil)
|
||||
{
|
||||
/* Just assume nothing else has been setup and do a simple conversion. */
|
||||
*anObject = [NSDecimalNumber decimalNumberWithString: string];
|
||||
if (anObject)
|
||||
{
|
||||
*anObject = [NSDecimalNumber decimalNumberWithString: string];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
|
@ -220,7 +216,13 @@
|
|||
errorDescription: (NSString**)error
|
||||
{
|
||||
if (newString != NULL)
|
||||
*newString = partialString;
|
||||
{
|
||||
*newString = partialString;
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
error = nil;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue