summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <mulk@minimulk.mst-plus>2008-08-08 11:58:54 +0200
committerMatthias Benkard <mulk@minimulk.mst-plus>2008-08-08 11:58:54 +0200
commitaaad91784fdd7264b141965b7121b49ea6dc5ad3 (patch)
tree3582589fd7df43662f4dd1539dc0ad6aaa33399f
parentae62369312153b5e0f11eb8284a057f70b1647e7 (diff)
MLKArray: Improve portability.
-rw-r--r--MLKArray.m7
-rw-r--r--functions.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/MLKArray.m b/MLKArray.m
index db13c69..5890953 100644
--- a/MLKArray.m
+++ b/MLKArray.m
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <search.h>
+#include <string.h>
@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);
}
diff --git a/functions.h b/functions.h
index e635220..f322d7a 100644
--- a/functions.h
+++ b/functions.h
@@ -25,6 +25,8 @@
#include <ffi.h>
#elif HAVE_FFI_FFI_H
#include <ffi/ffi.h>
+#else
+#error "Couldn't include ffi.h."
#endif