diff options
author | sfan5 <sfan5@live.de> | 2021-01-29 14:03:27 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-02-02 20:46:08 +0100 |
commit | c834d2ab25694ef2d67dc24f85f304269d202c8e (patch) | |
tree | c62a57d0cdbca950b9c7cb1a58666b6b77760bc2 /src/client | |
parent | 5e392cf34f8e062dd0533619921223656e32598a (diff) | |
download | minetest-c834d2ab25694ef2d67dc24f85f304269d202c8e.tar.gz minetest-c834d2ab25694ef2d67dc24f85f304269d202c8e.tar.bz2 minetest-c834d2ab25694ef2d67dc24f85f304269d202c8e.zip |
Drop wide/narrow conversion functions
The only valid usecase for these is interfacing with OS APIs
that want a locale/OS-specific multibyte encoding.
But they weren't used for that anywhere, instead UTF-8 is pretty
much assumed when it comes to that.
Since these are only a potential source of bugs and do not fulfil
their purpose at all, drop them entirely.
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/client.cpp | 4 | ||||
-rw-r--r-- | src/client/keycode.cpp | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp index 61888b913..ef4a3cdfc 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1196,7 +1196,7 @@ void Client::sendChatMessage(const std::wstring &message) if (canSendChatMessage()) { u32 now = time(NULL); float time_passed = now - m_last_chat_message_sent; - m_last_chat_message_sent = time(NULL); + m_last_chat_message_sent = now; m_chat_message_allowance += time_passed * (CLIENT_CHAT_MESSAGE_LIMIT_PER_10S / 8.0f); if (m_chat_message_allowance > CLIENT_CHAT_MESSAGE_LIMIT_PER_10S) @@ -1832,7 +1832,7 @@ void Client::makeScreenshot() sstr << "Failed to save screenshot '" << filename << "'"; } pushToChatQueue(new ChatMessage(CHATMESSAGE_TYPE_SYSTEM, - narrow_to_wide(sstr.str()))); + utf8_to_wide(sstr.str()))); infostream << sstr.str() << std::endl; image->drop(); } diff --git a/src/client/keycode.cpp b/src/client/keycode.cpp index 6a0e9f569..ce5214f54 100644 --- a/src/client/keycode.cpp +++ b/src/client/keycode.cpp @@ -316,7 +316,8 @@ KeyPress::KeyPress(const char *name) int chars_read = mbtowc(&Char, name, 1); FATAL_ERROR_IF(chars_read != 1, "Unexpected multibyte character"); m_name = ""; - warningstream << "KeyPress: Unknown key '" << name << "', falling back to first char."; + warningstream << "KeyPress: Unknown key '" << name + << "', falling back to first char." << std::endl; } KeyPress::KeyPress(const irr::SEvent::SKeyInput &in, bool prefer_character) |