From 4f0262bc9f65deeccb93ddd5e4dd921be1037ad1 Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 2 Aug 1999 07:07:50 +0000 Subject: [PATCH] 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 --- ChangeLog | 5 +++++ Source/propList.h | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0ef013334..144d27bb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Aug 2 8:10:00 1999 Richard Frith-Macdonald + + * 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 * Source/NSBundle.m: ([+localizedStringForKey:value:table:]) Fixed so diff --git a/Source/propList.h b/Source/propList.h index a76aecbb5..2b8df80eb 100644 --- a/Source/propList.h +++ b/Source/propList.h @@ -131,7 +131,7 @@ typedef struct { #if GSPLUNI const unichar *ptr; #else - const unsigned char *ptr; + const char *ptr; #endif unsigned end; unsigned pos; @@ -223,8 +223,6 @@ static inline id parseQuotedString(pldata* pld) { unichar c = (unichar)pld->ptr[pld->pos]; - if (c == '\n') - pld->lin++; if (escaped) { if (escaped == 1 && c == '0') @@ -252,6 +250,7 @@ static inline id parseQuotedString(pldata* pld) } else { + pld->pos--; escaped = 0; } } @@ -268,8 +267,12 @@ static inline id parseQuotedString(pldata* pld) shrink++; } else if (c == '"') - break; + { + break; + } } + if (c == '\n') + pld->lin++; pld->pos++; } if (pld->pos >= pld->end) @@ -286,7 +289,7 @@ static inline id parseQuotedString(pldata* pld) #if GSPLUNI unichar chars[pld->pos - start - shrink]; #else - unsigned char chars[pld->pos - start - shrink]; + char chars[pld->pos - start - shrink]; #endif unsigned j; unsigned k; @@ -327,7 +330,7 @@ static inline id parseQuotedString(pldata* pld) else { escaped = 0; - chars[++k] = c; + j--; k++; } } @@ -352,9 +355,13 @@ static inline id parseQuotedString(pldata* pld) { chars[k] = c; if (c == '\\') - escaped = 1; + { + escaped = 1; + } else - k++; + { + k++; + } } } obj = (*plAlloc)(plCls, @selector(allocWithZone:), NSDefaultMallocZone());