Fix for parsing escape sequences in prop lists

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4687 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-08-02 07:07:50 +00:00
parent cc443bc8a2
commit 4f0262bc9f
2 changed files with 20 additions and 8 deletions

View file

@ -1,3 +1,8 @@
Mon Aug 2 8:10:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/propList.h: parseQuotedString() fix for parsing octal escape
sequences - hope it's right now.
Sun Aug 1 7:25:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk> Sun Aug 1 7:25:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSBundle.m: ([+localizedStringForKey:value:table:]) Fixed so * Source/NSBundle.m: ([+localizedStringForKey:value:table:]) Fixed so

View file

@ -131,7 +131,7 @@ typedef struct {
#if GSPLUNI #if GSPLUNI
const unichar *ptr; const unichar *ptr;
#else #else
const unsigned char *ptr; const char *ptr;
#endif #endif
unsigned end; unsigned end;
unsigned pos; unsigned pos;
@ -223,8 +223,6 @@ static inline id parseQuotedString(pldata* pld)
{ {
unichar c = (unichar)pld->ptr[pld->pos]; unichar c = (unichar)pld->ptr[pld->pos];
if (c == '\n')
pld->lin++;
if (escaped) if (escaped)
{ {
if (escaped == 1 && c == '0') if (escaped == 1 && c == '0')
@ -252,6 +250,7 @@ static inline id parseQuotedString(pldata* pld)
} }
else else
{ {
pld->pos--;
escaped = 0; escaped = 0;
} }
} }
@ -268,8 +267,12 @@ static inline id parseQuotedString(pldata* pld)
shrink++; shrink++;
} }
else if (c == '"') else if (c == '"')
break; {
break;
}
} }
if (c == '\n')
pld->lin++;
pld->pos++; pld->pos++;
} }
if (pld->pos >= pld->end) if (pld->pos >= pld->end)
@ -286,7 +289,7 @@ static inline id parseQuotedString(pldata* pld)
#if GSPLUNI #if GSPLUNI
unichar chars[pld->pos - start - shrink]; unichar chars[pld->pos - start - shrink];
#else #else
unsigned char chars[pld->pos - start - shrink]; char chars[pld->pos - start - shrink];
#endif #endif
unsigned j; unsigned j;
unsigned k; unsigned k;
@ -327,7 +330,7 @@ static inline id parseQuotedString(pldata* pld)
else else
{ {
escaped = 0; escaped = 0;
chars[++k] = c; j--;
k++; k++;
} }
} }
@ -352,9 +355,13 @@ static inline id parseQuotedString(pldata* pld)
{ {
chars[k] = c; chars[k] = c;
if (c == '\\') if (c == '\\')
escaped = 1; {
escaped = 1;
}
else else
k++; {
k++;
}
} }
} }
obj = (*plAlloc)(plCls, @selector(allocWithZone:), NSDefaultMallocZone()); obj = (*plAlloc)(plCls, @selector(allocWithZone:), NSDefaultMallocZone());