mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +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
acd9220a76
commit
1bf651cc0c
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;
|
||||
|
|
|
@ -700,21 +700,24 @@ static unsigned urlAlign;
|
|||
/*
|
||||
* Set up scheme specific parsing options.
|
||||
*/
|
||||
if (buf->scheme != 0)
|
||||
if (buf->scheme == 0)
|
||||
{
|
||||
DESTROY(self); // Not a valid URL
|
||||
NS_VALRETURN(nil);
|
||||
}
|
||||
|
||||
if (strcmp(buf->scheme, "file") == 0)
|
||||
{
|
||||
if (strcmp(buf->scheme, "file") == 0)
|
||||
{
|
||||
usesFragments = NO;
|
||||
usesParameters = NO;
|
||||
usesQueries = NO;
|
||||
buf->isFile = YES;
|
||||
}
|
||||
else if (strcmp(buf->scheme, "mailto") == 0)
|
||||
{
|
||||
usesFragments = NO;
|
||||
usesParameters = NO;
|
||||
usesQueries = NO;
|
||||
}
|
||||
usesFragments = NO;
|
||||
usesParameters = NO;
|
||||
usesQueries = NO;
|
||||
buf->isFile = YES;
|
||||
}
|
||||
else if (strcmp(buf->scheme, "mailto") == 0)
|
||||
{
|
||||
usesFragments = NO;
|
||||
usesParameters = NO;
|
||||
usesQueries = NO;
|
||||
}
|
||||
|
||||
if (canBeGeneric == YES)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue