mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 02:01:03 +00:00
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:
parent
f4e165a49e
commit
d790d9747f
8 changed files with 197 additions and 17 deletions
14
ChangeLog
14
ChangeLog
|
@ -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>
|
2008-07-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* configure.ac: use libffi in preference to ffcall as it doesn't mess
|
* configure.ac: use libffi in preference to ffcall as it doesn't mess
|
||||||
|
|
|
@ -102,7 +102,19 @@ GSDebugFunctionMsg(const char *func, const char *file, int line, NSString *fmt)
|
||||||
unsigned c = [array count];
|
unsigned c = [array count];
|
||||||
id objects[c];
|
id objects[c];
|
||||||
|
|
||||||
|
if ([array isProxy])
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < c; i++)
|
||||||
|
{
|
||||||
|
objects[i] = [array objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[array getObjects: objects];
|
[array getObjects: objects];
|
||||||
|
}
|
||||||
if (shouldCopy == YES)
|
if (shouldCopy == YES)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
|
@ -315,17 +315,33 @@ static SEL rlSel;
|
||||||
- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray
|
- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray
|
||||||
{
|
{
|
||||||
id na;
|
id na;
|
||||||
unsigned c, l;
|
unsigned c;
|
||||||
|
unsigned l;
|
||||||
|
unsigned e;
|
||||||
|
|
||||||
c = [self count];
|
c = [self count];
|
||||||
l = [anotherArray count];
|
l = [anotherArray count];
|
||||||
|
e = c + l;
|
||||||
|
|
||||||
{
|
{
|
||||||
GS_BEGINIDBUF(objects, c+l);
|
GS_BEGINIDBUF(objects, e);
|
||||||
|
|
||||||
[self getObjects: objects];
|
[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]];
|
[anotherArray getObjects: &objects[c]];
|
||||||
na = [NSArrayClass arrayWithObjects: objects count: c+l];
|
}
|
||||||
|
na = [NSArrayClass arrayWithObjects: objects count: e];
|
||||||
|
|
||||||
GS_ENDIDBUF();
|
GS_ENDIDBUF();
|
||||||
}
|
}
|
||||||
|
@ -582,7 +598,19 @@ static SEL rlSel;
|
||||||
unsigned c = [array count];
|
unsigned c = [array count];
|
||||||
GS_BEGINIDBUF(objects, c);
|
GS_BEGINIDBUF(objects, c);
|
||||||
|
|
||||||
|
if ([array isProxy])
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < c; i++)
|
||||||
|
{
|
||||||
|
objects[i] = [array objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[array getObjects: objects];
|
[array getObjects: objects];
|
||||||
|
}
|
||||||
if (shouldCopy == YES)
|
if (shouldCopy == YES)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
@ -617,7 +645,19 @@ static SEL rlSel;
|
||||||
unsigned c = [array count];
|
unsigned c = [array count];
|
||||||
GS_BEGINIDBUF(objects, c);
|
GS_BEGINIDBUF(objects, c);
|
||||||
|
|
||||||
|
if ([array isProxy])
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < c; i++)
|
||||||
|
{
|
||||||
|
objects[i] = [array objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[array getObjects: objects];
|
[array getObjects: objects];
|
||||||
|
}
|
||||||
self = [self initWithObjects: objects count: c];
|
self = [self initWithObjects: objects count: c];
|
||||||
GS_ENDIDBUF();
|
GS_ENDIDBUF();
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -437,8 +437,32 @@ static SEL appSel;
|
||||||
{
|
{
|
||||||
GS_BEGINIDBUF(o, objectCount*2);
|
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];
|
[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];
|
[keys getObjects: o + objectCount];
|
||||||
|
}
|
||||||
self = [self initWithObjects: o
|
self = [self initWithObjects: o
|
||||||
forKeys: o + objectCount
|
forKeys: o + objectCount
|
||||||
count: objectCount];
|
count: objectCount];
|
||||||
|
@ -899,7 +923,17 @@ compareIt(id o1, id o2, void* context)
|
||||||
id result;
|
id result;
|
||||||
GS_BEGINIDBUF(obuf, c);
|
GS_BEGINIDBUF(obuf, c);
|
||||||
|
|
||||||
|
if ([keys isProxy])
|
||||||
|
{
|
||||||
|
for (i = 0; i < c; i++)
|
||||||
|
{
|
||||||
|
obuf[i] = [keys objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[keys getObjects: obuf];
|
[keys getObjects: obuf];
|
||||||
|
}
|
||||||
for (i = 0; i < c; i++)
|
for (i = 0; i < c; i++)
|
||||||
{
|
{
|
||||||
id o = (*myObj)(self, objSel, obuf[i]);
|
id o = (*myObj)(self, objSel, obuf[i]);
|
||||||
|
@ -1245,7 +1279,19 @@ compareIt(id o1, id o2, void* context)
|
||||||
IMP remObj = [self methodForSelector: remSel];
|
IMP remObj = [self methodForSelector: remSel];
|
||||||
GS_BEGINIDBUF(keys, c);
|
GS_BEGINIDBUF(keys, c);
|
||||||
|
|
||||||
|
if ([keyArray isProxy])
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < c; i++)
|
||||||
|
{
|
||||||
|
keys[i] = [keyArray objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[keyArray getObjects: keys];
|
[keyArray getObjects: keys];
|
||||||
|
}
|
||||||
while (c--)
|
while (c--)
|
||||||
{
|
{
|
||||||
(*remObj)(self, remSel, keys[c]);
|
(*remObj)(self, remSel, keys[c]);
|
||||||
|
|
|
@ -360,7 +360,17 @@ static inline BOOL timerInvalidated(NSTimer *t)
|
||||||
delay: seconds];
|
delay: seconds];
|
||||||
[[loop _timedPerformers] addObject: item];
|
[[loop _timedPerformers] addObject: item];
|
||||||
RELEASE(item);
|
RELEASE(item);
|
||||||
|
if ([modes isProxy])
|
||||||
|
{
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
marray[i] = [modes objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[modes getObjects: marray];
|
[modes getObjects: marray];
|
||||||
|
}
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
[loop addTimer: item->timer forMode: marray[i]];
|
[loop addTimer: item->timer forMode: marray[i]];
|
||||||
|
@ -1405,7 +1415,19 @@ static inline BOOL timerInvalidated(NSTimer *t)
|
||||||
argument: argument
|
argument: argument
|
||||||
order: order];
|
order: order];
|
||||||
|
|
||||||
|
if ([modes isProxy])
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
array[i] = [modes objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[modes getObjects: array];
|
[modes getObjects: array];
|
||||||
|
}
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
NSString *mode = array[count];
|
NSString *mode = array[count];
|
||||||
|
|
|
@ -280,7 +280,17 @@ serializeToInfo(id object, _NSSerializerInfo* info)
|
||||||
id objects[count];
|
id objects[count];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
if ([object isProxy])
|
||||||
|
{
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
objects[i] = [object objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[object getObjects: objects];
|
[object getObjects: objects];
|
||||||
|
}
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
serializeToInfo(objects[i], info);
|
serializeToInfo(objects[i], info);
|
||||||
|
|
|
@ -381,7 +381,19 @@ static Class NSMutableSet_concrete_class;
|
||||||
{
|
{
|
||||||
GS_BEGINIDBUF(objs, count);
|
GS_BEGINIDBUF(objs, count);
|
||||||
|
|
||||||
|
if ([other isProxy])
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
objs[i] = [other objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[other getObjects: objs];
|
[other getObjects: objs];
|
||||||
|
}
|
||||||
self = [self initWithObjects: objs count: count];
|
self = [self initWithObjects: objs count: count];
|
||||||
GS_ENDIDBUF();
|
GS_ENDIDBUF();
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -312,7 +312,19 @@ SortRange(id *objects, NSRange range, id *descriptors,
|
||||||
GS_BEGINIDBUF(objects, count);
|
GS_BEGINIDBUF(objects, count);
|
||||||
|
|
||||||
[self getObjects: objects];
|
[self getObjects: objects];
|
||||||
|
if ([sortDescriptors isProxy])
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < numDescriptors; i++)
|
||||||
|
{
|
||||||
|
descriptors[i] = [sortDescriptors objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[sortDescriptors getObjects: descriptors];
|
[sortDescriptors getObjects: descriptors];
|
||||||
|
}
|
||||||
SortRange(objects, NSMakeRange(0, count), descriptors, numDescriptors);
|
SortRange(objects, NSMakeRange(0, count), descriptors, numDescriptors);
|
||||||
a = [[NSArray alloc] initWithObjects: objects count: count];
|
a = [[NSArray alloc] initWithObjects: objects count: count];
|
||||||
[self setArray: a];
|
[self setArray: a];
|
||||||
|
@ -333,7 +345,19 @@ SortRange(id *objects, NSRange range, id *descriptors,
|
||||||
{
|
{
|
||||||
GS_BEGINIDBUF(descriptors, dCount);
|
GS_BEGINIDBUF(descriptors, dCount);
|
||||||
|
|
||||||
|
if ([sortDescriptors isProxy])
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < dCount; i++)
|
||||||
|
{
|
||||||
|
descriptors[i] = [sortDescriptors objectAtIndex: i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
[sortDescriptors getObjects: descriptors];
|
[sortDescriptors getObjects: descriptors];
|
||||||
|
}
|
||||||
SortRange(_contents_array, NSMakeRange(0, _count), descriptors, dCount);
|
SortRange(_contents_array, NSMakeRange(0, _count), descriptors, dCount);
|
||||||
|
|
||||||
GS_ENDIDBUF();
|
GS_ENDIDBUF();
|
||||||
|
|
Loading…
Reference in a new issue