1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

Everywhere: Add sv suffix to strings relying on StringView(char const*)

Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
This commit is contained in:
sin-ack 2022-07-11 17:32:29 +00:00 committed by Andreas Kling
parent e5f09ea170
commit 3f3f45580a
762 changed files with 8315 additions and 8316 deletions

View file

@ -62,13 +62,13 @@ private:
Core::DirIterator iterator("/res/keymaps/", Core::DirIterator::Flags::SkipDots);
if (iterator.has_error()) {
GUI::MessageBox::show(nullptr, String::formatted("Error on reading mapping file list: {}", iterator.error_string()), "Keyboard settings", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(nullptr, String::formatted("Error on reading mapping file list: {}", iterator.error_string()), "Keyboard settings"sv, GUI::MessageBox::Type::Error);
GUI::Application::the()->quit(-1);
}
while (iterator.has_next()) {
auto name = iterator.next_path();
auto basename = name.replace(".json", "", ReplaceMode::FirstOnly);
auto basename = name.replace(".json"sv, ""sv, ReplaceMode::FirstOnly);
if (!selected_keymaps.find(basename).is_end())
continue;
m_character_map_files.append(basename);
@ -160,8 +160,8 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
auto json = JsonValue::from_string(proc_keymap->read_all()).release_value_but_fixme_should_propagate_errors();
auto const& keymap_object = json.as_object();
VERIFY(keymap_object.has("keymap"));
m_initial_active_keymap = keymap_object.get("keymap").to_string();
VERIFY(keymap_object.has("keymap"sv));
m_initial_active_keymap = keymap_object.get("keymap"sv).to_string();
dbgln("KeyboardSettings thinks the current keymap is: {}", m_initial_active_keymap);
auto mapper_config(Core::ConfigFile::open("/etc/Keyboard.ini").release_value_but_fixme_should_propagate_errors());
@ -247,7 +247,7 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
};
m_num_lock_checkbox = find_descendant_of_type_named<GUI::CheckBox>("num_lock_checkbox");
m_num_lock_checkbox->set_checked(Config::read_bool("KeyboardSettings", "StartupEnable", "NumLock", true));
m_num_lock_checkbox->set_checked(Config::read_bool("KeyboardSettings"sv, "StartupEnable"sv, "NumLock"sv, true));
m_num_lock_checkbox->on_checked = [&](auto) {
set_modified(true);
};
@ -277,11 +277,11 @@ void KeyboardSettingsWidget::apply_settings()
m_initial_keymap_list.append(keymap);
}
m_initial_active_keymap = m_keymaps_list_model.active_keymap();
Config::write_bool("KeyboardSettings", "StartupEnable", "NumLock", m_num_lock_checkbox->is_checked());
Config::write_bool("KeyboardSettings"sv, "StartupEnable"sv, "NumLock"sv, m_num_lock_checkbox->is_checked());
}
void KeyboardSettingsWidget::set_keymaps(Vector<String> const& keymaps, String const& active_keymap)
{
auto keymaps_string = String::join(',', keymaps);
GUI::Process::spawn_or_show_error(window(), "/bin/keymap", Array { "-s", keymaps_string.characters(), "-m", active_keymap.characters() });
GUI::Process::spawn_or_show_error(window(), "/bin/keymap"sv, Array { "-s", keymaps_string.characters(), "-m", active_keymap.characters() });
}