* EOControl/EOQualifier.m (getKey): Fix parsing of '%%'

as literal '%'.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@26403 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Ayers 2008-03-30 22:07:56 +00:00
parent d8522ef454
commit 329f4dcf5f
2 changed files with 17 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2008-03-30 David Ayers <ayers@fsfe.org>
* EOControl/EOQualifier.m (getKey): Fix parsing of '%%'
as literal '%'.
2008-03-30 Matt Rice <ratmice@gmail.com> 2008-03-30 Matt Rice <ratmice@gmail.com>
* EOControl/EOQualifier.m (_qualifierWithArgs), * EOControl/EOQualifier.m (_qualifierWithArgs),

View file

@ -272,6 +272,7 @@ getKey(const unichar **cFormat,
|| **s == '@' || **s == '#' || **s == '_' || **s == '$' || **s == '@' || **s == '#' || **s == '_' || **s == '$'
|| **s == '%' || **s == '.' || **s == '-')) || **s == '%' || **s == '.' || **s == '-'))
{ {
/* Parse format specifier */
if (**s == '%') if (**s == '%')
{ {
const char *argString; const char *argString;
@ -436,14 +437,18 @@ getKey(const unichar **cFormat,
case '%': case '%':
{ {
/* TODO userInfo would be nice */ /* The documentation states that '%%' results in a literal '%'.
if ((*s - *cFormat) <= 2) The intention seems to be to allow key/key qualifiers like foo = %%foo
[NSException raise:NSInvalidArgumentException to be interpreted as foo = %foo. (Useful for in memory evaluation?)
format:@"error parsing qualifier format"]; Yet WO45 actually fails to parse this, but we can do better. */
*cFormat = *s + 2; NSString *str;
(*s)++; (*s)++;
[key appendString: [NSString stringWithCharacters: *cFormat str = [NSString stringWithCharacters: *cFormat
length: *s - *cFormat]]; length: *s - *cFormat];
[key appendString: str];
*cFormat = *s + 1;
} }
break; break;