* 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>
* EOControl/EOQualifier.m (_qualifierWithArgs),

View file

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