From 329f4dcf5fadc9502c57cc93f71c1ae7048cb31c Mon Sep 17 00:00:00 2001 From: David Ayers Date: Sun, 30 Mar 2008 22:07:56 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ EOControl/EOQualifier.m | 19 ++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6e2de9..bd1b29d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-30 David Ayers + + * EOControl/EOQualifier.m (getKey): Fix parsing of '%%' + as literal '%'. + 2008-03-30 Matt Rice * EOControl/EOQualifier.m (_qualifierWithArgs), diff --git a/EOControl/EOQualifier.m b/EOControl/EOQualifier.m index 3030281..b6b298c 100644 --- a/EOControl/EOQualifier.m +++ b/EOControl/EOQualifier.m @@ -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;