mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
([BinaryCStream -encodeValueOfCType:at:withName:]): Use NSException
instead of sending -error:. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1272 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
095ebaaa4c
commit
9536fdc257
1 changed files with 11 additions and 5 deletions
|
@ -255,7 +255,8 @@ static BOOL debug_binary_coder;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
[self error:"Unrecognized Type %s", type];
|
[NSException raise: NSGenericException
|
||||||
|
format: @"Unrecognized type %s", type];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +275,9 @@ static BOOL debug_binary_coder;
|
||||||
if (encoded_type != *type
|
if (encoded_type != *type
|
||||||
&& !((encoded_type=='c' || encoded_type=='C')
|
&& !((encoded_type=='c' || encoded_type=='C')
|
||||||
&& (*type=='c' || *type=='C')))
|
&& (*type=='c' || *type=='C')))
|
||||||
[self error:"Expected type \"%c\", got type \"%c\"", *type, encoded_type];
|
[NSException raise: NSGenericException
|
||||||
|
format @"Expected type \"%c\", got type \"%c\"",
|
||||||
|
*type, encoded_type];
|
||||||
|
|
||||||
switch (encoded_type)
|
switch (encoded_type)
|
||||||
{
|
{
|
||||||
|
@ -327,7 +330,8 @@ static BOOL debug_binary_coder;
|
||||||
char *buf;
|
char *buf;
|
||||||
[self decodeValueOfCType:@encode(char*) at:&buf withName:NULL];
|
[self decodeValueOfCType:@encode(char*) at:&buf withName:NULL];
|
||||||
if (sscanf(buf, "%f", (float*)d) != 1)
|
if (sscanf(buf, "%f", (float*)d) != 1)
|
||||||
[self error:"expected float, got %s", buf];
|
[NSException raise: NSGenericException
|
||||||
|
format: @"expected float, got %s", buf];
|
||||||
(*objc_free)(buf);
|
(*objc_free)(buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -336,7 +340,8 @@ static BOOL debug_binary_coder;
|
||||||
char *buf;
|
char *buf;
|
||||||
[self decodeValueOfCType:@encode(char*) at:&buf withName:NULL];
|
[self decodeValueOfCType:@encode(char*) at:&buf withName:NULL];
|
||||||
if (sscanf(buf, "%lf", (double*)d) != 1)
|
if (sscanf(buf, "%lf", (double*)d) != 1)
|
||||||
[self error:"expected double, got %s", buf];
|
[NSException raise: NSGenericException
|
||||||
|
format: @"expected double, got %s", buf];
|
||||||
(*objc_free)(buf);
|
(*objc_free)(buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -384,7 +389,8 @@ static BOOL debug_binary_coder;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
[self error:"Unrecognized Type %s", type];
|
[NSException raise: NSGenericException
|
||||||
|
format: @"Unrecognized Type %s", type];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug_binary_coder)
|
if (debug_binary_coder)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue