mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fix problem with property list escape sequences.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17446 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
144e22edcc
commit
090b0a10f2
3 changed files with 23 additions and 59 deletions
|
@ -1,3 +1,10 @@
|
|||
2003-08-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* 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.
|
||||
* Tools/plist-0_9.dtd: document unicode escapes.
|
||||
|
||||
2003-08-02 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/NSProxy.m: Fix limit.h -> limits.h
|
||||
|
|
|
@ -5025,23 +5025,13 @@ nodeToObject(GSXMLNode* node)
|
|||
{
|
||||
if (++pos < len)
|
||||
{
|
||||
if (buf[pos] == '/')
|
||||
{
|
||||
len--;
|
||||
memcpy(&buf[pos], &buf[pos+1],
|
||||
(len - pos) * sizeof(unichar));
|
||||
}
|
||||
else if (buf[pos] == 'u' || buf[pos] == 'U')
|
||||
if ((buf[pos] == 'u' || buf[pos] == 'U')
|
||||
&& (len >= pos + 4))
|
||||
{
|
||||
unichar val = 0;
|
||||
unsigned i;
|
||||
BOOL ok = YES;
|
||||
|
||||
if (len < pos + 4)
|
||||
{
|
||||
[NSException raise:
|
||||
NSInternalInconsistencyException
|
||||
format: @"Short escape sequence"];
|
||||
}
|
||||
for (i = 1; i < 5; i++)
|
||||
{
|
||||
unichar c = buf[pos + i];
|
||||
|
@ -5060,61 +5050,22 @@ nodeToObject(GSXMLNode* node)
|
|||
}
|
||||
else
|
||||
{
|
||||
[NSException raise:
|
||||
NSInternalInconsistencyException
|
||||
format: @"bad hex escape sequence"];
|
||||
ok = NO;
|
||||
}
|
||||
}
|
||||
len -= 5;
|
||||
memcpy(&buf[pos], &buf[pos+5],
|
||||
(len - pos) * sizeof(unichar));
|
||||
buf[pos - 1] = val;
|
||||
}
|
||||
else if (buf[pos] >= '0' && buf[pos] <= '7')
|
||||
{
|
||||
unichar val = 0;
|
||||
unsigned i;
|
||||
|
||||
if (len < pos + 2)
|
||||
if (ok == YES)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Short escape sequence"];
|
||||
len -= 5;
|
||||
memcpy(&buf[pos], &buf[pos+5],
|
||||
(len - pos) * sizeof(unichar));
|
||||
buf[pos - 1] = val;
|
||||
}
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
unichar c = buf[pos + i];
|
||||
|
||||
if (c >= '0' && c <= '7')
|
||||
{
|
||||
val = (val << 3) + c - '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise:
|
||||
NSInternalInconsistencyException
|
||||
format: @"bad octal escape sequence"];
|
||||
}
|
||||
}
|
||||
len -= 3;
|
||||
memcpy(&buf[pos], &buf[pos+3],
|
||||
(len - pos) * sizeof(unichar));
|
||||
buf[pos - 1] = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Short escape sequence"];
|
||||
}
|
||||
while (pos < len && buf[pos] != '\\')
|
||||
{
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Short escape sequence"];
|
||||
}
|
||||
}
|
||||
content = [NSString stringWithCharacters: buf length: len];
|
||||
}
|
||||
|
|
|
@ -56,7 +56,13 @@
|
|||
<!-- A key ... treated just like a string -->
|
||||
<!ELEMENT key (#PCDATA)>
|
||||
|
||||
<!-- A string of characters. -->
|
||||
<!-- A string of characters.
|
||||
Not all unicodee characters are legal in PCDATA in XML,
|
||||
so an escape mechanism is provided. A string containing
|
||||
a sequence of the form \UXXXX or \uXXXX (where XXXX is a
|
||||
hexadecimal number) will be replaced by thew appropriate
|
||||
unicode character after the property list is parsed.
|
||||
-->
|
||||
<!ELEMENT string (#PCDATA)>
|
||||
|
||||
<!-- A real number [+/-]n.p[E[+/-]m] -->
|
||||
|
|
Loading…
Reference in a new issue