diff options
author | Max Wipfli <mail@maxwipfli.ch> | 2021-06-01 21:18:08 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-03 13:31:46 +0200 |
commit | bc8d16ad28afb7436bfde1fd0a21faf73d652230 (patch) | |
tree | 7209f27957cc40f9cc1ce27a54f4a670a69a4683 /Userland/Services | |
parent | 1c9d87c4558304cf2e955df7e4c49f9f60cd55f2 (diff) | |
download | serenity-bc8d16ad28afb7436bfde1fd0a21faf73d652230.zip |
Everywhere: Replace ctype.h to avoid narrowing conversions
This replaces ctype.h with CharacterType.h everywhere I could find
issues with narrowing conversions. While using it will probably make
sense almost everywhere in the future, the most critical places should
have been addressed.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/WindowServer/Menu.cpp | 6 | ||||
-rw-r--r-- | Userland/Services/WindowServer/Window.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 2af35fb794..f878ab1035 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -12,6 +12,7 @@ #include "Screen.h" #include "Window.h" #include "WindowManager.h" +#include <AK/CharacterTypes.h> #include <LibGfx/Bitmap.h> #include <LibGfx/CharacterBitmap.h> #include <LibGfx/Font.h> @@ -20,7 +21,6 @@ #include <LibGfx/Triangle.h> #include <WindowServer/ClientConnection.h> #include <WindowServer/WindowClientEndpoint.h> -#include <ctype.h> namespace WindowServer { @@ -631,14 +631,14 @@ void Menu::set_visible(bool visible) void Menu::add_item(NonnullOwnPtr<MenuItem> item) { if (auto alt_shortcut = find_ampersand_shortcut_character(item->text())) { - m_alt_shortcut_character_to_item_indices.ensure(tolower(alt_shortcut)).append(m_items.size()); + m_alt_shortcut_character_to_item_indices.ensure(to_ascii_lowercase(alt_shortcut)).append(m_items.size()); } m_items.append(move(item)); } const Vector<size_t>* Menu::items_with_alt_shortcut(u32 alt_shortcut) const { - auto it = m_alt_shortcut_character_to_item_indices.find(tolower(alt_shortcut)); + auto it = m_alt_shortcut_character_to_item_indices.find(to_ascii_lowercase(alt_shortcut)); if (it == m_alt_shortcut_character_to_item_indices.end()) return nullptr; return &it->value; diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index 8eba0a07e2..3f0bb32f26 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -13,8 +13,8 @@ #include "Screen.h" #include "WindowManager.h" #include <AK/Badge.h> +#include <AK/CharacterTypes.h> #include <WindowServer/WindowClientEndpoint.h> -#include <ctype.h> namespace WindowServer { @@ -461,7 +461,7 @@ void Window::handle_keydown_event(const KeyEvent& event) if (event.modifiers() == Mod_Alt && event.code_point() && menubar()) { Menu* menu_to_open = nullptr; menubar()->for_each_menu([&](Menu& menu) { - if (tolower(menu.alt_shortcut_character()) == tolower(event.code_point())) { + if (to_ascii_lowercase(menu.alt_shortcut_character()) == to_ascii_lowercase(event.code_point())) { menu_to_open = &menu; return IterationDecision::Break; } |