mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-04-22 12:55:44 +00:00
* EOControl/EOQualifer.m (getKey): Allow literal numbers
without class declarations. Reported by Dirk Lattermann. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@20595 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a375da55d0
commit
96ff6c7113
2 changed files with 28 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
|||
2005-01-22 David Ayers <d.ayers@inode.at>
|
||||
|
||||
* EOControl/EOQualifer.m (getKey): Allow literal numbers without
|
||||
class declarations. Reported by Dirk Lattermann.
|
||||
|
||||
2005-01-18 Peter Cooper <comrade@obverse.com>
|
||||
|
||||
* EOAdaptors/Postgres95/Postgres95Channel.m
|
||||
|
|
|
@ -180,12 +180,17 @@ static NSString *getOperator(const char **cFormat, const char **s)
|
|||
return operator;
|
||||
}
|
||||
|
||||
static id getKey(const char **cFormat, const char **s, BOOL *isKeyValue,
|
||||
va_list *args)
|
||||
static id
|
||||
getKey(const char **cFormat,
|
||||
const char **s,
|
||||
BOOL *isKeyValue,
|
||||
va_list *args)
|
||||
{
|
||||
NSMutableString *key, *classString = nil;
|
||||
NSMutableString *key;
|
||||
NSString *classString = nil;
|
||||
char quoteChar;
|
||||
BOOL quoted = NO;
|
||||
BOOL literalNumber = NO;
|
||||
|
||||
while (**s && isspace(**s))
|
||||
(*s)++;
|
||||
|
@ -199,7 +204,7 @@ static id getKey(const char **cFormat, const char **s, BOOL *isKeyValue,
|
|||
while (**s && **s != ')')
|
||||
(*s)++;
|
||||
|
||||
if (!*s); //TODO exception
|
||||
NSCAssert(*s, @"Illegal Qualifer format missing bracket.");
|
||||
|
||||
classString = [NSString stringWithCString: *cFormat
|
||||
length: *s - *cFormat];
|
||||
|
@ -241,15 +246,25 @@ static id getKey(const char **cFormat, const char **s, BOOL *isKeyValue,
|
|||
{
|
||||
key = [NSMutableString stringWithCapacity:8];
|
||||
|
||||
if (classString == nil
|
||||
&& (isdigit(**s) || (**s == '-' && isdigit(*(*s+1)))))
|
||||
{
|
||||
classString = @"NSNumber";
|
||||
literalNumber = YES;
|
||||
}
|
||||
|
||||
while (**s && (isalnum(**s) || **s == '@' || **s == '#' || **s == '_'
|
||||
|| **s == '$' || **s == '%' || **s == '.'))
|
||||
|| **s == '$' || **s == '%' || **s == '.' || **s == '-'))
|
||||
{
|
||||
if (**s == '%')
|
||||
{
|
||||
const char *argString;
|
||||
NSString *argObj;
|
||||
//float argFloat;
|
||||
double argFloat; // `float' is promoted to `double' when passed through `...' (so you should pass `double' not `float' to `va_arg')
|
||||
double argFloat;
|
||||
/* 'float' is promoted to 'double' when passed through '...'
|
||||
(so you should pass 'double' not 'float' to `va_arg')
|
||||
Ayers: I believe the compiler should does promotion implicitly
|
||||
but there are buggy compilers so cast to be safe. */
|
||||
|
||||
int argInt;
|
||||
|
||||
|
@ -371,7 +386,7 @@ static id getKey(const char **cFormat, const char **s, BOOL *isKeyValue,
|
|||
|
||||
if (isKeyValue)
|
||||
{
|
||||
*isKeyValue = quoted;
|
||||
*isKeyValue = (quoted || literalNumber);
|
||||
|
||||
if (classString)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue