From bc8d16ad28afb7436bfde1fd0a21faf73d652230 Mon Sep 17 00:00:00 2001 From: Max Wipfli Date: Tue, 1 Jun 2021 21:18:08 +0200 Subject: 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. --- Userland/Services/WindowServer/Menu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Userland/Services/WindowServer/Menu.cpp') 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 #include #include #include @@ -20,7 +21,6 @@ #include #include #include -#include namespace WindowServer { @@ -631,14 +631,14 @@ void Menu::set_visible(bool visible) void Menu::add_item(NonnullOwnPtr 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* 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; -- cgit v1.2.3