1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:58: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

@ -118,13 +118,13 @@ Field::Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_b
m_time_label.set_text(String::formatted("{}.{}", m_time_elapsed / 10, m_time_elapsed % 10));
};
m_timer->set_interval(100);
m_mine_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/mine.png").release_value_but_fixme_should_propagate_errors();
m_flag_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/flag.png").release_value_but_fixme_should_propagate_errors();
m_badflag_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/badflag.png").release_value_but_fixme_should_propagate_errors();
m_consider_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/consider.png").release_value_but_fixme_should_propagate_errors();
m_default_face_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-default.png").release_value_but_fixme_should_propagate_errors();
m_good_face_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-good.png").release_value_but_fixme_should_propagate_errors();
m_bad_face_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-bad.png").release_value_but_fixme_should_propagate_errors();
m_mine_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/mine.png"sv).release_value_but_fixme_should_propagate_errors();
m_flag_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/flag.png"sv).release_value_but_fixme_should_propagate_errors();
m_badflag_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/badflag.png"sv).release_value_but_fixme_should_propagate_errors();
m_consider_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/consider.png"sv).release_value_but_fixme_should_propagate_errors();
m_default_face_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-default.png"sv).release_value_but_fixme_should_propagate_errors();
m_good_face_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-good.png"sv).release_value_but_fixme_should_propagate_errors();
m_bad_face_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-bad.png"sv).release_value_but_fixme_should_propagate_errors();
for (int i = 0; i < 8; ++i)
m_number_bitmap[i] = Gfx::Bitmap::try_load_from_file(String::formatted("/res/icons/minesweeper/{}.png", i + 1)).release_value_but_fixme_should_propagate_errors();
// Square with mine will be filled with background color later, i.e. red
@ -137,11 +137,11 @@ Field::Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_b
set_face(Face::Default);
{
bool single_chording = Config::read_bool("Minesweeper", "Game", "SingleChording", false);
int mine_count = Config::read_i32("Minesweeper", "Game", "MineCount", 10);
int rows = Config::read_i32("Minesweeper", "Game", "Rows", 9);
int columns = Config::read_i32("Minesweeper", "Game", "Columns", 9);
auto difficulty_string = Config::read_string("Minesweeper", "Game", "Difficulty", "beginner");
bool single_chording = Config::read_bool("Minesweeper"sv, "Game"sv, "SingleChording"sv, false);
int mine_count = Config::read_i32("Minesweeper"sv, "Game"sv, "MineCount"sv, 10);
int rows = Config::read_i32("Minesweeper"sv, "Game"sv, "Rows"sv, 9);
int columns = Config::read_i32("Minesweeper"sv, "Game"sv, "Columns"sv, 9);
auto difficulty_string = Config::read_string("Minesweeper"sv, "Game"sv, "Difficulty"sv, "beginner"sv);
auto difficulty = difficulty_from_string(difficulty_string);
// Do a quick sanity check to make sure the user hasn't tried anything crazy
@ -507,10 +507,10 @@ void Field::set_field_size(Difficulty difficulty, size_t rows, size_t columns, s
if (m_rows == rows && m_columns == columns && m_mine_count == mine_count)
return;
{
Config::write_i32("Minesweeper", "Game", "MineCount", mine_count);
Config::write_i32("Minesweeper", "Game", "Rows", rows);
Config::write_i32("Minesweeper", "Game", "Columns", columns);
Config::write_string("Minesweeper", "Game", "Difficulty", difficulty_to_string(difficulty));
Config::write_i32("Minesweeper"sv, "Game"sv, "MineCount"sv, mine_count);
Config::write_i32("Minesweeper"sv, "Game"sv, "Rows"sv, rows);
Config::write_i32("Minesweeper"sv, "Game"sv, "Columns"sv, columns);
Config::write_string("Minesweeper"sv, "Game"sv, "Difficulty"sv, difficulty_to_string(difficulty));
}
m_difficulty = difficulty;
m_rows = rows;
@ -524,7 +524,7 @@ void Field::set_field_size(Difficulty difficulty, size_t rows, size_t columns, s
void Field::set_single_chording(bool enabled)
{
m_single_chording = enabled;
Config::write_bool("Minesweeper", "Game", "SingleChording", m_single_chording);
Config::write_bool("Minesweeper"sv, "Game"sv, "SingleChording"sv, m_single_chording);
}
template<typename Callback>