From 3af07e6c6e8bd09ddc05e1958f5fe0bc22047377 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 14 Dec 2020 23:02:54 +0100 Subject: [PATCH] math: Wcharify the error message Dunno, this seems to work, but then this is the sort of thing that *seems* to work. --- src/builtin_math.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/builtin_math.cpp b/src/builtin_math.cpp index 07c9b3e44..2d3bc7933 100644 --- a/src/builtin_math.cpp +++ b/src/builtin_math.cpp @@ -230,16 +230,16 @@ static int evaluate_expression(const wchar_t *cmd, const parser_t &parser, io_st // TODO: Really, this should be done in tinyexpr // (e.g. infinite is the result of "x / 0"), // but that's much more work. - const char *error_message = nullptr; + const wchar_t *error_message = nullptr; if (std::isinf(v)) { - error_message = "Result is infinite"; + error_message = L"Result is infinite"; } else if (std::isnan(v)) { - error_message = "Result is not a number"; + error_message = L"Result is not a number"; } else if (std::abs(v) >= kMaximumContiguousInteger) { - error_message = "Result magnitude is too large"; + error_message = L"Result magnitude is too large"; } if (error_message) { - streams.err.append_format(L"%ls: Error: %s\n", cmd, error_message); + streams.err.append_format(L"%ls: Error: %ls\n", cmd, error_message); streams.err.append_format(L"'%ls'\n", expression.c_str()); retval = STATUS_CMD_ERROR; } else {