Skip to content

Commit

Permalink
android doesn't have mblen
Browse files Browse the repository at this point in the history
  • Loading branch information
keph authored and lynxlynxlynx committed Apr 22, 2015
1 parent e9e813c commit 207996d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gemrb/plugins/AREImporter/AREImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
#include "System/FileStream.h"
#include "System/SlicedStream.h"

#include <stdlib.h>
#ifdef ANDROID
// android lacks mblen
int wctomb(char *s, wchar_t wc) { return wcrtomb(s, wc, NULL); }
int mbtowc(wchar_t *pwc, const char *s, size_t n) { return mbrtowc(pwc, s, n, NULL); }
#endif

using namespace GemRB;

#define DEF_OPEN 0
Expand Down Expand Up @@ -2141,7 +2148,7 @@ int AREImporter::PutMapnotes( DataStream *stream, Map *map)
// limited to 500 *bytes* of text, convert to a multibyte encoding.
char* mbstring = MBCStringFromString(*mn.text);
// FIXME: depends on locale blah blah (see MBCStringFromString definition)
len = (std::min)(mblen(mbstring, mn.text->length()), 500);
len = (std::min)(mbtowc(0, mbstring, mn.text->length()), 500);
stream->Write( mbstring, len);
free(mbstring);
}
Expand Down

0 comments on commit 207996d

Please sign in to comment.