mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
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.
This commit is contained in:
parent
1c9d87c455
commit
bc8d16ad28
16 changed files with 153 additions and 266 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue