Some DO fixes ... don;'t use the -getObjects: method with a proxy as it

can't pass back distant items into a local buffer.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18847 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2004-03-15 18:01:53 +00:00
parent 5978eda5cf
commit e8c28bc71a
4 changed files with 96 additions and 13 deletions

View file

@ -1,3 +1,12 @@
2004-03-15 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSCompatibility.m:
* Source/GSDictionary.m:
* Source/NSPropertyList.m: Check for proxies in a few places and
avoid pointer code which won't work for them. Also avoid caching
imps as a temporary workaround for a problem (not yet understood)
with ffi forwarding using a cached imp.
2004-03-12 Richard Frith-Macdonald <rfm@gnu.org> 2004-03-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSCategories.m: * Source/Additions/GSCategories.m:
@ -431,7 +440,7 @@ Sat Mar 6 13:54:28 2004 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSURLHandle.m: ([-availableResourceData]) remove condition * Source/NSURLHandle.m: ([-availableResourceData]) remove condition
that returns nil while resource is loading. Fix typo in method that returns nil while resource is loading. Fix typo in method
description. Return copy a of internal variable rather than the description. Return copy a of internal variable rather than the
actuyal mutable data object. actual mutable data object.
2004-01-12 Adam Fedor <fedor@gnu.org> 2004-01-12 Adam Fedor <fedor@gnu.org>

View file

@ -623,7 +623,17 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
NSString *plists[count]; NSString *plists[count];
unsigned i; unsigned i;
[obj getObjects: plists]; if ([obj isProxy] == YES)
{
for (i = 0; i < count; i++)
{
plists[i] = [obj objectAtIndex: i];
}
}
else
{
[obj getObjects: plists];
}
if (loc == nil) if (loc == nil)
{ {
@ -713,8 +723,6 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
} }
else else
{ {
SEL objSel = @selector(objectForKey:);
IMP myObj = [obj methodForSelector: objSel];
unsigned i; unsigned i;
NSArray *keyArray = [obj allKeys]; NSArray *keyArray = [obj allKeys];
unsigned numKeys = [keyArray count]; unsigned numKeys = [keyArray count];
@ -722,8 +730,19 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
NSString *keys[numKeys]; NSString *keys[numKeys];
BOOL canCompare = YES; BOOL canCompare = YES;
Class lastClass = 0; Class lastClass = 0;
BOOL isProxy = [obj isProxy];
[keyArray getObjects: keys]; if (isProxy == YES)
{
for (i = 0; i < numKeys; i++)
{
keys[i] = [keyArray objectAtIndex: i];
}
}
else
{
[keyArray getObjects: keys];
}
for (i = 0; i < numKeys; i++) for (i = 0; i < numKeys; i++)
{ {
@ -819,9 +838,22 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
#endif #endif
} }
for (i = 0; i < numKeys; i++) if (isProxy == YES)
{ {
plists[i] = (*myObj)(obj, objSel, keys[i]); for (i = 0; i < numKeys; i++)
{
plists[i] = [obj objectForKey: keys[i]];
}
}
else
{
SEL objSel = @selector(objectForKey:);
IMP myObj = [obj methodForSelector: objSel];
for (i = 0; i < numKeys; i++)
{
plists[i] = (*myObj)(obj, objSel, keys[i]);
}
} }
if (loc == nil) if (loc == nil)

View file

@ -215,14 +215,25 @@ static SEL objSel;
NSEnumerator *e = [other keyEnumerator]; NSEnumerator *e = [other keyEnumerator];
IMP nxtObj = [e methodForSelector: nxtSel]; IMP nxtObj = [e methodForSelector: nxtSel];
IMP otherObj = [other methodForSelector: objSel]; IMP otherObj = [other methodForSelector: objSel];
BOOL isProxy = [other isProxy];
unsigned i; unsigned i;
for (i = 0; i < c; i++) for (i = 0; i < c; i++)
{ {
GSIMapNode node; GSIMapNode node;
id k = (*nxtObj)(e, nxtSel); id k;
id o = (*otherObj)(other, objSel, k); id o;
if (isProxy == YES)
{
k = [e nextObject];
o = [other objectForKey: k];
}
else
{
k = (*nxtObj)(e, nxtSel);
o = (*otherObj)(other, objSel, k);
}
k = [k copyWithZone: z]; k = [k copyWithZone: z];
if (k == nil) if (k == nil)
{ {

View file

@ -1697,7 +1697,17 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
NSString *plists[count]; NSString *plists[count];
unsigned i; unsigned i;
[obj getObjects: plists]; if ([obj isProxy] == YES)
{
for (i = 0; i < count; i++)
{
plists[i] = [obj objectAtIndex: i];
}
}
else
{
[obj getObjects: plists];
}
if (loc == nil) if (loc == nil)
{ {
@ -1751,6 +1761,7 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
BOOL canCompare = YES; BOOL canCompare = YES;
Class lastClass = 0; Class lastClass = 0;
unsigned level = lev; unsigned level = lev;
BOOL isProxy = [obj isProxy];
if (level*step < sizeof(indentStrings)/sizeof(id)) if (level*step < sizeof(indentStrings)/sizeof(id))
{ {
@ -1772,7 +1783,17 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
= indentStrings[sizeof(indentStrings)/sizeof(id)-1]; = indentStrings[sizeof(indentStrings)/sizeof(id)-1];
} }
[keyArray getObjects: keys]; if (isProxy == YES)
{
for (i = 0; i < numKeys; i++)
{
keys[i] = [keyArray objectAtIndex: i];
}
}
else
{
[keyArray getObjects: keys];
}
for (i = 0; i < numKeys; i++) for (i = 0; i < numKeys; i++)
{ {
@ -1868,9 +1889,19 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
#endif #endif
} }
for (i = 0; i < numKeys; i++) if (isProxy == YES)
{ {
plists[i] = (*myObj)(obj, objSel, keys[i]); for (i = 0; i < numKeys; i++)
{
plists[i] = [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)