Fixups for DO compatibility.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26747 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2008-07-06 09:18:30 +00:00
parent f4e165a49e
commit d790d9747f
8 changed files with 197 additions and 17 deletions

View file

@ -1,3 +1,17 @@
2008-07-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSRunLoop.m:
* Source/NSArray.m:
* Source/NSSortDescriptor.m:
* Source/Additions/GSCompatibility.m:
* Source/NSDictionary.m:
* Source/NSSerializer.m:
* Source/NSSet.m:
Wherever ([-getObjects:]) is called, check to see if the receiver is
a proxy, and if so we populate the buffer by calling ([-objectAtIndex:])
instead. This because a proxy via DO does not know how many itesm are
in the buffer and assumes it's only one.
2008-07-06 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: use libffi in preference to ffcall as it doesn't mess

View file

@ -102,7 +102,19 @@ GSDebugFunctionMsg(const char *func, const char *file, int line, NSString *fmt)
unsigned c = [array count];
id objects[c];
if ([array isProxy])
{
unsigned i;
for (i = 0; i < c; i++)
{
objects[i] = [array objectAtIndex: i];
}
}
else
{
[array getObjects: objects];
}
if (shouldCopy == YES)
{
unsigned i;

View file

@ -315,17 +315,33 @@ static SEL rlSel;
- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray
{
id na;
unsigned c, l;
unsigned c;
unsigned l;
unsigned e;
c = [self count];
l = [anotherArray count];
e = c + l;
{
GS_BEGINIDBUF(objects, c+l);
GS_BEGINIDBUF(objects, e);
[self getObjects: objects];
if ([anotherArray isProxy])
{
unsigned i = c;
unsigned j = 0;
while (i < e)
{
objects[i++] = [anotherArray objectAtIndex: j++];
}
}
else
{
[anotherArray getObjects: &objects[c]];
na = [NSArrayClass arrayWithObjects: objects count: c+l];
}
na = [NSArrayClass arrayWithObjects: objects count: e];
GS_ENDIDBUF();
}
@ -582,7 +598,19 @@ static SEL rlSel;
unsigned c = [array count];
GS_BEGINIDBUF(objects, c);
if ([array isProxy])
{
unsigned i;
for (i = 0; i < c; i++)
{
objects[i] = [array objectAtIndex: i];
}
}
else
{
[array getObjects: objects];
}
if (shouldCopy == YES)
{
unsigned i;
@ -617,7 +645,19 @@ static SEL rlSel;
unsigned c = [array count];
GS_BEGINIDBUF(objects, c);
if ([array isProxy])
{
unsigned i;
for (i = 0; i < c; i++)
{
objects[i] = [array objectAtIndex: i];
}
}
else
{
[array getObjects: objects];
}
self = [self initWithObjects: objects count: c];
GS_ENDIDBUF();
return self;

View file

@ -437,8 +437,32 @@ static SEL appSel;
{
GS_BEGINIDBUF(o, objectCount*2);
if ([objects isProxy])
{
unsigned i;
for (i = 0; i < objectCount; i++)
{
o[i] = [objects objectAtIndex: i];
}
}
else
{
[objects getObjects: o];
}
if ([keys isProxy])
{
unsigned i;
for (i = 0; i < objectCount; i++)
{
o[objectCount + i] = [keys objectAtIndex: i];
}
}
else
{
[keys getObjects: o + objectCount];
}
self = [self initWithObjects: o
forKeys: o + objectCount
count: objectCount];
@ -899,7 +923,17 @@ compareIt(id o1, id o2, void* context)
id result;
GS_BEGINIDBUF(obuf, c);
if ([keys isProxy])
{
for (i = 0; i < c; i++)
{
obuf[i] = [keys objectAtIndex: i];
}
}
else
{
[keys getObjects: obuf];
}
for (i = 0; i < c; i++)
{
id o = (*myObj)(self, objSel, obuf[i]);
@ -1245,7 +1279,19 @@ compareIt(id o1, id o2, void* context)
IMP remObj = [self methodForSelector: remSel];
GS_BEGINIDBUF(keys, c);
if ([keyArray isProxy])
{
unsigned i;
for (i = 0; i < c; i++)
{
keys[i] = [keyArray objectAtIndex: i];
}
}
else
{
[keyArray getObjects: keys];
}
while (c--)
{
(*remObj)(self, remSel, keys[c]);

View file

@ -360,7 +360,17 @@ static inline BOOL timerInvalidated(NSTimer *t)
delay: seconds];
[[loop _timedPerformers] addObject: item];
RELEASE(item);
if ([modes isProxy])
{
for (i = 0; i < count; i++)
{
marray[i] = [modes objectAtIndex: i];
}
}
else
{
[modes getObjects: marray];
}
for (i = 0; i < count; i++)
{
[loop addTimer: item->timer forMode: marray[i]];
@ -1405,7 +1415,19 @@ static inline BOOL timerInvalidated(NSTimer *t)
argument: argument
order: order];
if ([modes isProxy])
{
unsigned i;
for (i = 0; i < count; i++)
{
array[i] = [modes objectAtIndex: i];
}
}
else
{
[modes getObjects: array];
}
while (count-- > 0)
{
NSString *mode = array[count];

View file

@ -280,7 +280,17 @@ serializeToInfo(id object, _NSSerializerInfo* info)
id objects[count];
unsigned int i;
if ([object isProxy])
{
for (i = 0; i < count; i++)
{
objects[i] = [object objectAtIndex: i];
}
}
else
{
[object getObjects: objects];
}
for (i = 0; i < count; i++)
{
serializeToInfo(objects[i], info);

View file

@ -381,7 +381,19 @@ static Class NSMutableSet_concrete_class;
{
GS_BEGINIDBUF(objs, count);
if ([other isProxy])
{
unsigned i;
for (i = 0; i < count; i++)
{
objs[i] = [other objectAtIndex: i];
}
}
else
{
[other getObjects: objs];
}
self = [self initWithObjects: objs count: count];
GS_ENDIDBUF();
return self;

View file

@ -312,7 +312,19 @@ SortRange(id *objects, NSRange range, id *descriptors,
GS_BEGINIDBUF(objects, count);
[self getObjects: objects];
if ([sortDescriptors isProxy])
{
unsigned i;
for (i = 0; i < numDescriptors; i++)
{
descriptors[i] = [sortDescriptors objectAtIndex: i];
}
}
else
{
[sortDescriptors getObjects: descriptors];
}
SortRange(objects, NSMakeRange(0, count), descriptors, numDescriptors);
a = [[NSArray alloc] initWithObjects: objects count: count];
[self setArray: a];
@ -333,7 +345,19 @@ SortRange(id *objects, NSRange range, id *descriptors,
{
GS_BEGINIDBUF(descriptors, dCount);
if ([sortDescriptors isProxy])
{
unsigned i;
for (i = 0; i < dCount; i++)
{
descriptors[i] = [sortDescriptors objectAtIndex: i];
}
}
else
{
[sortDescriptors getObjects: descriptors];
}
SortRange(_contents_array, NSMakeRange(0, _count), descriptors, dCount);
GS_ENDIDBUF();