From 714b8420a9021bef9e382cfaa43a3c7bb19831ef Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Mon, 20 May 2019 13:44:08 -0700 Subject: [PATCH] %s -> %ls for wchar_t I noticed my debug output for 24bit color mode was garbled due to this being wrong. I spent a little time trying to get the compiler to tell us about these, but -Wformat doesn't do anything for wchar printf functions, and __attribute__((format(printf, n, m))) will cause an error with wchar_t's, so I gave up and decided to manually check out every '%s' in the entire project. I found (only) one more. debug(0, "%s", wchars) will report warnings for incorrect specifiers but debug(0, L"%s", wchars) is unable. Thus there may be reason to prefer not using L"..." as an argument if all else is equal and it's not necessary. --- src/builtin_complete.cpp | 2 +- src/env_dispatch.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/builtin_complete.cpp b/src/builtin_complete.cpp index cf5b14df5..5b2fd4d8b 100644 --- a/src/builtin_complete.cpp +++ b/src/builtin_complete.cpp @@ -280,7 +280,7 @@ int builtin_complete(parser_t &parser, io_streams_t &streams, wchar_t **argv) { streams.err.append_format(L"%ls: Condition '%ls' contained a syntax error", cmd, condition); for (size_t i = 0; i < errors.size(); i++) { - streams.err.append_format(L"\n%s: ", cmd); + streams.err.append_format(L"\n%ls: ", cmd); streams.err.append(errors.at(i).describe(condition_string)); } return STATUS_CMD_ERROR; diff --git a/src/env_dispatch.cpp b/src/env_dispatch.cpp index cae845b6a..6f98b4121 100644 --- a/src/env_dispatch.cpp +++ b/src/env_dispatch.cpp @@ -376,7 +376,7 @@ static void update_fish_color_support(const environment_t &vars) { // Handle $fish_term24bit if (auto fish_term24bit = vars.get(L"fish_term24bit")) { support_term24bit = bool_from_string(fish_term24bit->as_string()); - debug(2, L"'fish_term24bit' preference: 24-bit color %s", + debug(2, L"'fish_term24bit' preference: 24-bit color %ls", support_term24bit ? L"enabled" : L"disabled"); } else { // We don't attempt to infer term24 bit support yet.