From aaad91784fdd7264b141965b7121b49ea6dc5ad3 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Fri, 8 Aug 2008 11:58:54 +0200 Subject: MLKArray: Improve portability. --- MLKArray.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'MLKArray.m') diff --git a/MLKArray.m b/MLKArray.m index db13c69..5890953 100644 --- a/MLKArray.m +++ b/MLKArray.m @@ -26,6 +26,7 @@ #include #include +#include @implementation MLKArray @@ -115,7 +116,8 @@ static int eq (const void *x, const void *y) -(NSUInteger) indexOfObjectIdenticalTo:(id)anObject inRange:(NSRange)range { // FIXME: How to treat [NSNull null]? - return ((id*)lfind (anObject, _buffer + range.location, &range.length, sizeof(id), eq) + size_t length = range.length; + return ((id*)lfind (anObject, _buffer + range.location, &length, sizeof(id), eq) - _buffer) / sizeof(id); } @@ -133,7 +135,8 @@ static int equalp (const void *x, const void *y) -(NSUInteger) indexOfObject:(id)anObject inRange:(NSRange)range { // FIXME: How to treat [NSNull null]? - return ((id*)lfind (anObject, _buffer + range.location, &range.length, sizeof(id), equalp) + size_t length = range.length; + return ((id*)lfind (anObject, _buffer + range.location, &length, sizeof(id), equalp) - _buffer) / sizeof(id); } -- cgit v1.2.3