Outputter_t: Handle C locale like everything else

This tried to skip conversion if the locale had MB_CUR_MAX == 1, but
in doing so it just entered an infinite recursion (because
writestr(wchar_t*) called writestr(wchar_t*)).

Instead, just let wcstombs handle it.

Fixes #5724.
This commit is contained in:
Fabian Homborg 2019-03-07 10:00:39 +01:00
parent 91e70e38e7
commit 2b0b3d3193

View file

@ -395,12 +395,6 @@ int outputter_t::writech(wint_t ch) {
void outputter_t::writestr(const wchar_t *str) { void outputter_t::writestr(const wchar_t *str) {
assert(str && "Empty input string"); assert(str && "Empty input string");
if (MB_CUR_MAX == 1) {
// Single-byte locale (C/POSIX/ISO-8859).
this->writestr(str);
return;
}
size_t len = wcstombs(0, str, 0); // figure amount of space needed size_t len = wcstombs(0, str, 0); // figure amount of space needed
if (len == (size_t)-1) { if (len == (size_t)-1) {
debug(1, L"Tried to print invalid wide character string"); debug(1, L"Tried to print invalid wide character string");