Browse Source

Make plString build on mingw.

Darryl Pogue 13 years ago
parent
commit
bdf52410e1
  1. 17
      Sources/Plasma/CoreLib/plString.cpp
  2. 2
      Sources/Plasma/CoreLib/plString.h

17
Sources/Plasma/CoreLib/plString.cpp

@ -48,6 +48,23 @@ static inline size_t u16slen(const uint16_t *ustr, size_t max)
}
#endif
/* Provide strnlen and wcsnlen for MinGW which doesn't have them */
#ifdef __MINGW32__
size_t strnlen(const char *s, size_t maxlen)
{
size_t len;
for (len = 0; len < maxlen && *s; len++, s++) { }
return len;
}
size_t wcsnlen(const wchar_t *s, size_t maxlen)
{
size_t len;
for (len = 0; len < maxlen && *s; len++, s++) { }
return len;
}
#endif
#define BADCHAR_REPLACEMENT (0xFFFDul)
void plString::IConvertFromUtf8(const char *utf8, size_t size, bool steal)

2
Sources/Plasma/CoreLib/plString.h

@ -121,7 +121,7 @@ class plString
#pragma warning(push)
#pragma warning(disable : 4146)
enum {
kSizeAuto = (size_t)(-2147483648L)
kSizeAuto = (size_t)(-2147483648UL)
};
#pragma warning(pop)

Loading…
Cancel
Save