mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 12:16:40 +00:00
Add a couple of tests for errors.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24186 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
aa920a0395
commit
c51ffc03af
3 changed files with 32 additions and 15 deletions
|
@ -2564,7 +2564,15 @@ handle_printf_atsign (FILE *stream,
|
|||
unsigned length = [d length];
|
||||
BOOL result = (length <= maxLength) ? YES : NO;
|
||||
|
||||
if (length > maxLength) length = maxLength;
|
||||
if (d == nil)
|
||||
{
|
||||
[NSException raise: NSCharacterConversionException
|
||||
format: @"Can't convert to C string."];
|
||||
}
|
||||
if (length > maxLength)
|
||||
{
|
||||
length = maxLength;
|
||||
}
|
||||
memcpy(buffer, [d bytes], length);
|
||||
buffer[length] = '\0';
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue