summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer/Menu.cpp
diff options
context:
space:
mode:
authorMax Wipfli <mail@maxwipfli.ch>2021-06-01 21:18:08 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-03 13:31:46 +0200
commitbc8d16ad28afb7436bfde1fd0a21faf73d652230 (patch)
tree7209f27957cc40f9cc1ce27a54f4a670a69a4683 /Userland/Services/WindowServer/Menu.cpp
parent1c9d87c4558304cf2e955df7e4c49f9f60cd55f2 (diff)
downloadserenity-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/WindowServer/Menu.cpp')
-rw-r--r--Userland/Services/WindowServer/Menu.cpp6
1 files changed, 3 insertions, 3 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;