compatibility tweak

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30644 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-06-10 05:04:55 +00:00
parent e3a7134ee5
commit 00e6f2a9c1
2 changed files with 11 additions and 1 deletions

View file

@ -1,4 +1,10 @@
2010-06-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSString.m: Raise exception if a null pointer is passed to
+stringWithUTF8String: for compatibility with OSX.
2010-06-09 David Wetzel <dave@turbocat.de>
* Source/Additions/GSXML.m:
check for NULL string
stringWithUTF8String: raises on OSX if you feed it with a NULL string.

View file

@ -767,12 +767,16 @@ handle_printf_atsign (FILE *stream,
}
/**
* Create a string based on the given UTF-8 string, null-terminated.
* Create a string based on the given UTF-8 string, null-terminated.<br />
* Raises NSInvalidArgumentException if given NULL pointer.
*/
+ (id) stringWithUTF8String: (const char *)bytes
{
NSString *obj;
if (NULL == bytes)
[NSException raise: NSInvalidArgumentException
format: @"[NSString+stringWithUTF8String:]: NULL cString"];
obj = [self allocWithZone: NSDefaultMallocZone()];
obj = [obj initWithUTF8String: bytes];
return AUTORELEASE(obj);