mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-04 07:21:14 -03:00
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:
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user