1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-31 01:20:23 +00:00
OpenMW/libs/platform/string.h
cc9cii fcfc8fcccb Revert "Allow MinGW64 compilation in Windows/msys"
This reverts commit c3f350e3fb1b7936ad1d78bc79c04054d5489dac.

Conflicts:
	libs/platform/string.h
2014-02-22 23:45:13 +11:00

35 lines
781 B
C

// Wrapper for string.h on Mac and MinGW
#ifndef _STRING_WRAPPER_H
#define _STRING_WRAPPER_H
#ifdef __APPLE__
#include <Availability.h>
#endif
#include <string.h>
#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);
}
#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