summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Zinnschlag <marc@zpages.de>2012-03-02 11:18:07 +0100
committerMarc Zinnschlag <marc@zpages.de>2012-03-02 11:18:07 +0100
commit8da0925e70bb4635751d359d4894a7901f9b8655 (patch)
tree4291d22c3e88899b6fb2b41c79b58b5c67eacd76
parenta86d2877fc946efea722f346e769d85b51728b27 (diff)
parentfa3fbf940c83fc789a98f916252ae6e024a9a989 (diff)
Merge remote branch 'corristo/master'openmw-0.12.0
-rw-r--r--libs/platform/string.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/libs/platform/string.h b/libs/platform/string.h
index 89ac141a89..0b67e50ea2 100644
--- a/libs/platform/string.h
+++ b/libs/platform/string.h
@@ -2,13 +2,33 @@
#ifndef _STRING_WRAPPER_H
#define _STRING_WRAPPER_H
+#ifdef __APPLE__
+#include <Availability.h>
+#endif
+
#include <string.h>
-#if (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) || defined(__MINGW32__)
+#if (defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1070) || defined(__MINGW32__)
// need our own implementation of strnlen
+#ifdef __MINGW32__
static size_t strnlen(const char *s, size_t n)
{
- const char *p = (const char *)memchr(s, 0, n);
- return(p ? p-s : n);
+ const char *p = (const char *)memchr(s, 0, n);
+ return(p ? p-s : n);
+}
+#elif (defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
+static size_t mw_strnlen(const char *s, size_t n)
+{
+ if (strnlen != NULL) {
+ return strnlen(s, n);
+ }
+ else {
+ const char *p = (const char *)memchr(s, 0, n);
+ return(p ? p-s : n);
+ }
}
+#define strnlen mw_strnlen
#endif
+
+#endif
+
#endif