summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/unicode.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-08-12 21:21:00 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-08-12 21:42:33 +0200
commitafdc8f4ecd3d79a01ab213c1de1dbe33eedb725a (patch)
tree88300781af6da15bcf0db29c69a7e5bd738a54cf /crawl-ref/source/unicode.h
parentc2909728339259e5a946b36cf3b53c22d49ec9e6 (diff)
downloadcrawl-ref-afdc8f4ecd3d79a01ab213c1de1dbe33eedb725a.tar.gz
crawl-ref-afdc8f4ecd3d79a01ab213c1de1dbe33eedb725a.zip
Eradicate remaining uses of std::wstring on non-Windows.
They cause problems on Android, and were slightly wrong anyway (if a single line of an included config file is encoded in UTF-16 and has a monstrous length, we'd waste twice as much memory as needed to hold it. A world-shattering bug.).
Diffstat (limited to 'crawl-ref/source/unicode.h')
-rw-r--r--crawl-ref/source/unicode.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/crawl-ref/source/unicode.h b/crawl-ref/source/unicode.h
index f0d8c930c7..9cddcd1f41 100644
--- a/crawl-ref/source/unicode.h
+++ b/crawl-ref/source/unicode.h
@@ -6,9 +6,11 @@
#ifndef UNICODE_H
#define UNICODE_H
+
int wctoutf8(char *d, ucs_t s);
int utf8towc(ucs_t *d, const char *s);
#ifdef TARGET_OS_WINDOWS
+typedef wchar_t utf16_t;
std::wstring utf8_to_16(const char *s);
std::string utf16_to_8(const wchar_t *s);
@@ -20,6 +22,8 @@ static inline std::string utf16_to_8(const std::wstring &s)
{
return utf16_to_8(s.c_str());
}
+#else
+typedef uint16_t utf16_t;
#endif
std::string utf8_to_mb(const char *s);
std::string mb_to_utf8(const char *s);