From 5283c204a960ff8639d06d64cbca5d02610482fd Mon Sep 17 00:00:00 2001 From: CaS Date: Thu, 7 Aug 2003 07:59:36 +0000 Subject: [PATCH] Tidied git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17447 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 1 + Source/GSCompatibility.m | 51 ++++------------------------------------ 2 files changed, 5 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 713823423..c3f82eae2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * Source/NSString.m: nodeToObject() fix error in handling escape sequences in strings ... only treat a backslash specially when it is immediately followed by 'U' or 'u' and four hexadecimal digits. + * Source/GSCompatibility.m: match changes to property list escapes * Tools/plist-0_9.dtd: document unicode escapes. 2003-08-02 Adam Fedor diff --git a/Source/GSCompatibility.m b/Source/GSCompatibility.m index 1010d15f2..70505dd64 100644 --- a/Source/GSCompatibility.m +++ b/Source/GSCompatibility.m @@ -290,27 +290,10 @@ XString(NSString* obj, GSMutableString *output) case '"': len += 6; break; - case '\\': - len += 1; - break; default: - if (c < 0x20) - { - if (c == 0x09 || c == 0x0A || c == 0x0D) - { - len++; - } - else - { - len += 4; - } - } - else if (c > 0xD7FF && c < 0xE000) - { - len += 6; - } - else if (c > 0xFFFD) + if ((c < 0x20 && (c != 0x09 && c != 0x0A && c != 0x0D)) + || (c > 0xD7FF && c < 0xE000) || c > 0xFFFD) { len += 6; } @@ -362,27 +345,10 @@ XString(NSString* obj, GSMutableString *output) map[wpos++] = 't'; map[wpos++] = ';'; break; - case '\\': - map[wpos++] = '\\'; - map[wpos++] = '\\'; - break; default: - if (c < 0x20) - { - if (c == 0x09 || c == 0x0A || c == 0x0D) - { - map[wpos++] = c; - } - else - { - map[wpos++] = '\\'; - map[wpos++] = '0' + ((c / 64) & 7); - map[wpos++] = '0' + ((c / 8) & 7); - map[wpos++] = '0' + (c & 7); - } - } - else if (c > 0xD7FF && c < 0xE000) + if ((c < 0x20 && (c != 0x09 && c != 0x0A && c != 0x0D)) + || (c > 0xD7FF && c < 0xE000) || c > 0xFFFD) { map[wpos++] = '\\'; map[wpos++] = 'U'; @@ -391,15 +357,6 @@ XString(NSString* obj, GSMutableString *output) map[wpos++] = hexdigits[(c>>4) & 0xf]; map[wpos++] = hexdigits[c & 0xf]; } - else if (c > 0xFFFD) - { - map[wpos++] = '\\'; - map[wpos++] = hexdigits[(c>>12) & 0xf]; - map[wpos++] = hexdigits[(c>>8) & 0xf]; - map[wpos++] = hexdigits[(c>>4) & 0xf]; - map[wpos++] = hexdigits[c & 0xf]; - map[wpos++] = '\\'; - } else { map[wpos++] = c;