Union fix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4158 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 1999-04-28 18:46:51 +00:00
parent e24bbe7c8f
commit f987369adc
2 changed files with 11 additions and 3 deletions

View file

@ -1,3 +1,11 @@
1999-04-28 Adam Fedor <fedor@gnu.org>
* Source/include/FastArray.x (FastArrayInsertionPosition):
'Dereference' union object value (on PPC's at least, the union
address may not be the same as the address of the first type in
the union).
(FastArrayCheckSort): Likewise.
1999-04-27 Adam Fedor <fedor@gnu.org>
* configure.in: Check for sys/mount.h for NSFileManager functions

View file

@ -224,7 +224,7 @@ FastArrayInsertionPosition(FastArray array, FastArrayItem item, int (*sorter)())
*/
for (index = upper/2; upper != lower; index = lower+(upper-lower)/2)
{
int comparison = (*sorter)(item, array->ptr[index]);
int comparison = (*sorter)(item.obj, (array->ptr[index]).obj);
if (comparison < 0)
{
@ -243,7 +243,7 @@ FastArrayInsertionPosition(FastArray array, FastArrayItem item, int (*sorter)())
* Now skip past any equal items so the insertion point is AFTER any
* items that are equal to the new one.
*/
while (index < array->count && (*sorter)(item, array->ptr[index]) >= 0)
while (index < array->count && (*sorter)(item.obj, (array->ptr[index]).obj) >= 0)
{
index++;
}
@ -259,7 +259,7 @@ FastArrayCheckSort(FastArray array, int (*sorter)())
for (i = 1; i < array->count; i++)
{
NSCAssert(((*sorter)(array->ptr[i-1], array->ptr[i]) <= 0),
NSCAssert(((*sorter)((array->ptr[i-1]).obj, (array->ptr[i]).obj) <= 0),
NSInvalidArgumentException);
}
}