Skip to content

Commit

Permalink
Outputter_t: Handle C locale like everything else
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
faho committed Mar 7, 2019
1 parent 91e70e3 commit 2b0b3d3
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,6 @@ int outputter_t::writech(wint_t ch) {
void outputter_t::writestr(const wchar_t *str) {
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
if (len == (size_t)-1) {
debug(1, L"Tried to print invalid wide character string");
Expand Down

0 comments on commit 2b0b3d3

Please sign in to comment.