diff --git a/ChangeLog b/ChangeLog index b33deceac..9f6526012 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-03-15 Richard Frith-Macdonald + + * 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 * Source/Additions/GSCategories.m: @@ -431,7 +440,7 @@ Sat Mar 6 13:54:28 2004 Nicola Pero * Source/NSURLHandle.m: ([-availableResourceData]) remove condition that returns nil while resource is loading. Fix typo in method description. Return copy a of internal variable rather than the - actuyal mutable data object. + actual mutable data object. 2004-01-12 Adam Fedor diff --git a/Source/GSCompatibility.m b/Source/GSCompatibility.m index 202cde7c2..c6ff3033e 100644 --- a/Source/GSCompatibility.m +++ b/Source/GSCompatibility.m @@ -623,7 +623,17 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step, NSString *plists[count]; 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) { @@ -713,8 +723,6 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step, } else { - SEL objSel = @selector(objectForKey:); - IMP myObj = [obj methodForSelector: objSel]; unsigned i; NSArray *keyArray = [obj allKeys]; unsigned numKeys = [keyArray count]; @@ -722,8 +730,19 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step, NSString *keys[numKeys]; BOOL canCompare = YES; 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++) { @@ -819,9 +838,22 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step, #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) diff --git a/Source/GSDictionary.m b/Source/GSDictionary.m index 40b477ccf..9d5a32227 100644 --- a/Source/GSDictionary.m +++ b/Source/GSDictionary.m @@ -215,14 +215,25 @@ static SEL objSel; NSEnumerator *e = [other keyEnumerator]; IMP nxtObj = [e methodForSelector: nxtSel]; IMP otherObj = [other methodForSelector: objSel]; + BOOL isProxy = [other isProxy]; unsigned i; for (i = 0; i < c; i++) { GSIMapNode node; - id k = (*nxtObj)(e, nxtSel); - id o = (*otherObj)(other, objSel, k); + id 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]; if (k == nil) { diff --git a/Source/NSPropertyList.m b/Source/NSPropertyList.m index 887aa021a..90bd651d4 100644 --- a/Source/NSPropertyList.m +++ b/Source/NSPropertyList.m @@ -1697,7 +1697,17 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step, NSString *plists[count]; 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) { @@ -1751,6 +1761,7 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step, BOOL canCompare = YES; Class lastClass = 0; unsigned level = lev; + BOOL isProxy = [obj isProxy]; 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]; } - [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++) { @@ -1868,9 +1889,19 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step, #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)