summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/unicode.cc
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.cc
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.cc')
-rw-r--r--crawl-ref/source/unicode.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/crawl-ref/source/unicode.cc b/crawl-ref/source/unicode.cc
index 461c41e4fc..30c27f3091 100644
--- a/crawl-ref/source/unicode.cc
+++ b/crawl-ref/source/unicode.cc
@@ -136,7 +136,7 @@ std::wstring utf8_to_16(const char *s)
}
#endif
-std::string utf16_to_8(const wchar_t *s)
+std::string utf16_to_8(const utf16_t *s)
{
std::string d;
ucs_t c;
@@ -295,7 +295,7 @@ FileLineInput::~FileLineInput()
std::string FileLineInput::get_line()
{
ASSERT(f);
- std::wstring win; // actually, these are more of a lose
+ std::vector<utf16_t> win;
std::string out;
char buf[512];
ucs_t c;
@@ -352,7 +352,8 @@ std::string FileLineInput::get_line()
win.push_back(c);
}
while (!seen_eof);
- return utf16_to_8(win.c_str());
+ win.push_back(0);
+ return utf16_to_8(&win[0]);
case BOM_UTF16BE:
do
@@ -369,7 +370,8 @@ std::string FileLineInput::get_line()
win.push_back(c);
}
while (!seen_eof);
- return utf16_to_8(win.c_str());
+ win.push_back(0);
+ return utf16_to_8(&win[0]);
case BOM_UTF32LE:
do