encoding fixup for xml with bad dictionary key

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29070 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-11-27 09:10:15 +00:00
parent b92879f11d
commit 449c94d4f6

View file

@ -2062,11 +2062,16 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
for (i = 0; i < numKeys; i++) for (i = 0; i < numKeys; i++)
{ {
keys[i] = [keyArray objectAtIndex: i]; keys[i] = [keyArray objectAtIndex: i];
plists[i] = [(NSDictionary*)obj objectForKey: keys[i]];
} }
} }
else else
{ {
[keyArray getObjects: keys]; [keyArray getObjects: keys];
for (i = 0; i < numKeys; i++)
{
plists[i] = (*myObj)(obj, objSel, keys[i]);
}
} }
if (x == NSPropertyListXMLFormat_v1_0) if (x == NSPropertyListXMLFormat_v1_0)
@ -2089,6 +2094,10 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
} }
} }
} }
else if (numKeys == 0)
{
canCompare = NO;
}
else else
{ {
/* All keys must respond to -compare: for sorting. /* All keys must respond to -compare: for sorting.
@ -2159,8 +2168,16 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
badComparison = YES; badComparison = YES;
} }
#endif #endif
/* Swap keys and values.
*/
keys[d + stride] = b; keys[d + stride] = b;
keys[d] = a; keys[d] = a;
a = plists[d + stride];
b = plists[d];
plists[d + stride] = b;
plists[d] = a;
if (stride > d) if (stride > d)
{ {
break; break;
@ -2189,21 +2206,6 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
#endif #endif
} }
if (isProxy == YES)
{
for (i = 0; i < numKeys; i++)
{
plists[i] = [(NSDictionary*)obj objectForKey: keys[i]];
}
}
else
{
for (i = 0; i < numKeys; i++)
{
plists[i] = (*myObj)(obj, objSel, keys[i]);
}
}
if (x == NSPropertyListXMLFormat_v1_0) if (x == NSPropertyListXMLFormat_v1_0)
{ {
[dest appendBytes: "<dict>\n" length: 7]; [dest appendBytes: "<dict>\n" length: 7];
@ -2211,7 +2213,7 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
{ {
[dest appendBytes: iSizeString length: strlen(iSizeString)]; [dest appendBytes: iSizeString length: strlen(iSizeString)];
[dest appendBytes: "<key>" length: 5]; [dest appendBytes: "<key>" length: 5];
XString([keys[i] description], dest); XString(keys[i], dest);
[dest appendBytes: "</key>\n" length: 7]; [dest appendBytes: "</key>\n" length: 7];
[dest appendBytes: iSizeString length: strlen(iSizeString)]; [dest appendBytes: iSizeString length: strlen(iSizeString)];
OAppend(plists[i], loc, level, step, x, dest); OAppend(plists[i], loc, level, step, x, dest);