Browse Source

Merge pull request #157 from dpogue/plString-fix

Make plString build on mingw
Michael Hansen 13 years ago
parent
commit
827d58bb46
  1. 17
      Sources/Plasma/CoreLib/plString.cpp
  2. 5
      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 #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) #define BADCHAR_REPLACEMENT (0xFFFDul)
void plString::IConvertFromUtf8(const char *utf8, size_t size, bool steal) void plString::IConvertFromUtf8(const char *utf8, size_t size, bool steal)

5
Sources/Plasma/CoreLib/plString.h

@ -118,12 +118,9 @@ public:
class plString class plString
{ {
#pragma warning(push)
#pragma warning(disable : 4146)
enum { enum {
kSizeAuto = (size_t)(-2147483648L) kSizeAuto = (size_t)(0x80000000)
}; };
#pragma warning(pop)
public: public:
static const plString Null; static const plString Null;

Loading…
Cancel
Save