1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:47:34 +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

@ -48,7 +48,7 @@ UnregisteredWidget::UnregisteredWidget(String const& class_name)
{
StringBuilder builder;
builder.append(class_name);
builder.append("\nnot registered");
builder.append("\nnot registered"sv);
m_text = builder.to_string();
}
@ -77,7 +77,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_positional_argument(path, "GML file to edit", "file", Core::ArgsParser::Required::No);
args_parser.parse(arguments);
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-gml-playground"));
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-gml-playground"sv));
auto window = TRY(GUI::Window::try_create());
window->set_title("GML Playground");
window->set_icon(app_icon.bitmap_for_size(16));
@ -98,14 +98,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto update_title = [&] {
StringBuilder builder;
if (file_path.is_empty())
builder.append("Untitled");
builder.append("Untitled"sv);
else
builder.append(file_path);
if (window->is_modified())
builder.append("[*]");
builder.append("[*]"sv);
builder.append(" - GML Playground");
builder.append(" - GML Playground"sv);
window->set_title(builder.to_string());
};
@ -128,17 +128,17 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// Now add some widgets!
}
)~~~");
)~~~"sv);
editor->set_cursor(4, 28); // after "...widgets!"
update_title();
} else {
auto file = Core::File::construct(path);
if (!file->open(Core::OpenMode::ReadOnly)) {
GUI::MessageBox::show(window, String::formatted("Opening \"{}\" failed: {}", path, strerror(errno)), "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window, String::formatted("Opening \"{}\" failed: {}", path, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
return 1;
}
if (file->is_device()) {
GUI::MessageBox::show(window, String::formatted("Opening \"{}\" failed: Can't open device files", path), "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window, String::formatted("Opening \"{}\" failed: Can't open device files", path), "Error"sv, GUI::MessageBox::Type::Error);
return 1;
}
file_path = path;
@ -154,7 +154,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return;
if (!editor->write_to_file(new_save_path.value())) {
GUI::MessageBox::show(window, "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window, "Unable to save file.\n"sv, "Error"sv, GUI::MessageBox::Type::Error);
return;
}
file_path = new_save_path.value();
@ -164,7 +164,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto save_action = GUI::CommonActions::make_save_action([&](auto&) {
if (!file_path.is_empty()) {
if (!editor->write_to_file(file_path)) {
GUI::MessageBox::show(window, "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window, "Unable to save file.\n"sv, "Error"sv, GUI::MessageBox::Type::Error);
return;
}
update_title();
@ -189,12 +189,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto file = Core::File::construct(open_path.value());
if (!file->open(Core::OpenMode::ReadOnly) && file->error() != ENOENT) {
GUI::MessageBox::show(window, String::formatted("Opening \"{}\" failed: {}", open_path.value(), strerror(errno)), "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window, String::formatted("Opening \"{}\" failed: {}", open_path.value(), strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
return;
}
if (file->is_device()) {
GUI::MessageBox::show(window, String::formatted("Opening \"{}\" failed: Can't open device files", open_path.value()), "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window, String::formatted("Opening \"{}\" failed: Can't open device files", open_path.value()), "Error"sv, GUI::MessageBox::Type::Error);
return;
}
file_path = open_path.value();
@ -232,7 +232,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
GUI::MessageBox::show(
window,
String::formatted("GML could not be formatted: {}", formatted_gml_or_error.error()),
"Error",
"Error"sv,
GUI::MessageBox::Type::Error);
}
})));

View file

@ -130,7 +130,7 @@ static ClassViewNode& add_child_node(NonnullOwnPtrVector<ClassViewNode>& childre
void ClassViewModel::add_declaration(CodeComprehension::Declaration const& decl)
{
ClassViewNode* parent = nullptr;
auto scope_parts = decl.scope.view().split_view("::");
auto scope_parts = decl.scope.view().split_view("::"sv);
if (!scope_parts.is_empty()) {
// Traverse declarations tree to the parent of 'decl'

View file

@ -24,19 +24,19 @@ namespace HackStudio {
void DebugInfoWidget::init_toolbar()
{
m_continue_action = GUI::Action::create("Continue", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-continue.png").release_value_but_fixme_should_propagate_errors(), [](auto&) {
m_continue_action = GUI::Action::create("Continue", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-continue.png"sv).release_value_but_fixme_should_propagate_errors(), [](auto&) {
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::Continue);
});
m_singlestep_action = GUI::Action::create("Step Over", { Mod_None, Key_F10 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-over.png").release_value_but_fixme_should_propagate_errors(), [](auto&) {
m_singlestep_action = GUI::Action::create("Step Over", { Mod_None, Key_F10 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-over.png"sv).release_value_but_fixme_should_propagate_errors(), [](auto&) {
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::SourceStepOver);
});
m_step_in_action = GUI::Action::create("Step In", { Mod_None, Key_F11 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-in.png").release_value_but_fixme_should_propagate_errors(), [](auto&) {
m_step_in_action = GUI::Action::create("Step In", { Mod_None, Key_F11 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-in.png"sv).release_value_but_fixme_should_propagate_errors(), [](auto&) {
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::SourceSingleStep);
});
m_step_out_action = GUI::Action::create("Step Out", { Mod_Shift, Key_F11 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-out.png").release_value_but_fixme_should_propagate_errors(), [](auto&) {
m_step_out_action = GUI::Action::create("Step Out", { Mod_Shift, Key_F11 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-out.png"sv).release_value_but_fixme_should_propagate_errors(), [](auto&) {
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::SourceStepOut);
});
@ -106,7 +106,7 @@ RefPtr<GUI::Menu> DebugInfoWidget::get_context_menu_for_variable(const GUI::Mode
if (does_variable_support_writing(variable)) {
context_menu->add_action(GUI::Action::create("Change value", [&](auto&) {
String value;
if (GUI::InputBox::show(window(), value, "Enter new value:", "Set variable value") == GUI::InputBox::ExecResult::OK) {
if (GUI::InputBox::show(window(), value, "Enter new value:"sv, "Set variable value"sv) == GUI::InputBox::ExecResult::OK) {
auto& model = static_cast<VariablesModel&>(*m_variables_view->model());
model.set_variable_value(index, value, window());
}

View file

@ -154,7 +154,7 @@ int Debugger::debugger_loop()
return Debug::DebugSession::DebugDecision::SingleStep;
// We currently do no support stepping through assembly source
if (source_position.value().file_path.ends_with(".S"))
if (source_position.value().file_path.ends_with(".S"sv))
return Debug::DebugSession::DebugDecision::SingleStep;
VERIFY(source_position.has_value());

View file

@ -34,7 +34,7 @@ DisassemblyModel::DisassemblyModel(Debug::DebugSession const& debug_session, Ptr
auto maybe_kernel_base = Symbolication::kernel_base();
if (maybe_kernel_base.has_value() && containing_function.value().address_low >= maybe_kernel_base.value()) {
auto file_or_error = Core::MappedFile::map("/boot/Kernel.debug");
auto file_or_error = Core::MappedFile::map("/boot/Kernel.debug"sv);
if (file_or_error.is_error())
return;
kernel_elf = make<ELF::Image>(file_or_error.value()->bytes());

View file

@ -144,7 +144,7 @@ void VariablesModel::set_variable_value(const GUI::ModelIndex& index, StringView
GUI::MessageBox::show(
parent_window,
String::formatted("String value \"{}\" could not be converted to a value of type {}.", string_value, variable->type_name),
"Set value failed",
"Set value failed"sv,
GUI::MessageBox::Type::Error);
}

View file

@ -33,7 +33,7 @@ private:
, m_regs(regs)
, m_inspector(inspector)
{
m_variable_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png").release_value_but_fixme_should_propagate_errors());
m_variable_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
}
NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo> m_variables;
PtraceRegisters m_regs;

View file

@ -177,20 +177,20 @@ void NewProjectDialog::do_create_project()
{
auto project_template = selected_template();
if (!project_template) {
GUI::MessageBox::show_error(this, "Could not create project: no template selected.");
GUI::MessageBox::show_error(this, "Could not create project: no template selected."sv);
return;
}
auto maybe_project_name = get_available_project_name();
auto maybe_project_full_path = get_project_full_path();
if (!maybe_project_name.has_value() || !maybe_project_full_path.has_value()) {
GUI::MessageBox::show_error(this, "Could not create project: invalid project name or path.");
GUI::MessageBox::show_error(this, "Could not create project: invalid project name or path."sv);
return;
}
auto create_in = m_create_in_input->text();
if (!Core::File::exists(create_in) || !Core::File::is_directory(create_in)) {
auto result = GUI::MessageBox::show(this, String::formatted("The directory {} does not exist yet, would you like to create it?", create_in), "New project", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
auto result = GUI::MessageBox::show(this, String::formatted("The directory {} does not exist yet, would you like to create it?", create_in), "New project"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
if (result != GUI::MessageBox::ExecResult::Yes)
return;

View file

@ -117,7 +117,7 @@ void ProjectTemplatesModel::rescan_templates()
while (di.has_next()) {
auto full_path = LexicalPath(di.next_full_path());
if (!full_path.has_extension(".ini"))
if (!full_path.has_extension(".ini"sv))
continue;
auto project_template = ProjectTemplate::load_from_manifest(full_path.string());

View file

@ -61,7 +61,7 @@ Editor::Editor()
if (success) {
set_execution_position(cursor().line());
} else {
GUI::MessageBox::show(window(), "Failed to set execution position", "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), "Failed to set execution position"sv, "Error"sv, GUI::MessageBox::Type::Error);
}
});
@ -161,13 +161,13 @@ void Editor::paint_event(GUI::PaintEvent& event)
if (line < first_visible_line || line > last_visible_line) {
continue;
}
char const* sign = (line_offset < deletions) ? "!" : "+";
auto sign = (line_offset < deletions) ? "!"sv : "+"sv;
painter.draw_text(gutter_icon_rect(line), sign, font(), Gfx::TextAlignment::Center);
}
if (additions < deletions) {
auto deletions_line = min(finish_line, line_count() - 1);
if (deletions_line <= last_visible_line) {
painter.draw_text(gutter_icon_rect(deletions_line), "-", font(), Gfx::TextAlignment::Center);
painter.draw_text(gutter_icon_rect(deletions_line), "-"sv, font(), Gfx::TextAlignment::Center);
}
}
}
@ -224,7 +224,7 @@ void Editor::show_documentation_tooltip_if_available(String const& hovered_token
// is probably to tweak Markdown::Document::render_to_html() so we can inject styles
// into the rendered HTML easily.
html.append(man_document->render_to_html());
html.append("<style>body { background-color: #dac7b5; }</style>");
html.append("<style>body { background-color: #dac7b5; }</style>"sv);
m_documentation_page_view->load_html(html.build(), {});
m_documentation_tooltip_window->move_to(screen_location.translated(4, 4));
@ -355,7 +355,7 @@ void Editor::drop_event(GUI::DropEvent& event)
return;
window()->move_to_front();
if (urls.size() > 1) {
GUI::MessageBox::show(window(), "HackStudio can only open one file at a time!", "One at a time please!", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), "HackStudio can only open one file at a time!"sv, "One at a time please!"sv, GUI::MessageBox::Type::Error);
return;
}
set_current_editor_wrapper(static_cast<EditorWrapper*>(parent()));
@ -433,13 +433,13 @@ void Editor::clear_execution_position()
Gfx::Bitmap const& Editor::breakpoint_icon_bitmap()
{
static auto bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/breakpoint.png").release_value_but_fixme_should_propagate_errors();
static auto bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/breakpoint.png"sv).release_value_but_fixme_should_propagate_errors();
return *bitmap;
}
Gfx::Bitmap const& Editor::current_position_icon_bitmap()
{
static auto bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors();
static auto bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors();
return *bitmap;
}
@ -685,17 +685,17 @@ void Editor::handle_function_parameters_hint_request()
StringBuilder html;
for (size_t i = 0; i < params.size(); ++i) {
if (i == argument_index)
html.append("<b>");
html.append("<b>"sv);
html.appendff("{}", params[i]);
if (i == argument_index)
html.append("</b>");
html.append("</b>"sv);
if (i < params.size() - 1)
html.append(", ");
html.append(", "sv);
}
html.append("<style>body { background-color: #dac7b5; }</style>");
html.append("<style>body { background-color: #dac7b5; }</style>"sv);
m_parameter_hint_page_view->load_html(html.build(), {});

View file

@ -59,7 +59,7 @@ void EditorWrapper::set_mode_non_displayable()
auto palette = editor().palette();
palette.set_color(Gfx::ColorRole::BaseText, Color::from_rgb(0xffffff));
editor().set_palette(palette);
editor().document().set_text("The contents of this file could not be displayed. Is it a binary file?");
editor().document().set_text("The contents of this file could not be displayed. Is it a binary file?"sv);
}
void EditorWrapper::set_filename(String const& filename)
@ -108,7 +108,7 @@ void EditorWrapper::update_title()
title.append(m_filename);
if (editor().document().is_modified())
title.append(" (*)");
title.append(" (*)"sv);
m_filename_title = title.to_string();
}

View file

@ -57,7 +57,7 @@ public:
FindWidget const& find_widget() const { return *m_find_widget; }
private:
static constexpr auto untitled_label = "(Untitled)";
static constexpr auto untitled_label = "(Untitled)"sv;
EditorWrapper();

View file

@ -32,7 +32,7 @@ GitWidget::GitWidget(String const& repo_root)
unstaged_header.set_layout<GUI::HorizontalBoxLayout>();
auto& refresh_button = unstaged_header.add<GUI::Button>();
refresh_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png").release_value_but_fixme_should_propagate_errors());
refresh_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv).release_value_but_fixme_should_propagate_errors());
refresh_button.set_fixed_size(16, 16);
refresh_button.set_tooltip("refresh");
refresh_button.on_click = [this](int) { refresh(); };
@ -43,7 +43,7 @@ GitWidget::GitWidget(String const& repo_root)
unstaged_header.set_fixed_height(20);
m_unstaged_files = unstaged.add<GitFilesView>(
[this](auto const& file) { stage_file(file); },
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png").release_value_but_fixme_should_propagate_errors());
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png"sv).release_value_but_fixme_should_propagate_errors());
m_unstaged_files->on_selection_change = [this] {
const auto& index = m_unstaged_files->selection().first();
if (!index.is_valid())
@ -60,7 +60,7 @@ GitWidget::GitWidget(String const& repo_root)
staged_header.set_layout<GUI::HorizontalBoxLayout>();
auto& commit_button = staged_header.add<GUI::Button>();
commit_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/commit.png").release_value_but_fixme_should_propagate_errors());
commit_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/commit.png"sv).release_value_but_fixme_should_propagate_errors());
commit_button.set_fixed_size(16, 16);
commit_button.set_tooltip("commit");
commit_button.on_click = [this](int) { commit(); };
@ -71,7 +71,7 @@ GitWidget::GitWidget(String const& repo_root)
staged_header.set_fixed_height(20);
m_staged_files = staged.add<GitFilesView>(
[this](auto const& file) { unstage_file(file); },
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/minus.png").release_value_but_fixme_should_propagate_errors());
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/minus.png"sv).release_value_but_fixme_should_propagate_errors());
}
bool GitWidget::initialize()
@ -82,10 +82,10 @@ bool GitWidget::initialize()
m_git_repo = result.repo;
return true;
case GitRepo::CreateResult::Type::GitProgramNotFound:
GUI::MessageBox::show(window(), "Please install the Git port", "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), "Please install the Git port"sv, "Error"sv, GUI::MessageBox::Type::Error);
return false;
case GitRepo::CreateResult::Type::NoGitRepo: {
auto decision = GUI::MessageBox::show(window(), "Create git repository?", "Git", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
auto decision = GUI::MessageBox::show(window(), "Create git repository?"sv, "Git"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
if (decision != GUI::Dialog::ExecResult::Yes)
return false;
m_git_repo = GitRepo::initialize_repository(m_repo_root);
@ -136,7 +136,7 @@ void GitWidget::unstage_file(String const& file)
void GitWidget::commit()
{
if (m_git_repo.is_null()) {
GUI::MessageBox::show(window(), "There is no git repository to commit to!", "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), "There is no git repository to commit to!"sv, "Error"sv, GUI::MessageBox::Type::Error);
return;
}

View file

@ -150,7 +150,7 @@ HackStudioWidget::HackStudioWidget(String path_to_project)
m_statusbar = add<GUI::Statusbar>(3);
m_statusbar->segment(1).set_mode(GUI::Statusbar::Segment::Mode::Auto);
m_statusbar->segment(2).set_mode(GUI::Statusbar::Segment::Mode::Fixed);
auto width = font().width("Ln 0000, Col 000") + font().max_glyph_width();
auto width = font().width("Ln 0000, Col 000"sv) + font().max_glyph_width();
m_statusbar->segment(2).set_fixed_width(width);
update_statusbar();
@ -184,7 +184,7 @@ HackStudioWidget::HackStudioWidget(String path_to_project)
}
m_project_builder = make<ProjectBuilder>(*m_terminal_wrapper, *m_project);
project().model().set_should_show_dotfiles(Config::read_bool("HackStudio", "Global", "ShowDotfiles", false));
project().model().set_should_show_dotfiles(Config::read_bool("HackStudio"sv, "Global"sv, "ShowDotfiles"sv, false));
}
void HackStudioWidget::update_actions()
@ -215,7 +215,7 @@ void HackStudioWidget::on_action_tab_change()
Vector<String> HackStudioWidget::read_recent_projects()
{
auto json = Config::read_string("HackStudio", "Global", "RecentProjects");
auto json = Config::read_string("HackStudio"sv, "Global"sv, "RecentProjects"sv);
AK::JsonParser parser(json);
auto value_or_error = parser.parse();
if (value_or_error.is_error())
@ -279,7 +279,7 @@ void HackStudioWidget::open_project(String const& root_path)
if (recent_projects.size() > recent_projects_history_size)
recent_projects.shrink(recent_projects_history_size);
Config::write_string("HackStudio", "Global", "RecentProjects", JsonArray(recent_projects).to_string());
Config::write_string("HackStudio"sv, "Global"sv, "RecentProjects"sv, JsonArray(recent_projects).to_string());
update_recent_projects_submenu();
}
@ -486,7 +486,7 @@ NonnullRefPtr<GUI::Menu> HackStudioWidget::create_project_tree_view_context_menu
for (auto& new_file_action : m_new_file_actions) {
new_file_submenu.add_action(new_file_action);
}
new_file_submenu.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors());
new_file_submenu.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors());
new_file_submenu.add_action(*m_new_plain_file_action);
new_file_submenu.add_separator();
new_file_submenu.add_action(*m_new_directory_action);
@ -507,7 +507,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_file_action(String const
{
return GUI::Action::create(label, Gfx::Bitmap::try_load_from_file(icon).release_value_but_fixme_should_propagate_errors(), [this, extension](const GUI::Action&) {
String filename;
if (GUI::InputBox::show(window(), filename, "Enter name of new file:", "Add new file to project") != GUI::InputBox::ExecResult::OK)
if (GUI::InputBox::show(window(), filename, "Enter name of new file:"sv, "Add new file to project"sv) != GUI::InputBox::ExecResult::OK)
return;
if (!extension.is_empty() && !filename.ends_with(String::formatted(".{}", extension))) {
@ -537,7 +537,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_file_action(String const
auto file = Core::File::construct(filepath);
if (!file->open((Core::OpenMode)(Core::OpenMode::WriteOnly | Core::OpenMode::MustBeNew))) {
GUI::MessageBox::show(window(), String::formatted("Failed to create '{}'", filepath), "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), String::formatted("Failed to create '{}'", filepath), "Error"sv, GUI::MessageBox::Type::Error);
return;
}
open_file(filepath);
@ -546,9 +546,9 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_file_action(String const
NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_directory_action()
{
return GUI::Action::create("&Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) {
return GUI::Action::create("&Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) {
String directory_name;
if (GUI::InputBox::show(window(), directory_name, "Enter name of new directory:", "Add new folder to project") != GUI::InputBox::ExecResult::OK)
if (GUI::InputBox::show(window(), directory_name, "Enter name of new directory:"sv, "Add new folder to project"sv) != GUI::InputBox::ExecResult::OK)
return;
auto path_to_selected = selected_file_paths();
@ -569,7 +569,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_directory_action()
auto formatted_dir_name = LexicalPath::canonicalized_path(String::formatted("{}/{}", m_project->model().root_path(), directory_name));
int rc = mkdir(formatted_dir_name.characters(), 0755);
if (rc < 0) {
GUI::MessageBox::show(window(), "Failed to create new directory", "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), "Failed to create new directory"sv, "Error"sv, GUI::MessageBox::Type::Error);
return;
}
});
@ -582,7 +582,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_open_selected_action()
for (auto& file : files)
open_file(file);
});
open_selected_action->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors());
open_selected_action->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
open_selected_action->set_enabled(true);
return open_selected_action;
}
@ -596,7 +596,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_open_selected_in_new_tab_act
open_file(file);
}
});
open_selected_in_new_tab_action->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors());
open_selected_in_new_tab_action->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
open_selected_in_new_tab_action->set_enabled(true);
return open_selected_in_new_tab_action;
}
@ -609,7 +609,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_show_in_file_manager_action(
Desktop::Launcher::open(URL::create_with_file_protocol(m_project->root_path(), file));
});
show_in_file_manager_action->set_enabled(true);
show_in_file_manager_action->set_icon(GUI::Icon::default_icon("app-file-manager").bitmap_for_size(16));
show_in_file_manager_action->set_icon(GUI::Icon::default_icon("app-file-manager"sv).bitmap_for_size(16));
return show_in_file_manager_action;
}
@ -623,7 +623,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_copy_relative_path_action()
GUI::Clipboard::the().set_plain_text(paths_string);
});
copy_relative_path_action->set_enabled(true);
copy_relative_path_action->set_icon(GUI::Icon::default_icon("hard-disk").bitmap_for_size(16));
copy_relative_path_action->set_icon(GUI::Icon::default_icon("hard-disk"sv).bitmap_for_size(16));
return copy_relative_path_action;
}
@ -640,7 +640,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_copy_full_path_action()
GUI::Clipboard::the().set_plain_text(paths_string);
});
copy_full_path_action->set_enabled(true);
copy_full_path_action->set_icon(GUI::Icon::default_icon("hard-disk").bitmap_for_size(16));
copy_full_path_action->set_icon(GUI::Icon::default_icon("hard-disk"sv).bitmap_for_size(16));
return copy_full_path_action;
}
@ -662,7 +662,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action()
auto result = GUI::MessageBox::show(window(),
message,
"Confirm deletion",
"Confirm deletion"sv,
GUI::MessageBox::Type::Warning,
GUI::MessageBox::InputType::OKCancel);
if (result == GUI::MessageBox::ExecResult::Cancel)
@ -673,7 +673,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action()
if (lstat(file.characters(), &st) < 0) {
GUI::MessageBox::show(window(),
String::formatted("lstat ({}) failed: {}", file, strerror(errno)),
"Removal failed",
"Removal failed"sv,
GUI::MessageBox::Type::Error);
break;
}
@ -684,12 +684,12 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action()
if (is_directory) {
GUI::MessageBox::show(window(),
String::formatted("Removing directory {} from the project failed: {}", error.file, static_cast<Error const&>(error)),
"Removal failed",
"Removal failed"sv,
GUI::MessageBox::Type::Error);
} else {
GUI::MessageBox::show(window(),
String::formatted("Removing file {} from the project failed: {}", error.file, static_cast<Error const&>(error)),
"Removal failed",
"Removal failed"sv,
GUI::MessageBox::Type::Error);
}
}
@ -702,7 +702,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action()
NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_project_action()
{
return GUI::Action::create("&Project...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/hackstudio-project.png").release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) {
return GUI::Action::create("&Project...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/hackstudio-project.png"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) {
auto dialog = NewProjectDialog::construct(window());
dialog->set_icon(window()->icon());
auto result = dialog->exec();
@ -848,7 +848,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_switch_to_previous_editor_ac
NonnullRefPtr<GUI::Action> HackStudioWidget::create_remove_current_editor_action()
{
return GUI::Action::create("&Remove Current Editor", { Mod_Alt | Mod_Shift, Key_E }, Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/remove-editor.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
return GUI::Action::create("&Remove Current Editor", { Mod_Alt | Mod_Shift, Key_E }, Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/remove-editor.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
if (m_all_editor_wrappers.size() <= 1)
return;
auto tab_widget = m_current_editor_tab_widget;
@ -861,7 +861,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_remove_current_editor_action
NonnullRefPtr<GUI::Action> HackStudioWidget::create_open_action()
{
return GUI::Action::create("&Open Project...", { Mod_Ctrl | Mod_Shift, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
return GUI::Action::create("&Open Project...", { Mod_Ctrl | Mod_Shift, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
auto open_path = GUI::FilePicker::get_open_filepath(window(), "Open project", m_project->root_path(), true);
if (!open_path.has_value())
return;
@ -892,8 +892,8 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action()
LexicalPath const old_path(old_filename);
Optional<String> save_path = GUI::FilePicker::get_save_filepath(window(),
old_filename.is_null() ? "Untitled" : old_path.title(),
old_filename.is_null() ? "txt" : old_path.extension(),
old_filename.is_null() ? "Untitled"sv : old_path.title(),
old_filename.is_null() ? "txt"sv : old_path.extension(),
Core::File::absolute_path(old_path.dirname()));
if (!save_path.has_value()) {
return;
@ -927,7 +927,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action()
NonnullRefPtr<GUI::Action> HackStudioWidget::create_remove_current_terminal_action()
{
return GUI::Action::create("Remove &Current Terminal", { Mod_Alt | Mod_Shift, Key_T }, Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/remove-terminal.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
return GUI::Action::create("Remove &Current Terminal", { Mod_Alt | Mod_Shift, Key_T }, Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/remove-terminal.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
auto widget = m_action_tab_widget->active_widget();
if (!widget)
return;
@ -953,7 +953,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_editor_tab_widget_action
NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_editor_action()
{
return GUI::Action::create("Add New &Editor", { Mod_Ctrl | Mod_Alt, Key_E },
Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/add-editor.png").release_value_but_fixme_should_propagate_errors(),
Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/add-editor.png"sv).release_value_but_fixme_should_propagate_errors(),
[this](auto&) {
add_new_editor(*m_current_editor_tab_widget);
update_actions();
@ -963,7 +963,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_editor_action()
NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_terminal_action()
{
return GUI::Action::create("Add New &Terminal", { Mod_Ctrl | Mod_Alt, Key_T },
Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/add-terminal.png").release_value_but_fixme_should_propagate_errors(),
Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/add-terminal.png"sv).release_value_but_fixme_should_propagate_errors(),
[this](auto&) {
auto& terminal_wrapper = m_action_tab_widget->add_tab<TerminalWrapper>("Terminal");
terminal_wrapper.on_command_exit = [&]() {
@ -986,13 +986,13 @@ void HackStudioWidget::reveal_action_tab(GUI::Widget& widget)
NonnullRefPtr<GUI::Action> HackStudioWidget::create_debug_action()
{
return GUI::Action::create("&Debug", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-run.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
return GUI::Action::create("&Debug", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-run.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
if (!Core::File::exists(get_project_executable_path())) {
GUI::MessageBox::show(window(), String::formatted("Could not find file: {}. (did you build the project?)", get_project_executable_path()), "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), String::formatted("Could not find file: {}. (did you build the project?)", get_project_executable_path()), "Error"sv, GUI::MessageBox::Type::Error);
return;
}
if (Debugger::the().session()) {
GUI::MessageBox::show(window(), "Debugger is already running", "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), "Debugger is already running"sv, "Error"sv, GUI::MessageBox::Type::Error);
return;
}
@ -1073,7 +1073,7 @@ void HackStudioWidget::initialize_debugger()
}
HackStudioWidget::hide_action_tabs();
GUI::MessageBox::show(window(), "Program Exited", "Debugger", GUI::MessageBox::Type::Information);
GUI::MessageBox::show(window(), "Program Exited"sv, "Debugger"sv, GUI::MessageBox::Type::Information);
});
Core::EventLoop::wake_current();
});
@ -1096,7 +1096,7 @@ String HackStudioWidget::get_absolute_path(String const& path) const
{
// TODO: We can probably do a more specific condition here, something like
// "if (file.starts_with("../Libraries/") || file.starts_with("../AK/"))"
if (path.starts_with("..")) {
if (path.starts_with(".."sv)) {
return get_full_path_of_serenity_source(path);
}
return m_project->to_absolute_path(path);
@ -1106,7 +1106,7 @@ RefPtr<EditorWrapper> HackStudioWidget::get_editor_of_file(String const& filenam
{
String file_path = filename;
if (filename.starts_with("../")) {
if (filename.starts_with("../"sv)) {
file_path = get_full_path_of_serenity_source(filename);
}
@ -1127,7 +1127,7 @@ void HackStudioWidget::build()
{
auto result = m_project_builder->build(active_file());
if (result.is_error()) {
GUI::MessageBox::show(window(), String::formatted("{}", result.error()), "Build failed", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), String::formatted("{}", result.error()), "Build failed"sv, GUI::MessageBox::Type::Error);
m_build_action->set_enabled(true);
m_stop_action->set_enabled(false);
} else {
@ -1139,7 +1139,7 @@ void HackStudioWidget::run()
{
auto result = m_project_builder->run(active_file());
if (result.is_error()) {
GUI::MessageBox::show(window(), String::formatted("{}", result.error()), "Run failed", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), String::formatted("{}", result.error()), "Run failed"sv, GUI::MessageBox::Type::Error);
m_run_action->set_enabled(true);
m_stop_action->set_enabled(false);
} else {
@ -1279,7 +1279,7 @@ void HackStudioWidget::create_toolbar(GUI::Widget& parent)
NonnullRefPtr<GUI::Action> HackStudioWidget::create_build_action()
{
return GUI::Action::create("&Build", { Mod_Ctrl, Key_B }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/build.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
return GUI::Action::create("&Build", { Mod_Ctrl, Key_B }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/build.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
if (warn_unsaved_changes("There are unsaved changes, do you want to save before building?") == ContinueDecision::No)
return;
@ -1290,7 +1290,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_build_action()
NonnullRefPtr<GUI::Action> HackStudioWidget::create_run_action()
{
return GUI::Action::create("&Run", { Mod_Ctrl, Key_R }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/program-run.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
return GUI::Action::create("&Run", { Mod_Ctrl, Key_R }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/program-run.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
reveal_action_tab(*m_terminal_wrapper);
run();
});
@ -1388,14 +1388,14 @@ void HackStudioWidget::create_file_menu(GUI::Window& window)
for (auto& new_file_action : m_new_file_actions) {
new_submenu.add_action(new_file_action);
}
new_submenu.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors());
new_submenu.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors());
new_submenu.add_action(*m_new_plain_file_action);
new_submenu.add_separator();
new_submenu.add_action(*m_new_directory_action);
file_menu.add_action(*m_open_action);
m_recent_projects_submenu = &file_menu.add_submenu("Open &Recent");
m_recent_projects_submenu->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-recent.png").release_value_but_fixme_should_propagate_errors());
m_recent_projects_submenu->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-recent.png"sv).release_value_but_fixme_should_propagate_errors());
update_recent_projects_submenu();
file_menu.add_action(*m_save_action);
file_menu.add_action(*m_save_as_action);
@ -1408,7 +1408,7 @@ void HackStudioWidget::create_file_menu(GUI::Window& window)
void HackStudioWidget::create_edit_menu(GUI::Window& window)
{
auto& edit_menu = window.add_menu("&Edit");
edit_menu.add_action(GUI::Action::create("&Find in Files...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
edit_menu.add_action(GUI::Action::create("&Find in Files...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
reveal_action_tab(*m_find_in_files_widget);
m_find_in_files_widget->focus_textbox_and_select_all();
}));
@ -1452,9 +1452,9 @@ void HackStudioWidget::create_view_menu(GUI::Window& window)
});
auto show_dotfiles_action = GUI::Action::create_checkable("S&how Dotfiles", { Mod_Ctrl, Key_H }, [&](auto& checked) {
project().model().set_should_show_dotfiles(checked.is_checked());
Config::write_bool("HackStudio", "Global", "ShowDotfiles", checked.is_checked());
Config::write_bool("HackStudio"sv, "Global"sv, "ShowDotfiles"sv, checked.is_checked());
});
show_dotfiles_action->set_checked(Config::read_bool("HackStudio", "Global", "ShowDotfiles", false));
show_dotfiles_action->set_checked(Config::read_bool("HackStudio"sv, "Global"sv, "ShowDotfiles"sv, false));
auto& view_menu = window.add_menu("&View");
view_menu.add_action(hide_action_tabs_action);
@ -1489,7 +1489,7 @@ void HackStudioWidget::create_view_menu(GUI::Window& window)
m_no_wrapping_action->set_checked(true);
m_editor_font_action = GUI::Action::create("Editor &Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png").release_value_but_fixme_should_propagate_errors(),
m_editor_font_action = GUI::Action::create("Editor &Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors(),
[&](auto&) {
auto picker = GUI::FontPicker::construct(&window, m_editor_font, false);
if (picker->exec() == GUI::Dialog::ExecResult::OK) {
@ -1520,12 +1520,12 @@ void HackStudioWidget::create_view_menu(GUI::Window& window)
void HackStudioWidget::create_help_menu(GUI::Window& window)
{
auto& help_menu = window.add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_about_action("Hack Studio", GUI::Icon::default_icon("app-hack-studio"), &window));
help_menu.add_action(GUI::CommonActions::make_about_action("Hack Studio", GUI::Icon::default_icon("app-hack-studio"sv), &window));
}
NonnullRefPtr<GUI::Action> HackStudioWidget::create_stop_action()
{
auto action = GUI::Action::create("&Stop", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/program-stop.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
auto action = GUI::Action::create("&Stop", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/program-stop.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
if (!Debugger::the().session()) {
if (auto result = m_terminal_wrapper->kill_running_command(); result.is_error())
warnln("{}", result.error());
@ -1605,7 +1605,7 @@ HackStudioWidget::ContinueDecision HackStudioWidget::warn_unsaved_changes(String
if (!any_document_is_dirty())
return ContinueDecision::Yes;
auto result = GUI::MessageBox::show(window(), prompt, "Unsaved changes", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
auto result = GUI::MessageBox::show(window(), prompt, "Unsaved changes"sv, GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
if (result == GUI::MessageBox::ExecResult::Cancel)
return ContinueDecision::No;
@ -1630,7 +1630,7 @@ bool HackStudioWidget::any_document_is_dirty() const
void HackStudioWidget::update_gml_preview()
{
auto gml_content = current_editor_wrapper().filename().ends_with(".gml") ? current_editor_wrapper().editor().text() : "";
auto gml_content = current_editor_wrapper().filename().ends_with(".gml"sv) ? current_editor_wrapper().editor().text().view() : ""sv;
m_gml_preview_widget->load_gml(gml_content);
}
@ -1685,7 +1685,7 @@ void HackStudioWidget::on_cursor_change()
void HackStudioWidget::create_location_history_actions()
{
m_locations_history_back_action = GUI::Action::create("Go Back", { Mod_Alt | Mod_Shift, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
m_locations_history_back_action = GUI::Action::create("Go Back", { Mod_Alt | Mod_Shift, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
if (m_locations_history_end_index <= 1)
return;
@ -1699,7 +1699,7 @@ void HackStudioWidget::create_location_history_actions()
update_history_actions();
});
m_locations_history_forward_action = GUI::Action::create("Go Forward", { Mod_Alt | Mod_Shift, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
m_locations_history_forward_action = GUI::Action::create("Go Forward", { Mod_Alt | Mod_Shift, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
if (m_locations_history_end_index == m_locations_history.size())
return;
@ -1717,7 +1717,7 @@ void HackStudioWidget::create_location_history_actions()
NonnullRefPtr<GUI::Action> HackStudioWidget::create_open_project_configuration_action()
{
return GUI::Action::create("Project Configuration", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png").release_value(), [&](auto&) {
return GUI::Action::create("Project Configuration", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv).release_value(), [&](auto&) {
auto parent_directory = LexicalPath::dirname(Project::config_file_path);
auto absolute_config_file_path = LexicalPath::absolute_path(m_project->root_path(), Project::config_file_path);
@ -1734,7 +1734,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_open_project_configuration_a
"{\n"
" \"build_command\": \"your build command here\",\n"
" \"run_command\": \"your run command here\"\n"
"}\n");
"}\n"sv);
file.value()->close();
}
@ -1762,9 +1762,9 @@ void HackStudioWidget::update_history_actions()
RefPtr<Gfx::Font> HackStudioWidget::read_editor_font_from_config()
{
auto font_family = Config::read_string("HackStudio", "EditorFont", "Family", "Csilla");
auto font_variant = Config::read_string("HackStudio", "EditorFont", "Variant", "Regular");
auto font_size = Config::read_i32("HackStudio", "EditorFont", "Size", 10);
auto font_family = Config::read_string("HackStudio"sv, "EditorFont"sv, "Family"sv, "Csilla"sv);
auto font_variant = Config::read_string("HackStudio"sv, "EditorFont"sv, "Variant"sv, "Regular"sv);
auto font_size = Config::read_i32("HackStudio"sv, "EditorFont"sv, "Size"sv, 10);
auto font = Gfx::FontDatabase::the().get(font_family, font_variant, font_size);
if (font.is_null())
@ -1780,9 +1780,9 @@ void HackStudioWidget::change_editor_font(RefPtr<Gfx::Font> font)
editor_wrapper.editor().set_font(*m_editor_font);
}
Config::write_string("HackStudio", "EditorFont", "Family", m_editor_font->family());
Config::write_string("HackStudio", "EditorFont", "Variant", m_editor_font->variant());
Config::write_i32("HackStudio", "EditorFont", "Size", m_editor_font->presentation_size());
Config::write_string("HackStudio"sv, "EditorFont"sv, "Family"sv, m_editor_font->family());
Config::write_string("HackStudio"sv, "EditorFont"sv, "Variant"sv, m_editor_font->variant());
Config::write_i32("HackStudio"sv, "EditorFont"sv, "Size"sv, m_editor_font->presentation_size());
}
void HackStudioWidget::open_coredump(String const& coredump_path)
@ -1810,7 +1810,7 @@ void HackStudioWidget::for_each_open_file(Function<void(ProjectFile const&)> fun
NonnullRefPtr<GUI::Action> HackStudioWidget::create_toggle_syntax_highlighting_mode_action()
{
auto action = GUI::Action::create_checkable("&Semantic Highlighting", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-cplusplus.png").release_value_but_fixme_should_propagate_errors(), [this](auto& action) {
auto action = GUI::Action::create_checkable("&Semantic Highlighting", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-cplusplus.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto& action) {
for (auto& editor_wrapper : m_all_editor_wrappers)
editor_wrapper.editor().set_semantic_syntax_highlighting(action.is_checked());
});

View file

@ -209,7 +209,7 @@ void ConnectionToServerWrapper::on_crash()
void ConnectionToServerWrapper::show_frequent_crashes_notification() const
{
auto notification = GUI::Notification::construct();
notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png").release_value_but_fixme_should_propagate_errors());
notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors());
notification->set_title("LanguageServer Crashes too much!");
notification->set_text("LanguageServer aided features will not be available in this session");
notification->show();
@ -217,7 +217,7 @@ void ConnectionToServerWrapper::show_frequent_crashes_notification() const
void ConnectionToServerWrapper::show_crash_notification() const
{
auto notification = GUI::Notification::construct();
notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png").release_value_but_fixme_should_propagate_errors());
notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors());
notification->set_title("Oops!");
notification->set_text(String::formatted("LanguageServer has crashed"));
notification->show();

View file

@ -63,7 +63,7 @@ bool Project::project_is_serenity() const
{
// FIXME: Improve this heuristic
// Running "Meta/serenity.sh copy-src" installs the serenity repository at this path in the home directory
return m_root_path.ends_with("Source/serenity");
return m_root_path.ends_with("Source/serenity"sv);
}
NonnullOwnPtr<ProjectConfig> Project::config() const

View file

@ -33,7 +33,7 @@ public:
String to_absolute_path(String const&) const;
bool project_is_serenity() const;
static constexpr StringView config_file_path = ".hackstudio/config.json";
static constexpr auto config_file_path = ".hackstudio/config.json"sv;
NonnullOwnPtr<ProjectConfig> config() const;
private:

View file

@ -34,7 +34,7 @@ ErrorOr<void> ProjectBuilder::build(StringView active_file)
if (active_file.is_null())
return Error::from_string_literal("no active file");
if (active_file.ends_with(".js")) {
if (active_file.ends_with(".js"sv)) {
TRY(m_terminal->run_command(String::formatted("js -A {}", active_file)));
return {};
}
@ -60,7 +60,7 @@ ErrorOr<void> ProjectBuilder::run(StringView active_file)
if (active_file.is_null())
return Error::from_string_literal("no active file");
if (active_file.ends_with(".js")) {
if (active_file.ends_with(".js"sv)) {
TRY(m_terminal->run_command(String::formatted("js {}", active_file)));
return {};
}
@ -129,7 +129,7 @@ ErrorOr<void> ProjectBuilder::initialize_build_directory()
}
}
auto cmake_file_path = LexicalPath::join(build_directory(), "CMakeLists.txt").string();
auto cmake_file_path = LexicalPath::join(build_directory(), "CMakeLists.txt"sv).string();
if (Core::File::exists(cmake_file_path))
MUST(Core::File::remove(cmake_file_path, Core::File::RecursionMode::Disallowed, false));
@ -148,7 +148,7 @@ Optional<String> ProjectBuilder::find_cmake_file_for(StringView file_path) const
{
auto directory = LexicalPath::dirname(file_path);
while (!directory.is_empty()) {
auto cmake_path = LexicalPath::join(m_project_root, directory, "CMakeLists.txt");
auto cmake_path = LexicalPath::join(m_project_root, directory, "CMakeLists.txt"sv);
if (Core::File::exists(cmake_path.string()))
return cmake_path.string();
directory = LexicalPath::dirname(directory);

View file

@ -20,13 +20,13 @@ void HackStudio::ProjectDeclarations::set_declared_symbols(String const& filenam
Optional<GUI::Icon> HackStudio::ProjectDeclarations::get_icon_for(CodeComprehension::DeclarationType type)
{
static GUI::Icon struct_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Struct.png").release_value_but_fixme_should_propagate_errors());
static GUI::Icon class_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Class.png").release_value_but_fixme_should_propagate_errors());
static GUI::Icon function_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Function.png").release_value_but_fixme_should_propagate_errors());
static GUI::Icon variable_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Variable.png").release_value_but_fixme_should_propagate_errors());
static GUI::Icon preprocessor_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Preprocessor.png").release_value_but_fixme_should_propagate_errors());
static GUI::Icon member_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Member.png").release_value_but_fixme_should_propagate_errors());
static GUI::Icon namespace_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Namespace.png").release_value_but_fixme_should_propagate_errors());
static GUI::Icon struct_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Struct.png"sv).release_value_but_fixme_should_propagate_errors());
static GUI::Icon class_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Class.png"sv).release_value_but_fixme_should_propagate_errors());
static GUI::Icon function_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Function.png"sv).release_value_but_fixme_should_propagate_errors());
static GUI::Icon variable_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Variable.png"sv).release_value_but_fixme_should_propagate_errors());
static GUI::Icon preprocessor_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Preprocessor.png"sv).release_value_but_fixme_should_propagate_errors());
static GUI::Icon member_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Member.png"sv).release_value_but_fixme_should_propagate_errors());
static GUI::Icon namespace_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Namespace.png"sv).release_value_but_fixme_should_propagate_errors());
switch (type) {
case CodeComprehension::DeclarationType::Struct:
return struct_icon;

View file

@ -48,7 +48,7 @@ RefPtr<ProjectTemplate> ProjectTemplate::load_from_manifest(String const& manife
// Attempt to read in the template icons
// Fallback to a generic executable icon if one isn't found
auto icon = GUI::Icon::default_icon("filetype-executable");
auto icon = GUI::Icon::default_icon("filetype-executable"sv);
auto bitmap_path_32 = String::formatted("/res/icons/hackstudio/templates-32x32/{}.png", config->read_entry("HackStudioTemplate", "IconName32x"));
@ -94,7 +94,7 @@ Result<void, String> ProjectTemplate::create_project(String const& name, String
dbgln("Running post-create script '{}'", postcreate_script_path);
// Generate a namespace-safe project name (replace hyphens with underscores)
auto namespace_safe = name.replace("-", "_", ReplaceMode::All);
auto namespace_safe = name.replace("-"sv, "_"sv, ReplaceMode::All);
pid_t child_pid;
char const* argv[] = { postcreate_script_path.characters(), name.characters(), path.characters(), namespace_safe.characters(), nullptr };

View file

@ -28,8 +28,8 @@ ErrorOr<void> TerminalWrapper::run_command(String const& command, Optional<Strin
{
if (m_pid != -1) {
GUI::MessageBox::show(window(),
"A command is already running in this TerminalWrapper",
"Can't run command",
"A command is already running in this TerminalWrapper"sv,
"Can't run command"sv,
GUI::MessageBox::Type::Error);
return {};
}
@ -94,7 +94,7 @@ ErrorOr<int> TerminalWrapper::setup_master_pseudoterminal(WaitForChildOnExit wai
if (WIFEXITED(wstatus)) {
m_terminal_widget->inject_string(String::formatted("\033[{};1m(Command exited with code {})\033[0m\r\n", wstatus == 0 ? 32 : 31, WEXITSTATUS(wstatus)));
} else if (WIFSTOPPED(wstatus)) {
m_terminal_widget->inject_string("\033[34;1m(Command stopped!)\033[0m\r\n");
m_terminal_widget->inject_string("\033[34;1m(Command stopped!)\033[0m\r\n"sv);
} else if (WIFSIGNALED(wstatus)) {
m_terminal_widget->inject_string(String::formatted("\033[34;1m(Command signaled with {}!)\033[0m\r\n", strsignal(WTERMSIG(wstatus))));
}

View file

@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = GUI::Window::construct();
window->resize(840, 600);
window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png").release_value_but_fixme_should_propagate_errors());
window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors());
update_path_environment_variable();
@ -112,7 +112,7 @@ static bool make_is_available()
static void notify_make_not_available()
{
auto notification = GUI::Notification::construct();
notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png").release_value_but_fixme_should_propagate_errors());
notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors());
notification->set_title("'make' Not Available");
notification->set_text("You probably want to install the binutils, gcc, and make ports from the root of the Serenity repository");
notification->show();
@ -128,7 +128,7 @@ static void update_path_environment_variable()
if (path.length())
path.append(":");
path.append("/usr/local/sbin:/usr/local/bin:/usr/bin:/bin");
path.append("/usr/local/sbin:/usr/local/bin:/usr/bin:/bin"sv);
setenv("PATH", path.to_string().characters(), true);
}

View file

@ -17,10 +17,10 @@ namespace Inspector {
RemoteObjectGraphModel::RemoteObjectGraphModel(RemoteProcess& process)
: m_process(process)
{
m_object_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png").release_value_but_fixme_should_propagate_errors());
m_window_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png").release_value_but_fixme_should_propagate_errors());
m_layout_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png").release_value_but_fixme_should_propagate_errors());
m_timer_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/timer.png").release_value_but_fixme_should_propagate_errors());
m_object_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
m_window_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors());
m_layout_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png"sv).release_value_but_fixme_should_propagate_errors());
m_timer_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/timer.png"sv).release_value_but_fixme_should_propagate_errors());
}
GUI::ModelIndex RemoteObjectGraphModel::index(int row, int column, const GUI::ModelIndex& parent) const
@ -82,7 +82,7 @@ GUI::Variant RemoteObjectGraphModel::data(const GUI::ModelIndex& index, GUI::Mod
return m_window_icon;
if (remote_object->class_name == "Timer")
return m_timer_icon;
if (remote_object->class_name.ends_with("Layout"))
if (remote_object->class_name.ends_with("Layout"sv))
return m_layout_icon;
return m_object_icon;
}

View file

@ -29,10 +29,10 @@ RemoteProcess::RemoteProcess(pid_t pid)
void RemoteProcess::handle_identify_response(JsonObject const& response)
{
int pid = response.get("pid").to_int();
int pid = response.get("pid"sv).to_int();
VERIFY(pid == m_pid);
m_process_name = response.get("process_name").as_string_or({});
m_process_name = response.get("process_name"sv).as_string_or({});
if (on_update)
on_update();
@ -41,7 +41,7 @@ void RemoteProcess::handle_identify_response(JsonObject const& response)
void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
{
// FIXME: It would be good if we didn't have to make a local copy of the array value here!
auto objects = response.get("objects");
auto objects = response.get("objects"sv);
auto& object_array = objects.as_array();
NonnullOwnPtrVector<RemoteObject> remote_objects;
@ -51,10 +51,10 @@ void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
VERIFY(value.is_object());
auto& object = value.as_object();
auto remote_object = make<RemoteObject>();
remote_object->address = object.get("address").to_number<FlatPtr>();
remote_object->parent_address = object.get("parent").to_number<FlatPtr>();
remote_object->name = object.get("name").to_string();
remote_object->class_name = object.get("class_name").to_string();
remote_object->address = object.get("address"sv).to_number<FlatPtr>();
remote_object->parent_address = object.get("parent"sv).to_number<FlatPtr>();
remote_object->name = object.get("name"sv).to_string();
remote_object->class_name = object.get("class_name"sv).to_string();
remote_object->json = object;
objects_by_address.set(remote_object->address, remote_object);
remote_objects.append(move(remote_object));

View file

@ -48,10 +48,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
pid_t pid;
auto app = TRY(GUI::Application::try_create(arguments));
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-inspector"));
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-inspector"sv));
if (gui_mode) {
choose_pid:
auto process_chooser = TRY(GUI::ProcessChooser::try_create("Inspector", "Inspect", app_icon.bitmap_for_size(16)));
auto process_chooser = TRY(GUI::ProcessChooser::try_create("Inspector"sv, "Inspect"sv, app_icon.bitmap_for_size(16)));
if (process_chooser->exec() == GUI::Dialog::ExecResult::Cancel)
return 0;
pid = process_chooser->pid();
@ -65,13 +65,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = TRY(GUI::Window::try_create());
if (pid == getpid()) {
GUI::MessageBox::show(window, "Cannot inspect Inspector itself!", "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window, "Cannot inspect Inspector itself!"sv, "Error"sv, GUI::MessageBox::Type::Error);
return 1;
}
RemoteProcess remote_process(pid);
if (!remote_process.is_inspectable()) {
GUI::MessageBox::show(window, String::formatted("Process pid={} is not inspectable", remote_process.pid()), "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window, String::formatted("Process pid={} is not inspectable", remote_process.pid()), "Error"sv, GUI::MessageBox::Type::Error);
if (gui_mode) {
goto choose_pid;
} else {
@ -126,7 +126,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto properties_tree_view_context_menu = TRY(GUI::Menu::try_create("Properties Tree View"));
auto copy_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png").release_value_but_fixme_should_propagate_errors();
auto copy_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors();
auto copy_property_name_action = GUI::Action::create("Copy Property Name", copy_bitmap, [&](auto&) {
GUI::Clipboard::the().set_plain_text(properties_tree_view.selection().first().data().to_string());
});

View file

@ -24,7 +24,7 @@ static ELF::Image* try_load_kernel_binary()
{
if (s_kernel_binary.has_value())
return &s_kernel_binary->elf;
auto kernel_binary_or_error = Core::MappedFile::map("/boot/Kernel");
auto kernel_binary_or_error = Core::MappedFile::map("/boot/Kernel"sv);
if (!kernel_binary_or_error.is_error()) {
auto kernel_binary = kernel_binary_or_error.release_value();
s_kernel_binary = { { kernel_binary, ELF::Image(kernel_binary->bytes()) } };
@ -212,12 +212,12 @@ GUI::Variant DisassemblyModel::data(GUI::ModelIndex const& index, GUI::ModelRole
if (first)
first = false;
else
builder.append(" => ");
builder.append(" => "sv);
builder.appendff("{}:{}", entry.file_path, entry.line_number);
}
if (insn.source_position_with_inlines.source_position.has_value()) {
if (!first)
builder.append(" => ");
builder.append(" => "sv);
auto const& entry = insn.source_position_with_inlines.source_position.value();
builder.appendff("{}:{}", entry.file_path, entry.line_number);
}

View file

@ -245,7 +245,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
auto const& object = json.value().as_object();
if (!g_kernel_debuginfo_object.has_value()) {
auto debuginfo_file_or_error = Core::MappedFile::map("/boot/Kernel.debug");
auto debuginfo_file_or_error = Core::MappedFile::map("/boot/Kernel.debug"sv);
if (!debuginfo_file_or_error.is_error()) {
auto debuginfo_file = debuginfo_file_or_error.release_value();
auto debuginfo_image = ELF::Image(debuginfo_file->bytes());
@ -263,7 +263,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
profile_strings.set(string_id, value.to_string());
}
auto const* events_value = object.get_ptr("events");
auto const* events_value = object.get_ptr("events"sv);
if (!events_value || !events_value->is_array())
return Error::from_string_literal("Malformed profile (events is not an array)");
@ -281,12 +281,12 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
event.serial = next_serial;
next_serial.increment();
event.timestamp = perf_event.get("timestamp").to_number<u64>();
event.lost_samples = perf_event.get("lost_samples").to_number<u32>();
event.pid = perf_event.get("pid").to_i32();
event.tid = perf_event.get("tid").to_i32();
event.timestamp = perf_event.get("timestamp"sv).to_number<u64>();
event.lost_samples = perf_event.get("lost_samples"sv).to_number<u32>();
event.pid = perf_event.get("pid"sv).to_i32();
event.tid = perf_event.get("tid"sv).to_i32();
auto type_string = perf_event.get("type").to_string();
auto type_string = perf_event.get("type"sv).to_string();
if (type_string == "sample"sv) {
event.data = Event::SampleData {};
@ -403,7 +403,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
auto maybe_kernel_base = Symbolication::kernel_base();
auto const* stack = perf_event.get_ptr("stack");
auto const* stack = perf_event.get_ptr("stack"sv);
VERIFY(stack);
auto const& stack_array = stack->as_array();
for (ssize_t i = stack_array.values().size() - 1; i >= 0; --i) {

View file

@ -16,8 +16,8 @@ namespace Profiler {
ProfileModel::ProfileModel(Profile& profile)
: m_profile(profile)
{
m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png").release_value_but_fixme_should_propagate_errors());
m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object-red.png").release_value_but_fixme_should_propagate_errors());
m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object-red.png"sv).release_value_but_fixme_should_propagate_errors());
}
GUI::ModelIndex ProfileModel::index(int row, int column, GUI::ModelIndex const& parent) const

View file

@ -14,8 +14,8 @@ namespace Profiler {
SamplesModel::SamplesModel(Profile& profile)
: m_profile(profile)
{
m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png").release_value_but_fixme_should_propagate_errors());
m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object-red.png").release_value_but_fixme_should_propagate_errors());
m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object-red.png"sv).release_value_but_fixme_should_propagate_errors());
}
int SamplesModel::row_count(GUI::ModelIndex const&) const

View file

@ -27,7 +27,7 @@ public:
public:
SourceFile(StringView filename)
{
String source_file_name = filename.replace("../../", source_root_path, ReplaceMode::FirstOnly);
String source_file_name = filename.replace("../../"sv, source_root_path, ReplaceMode::FirstOnly);
auto maybe_file = Core::File::open(source_file_name, Core::OpenMode::ReadOnly);
if (maybe_file.is_error()) {

View file

@ -58,7 +58,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
auto app = TRY(GUI::Application::try_create(arguments));
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-profiler"));
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-profiler"sv));
String perfcore_file;
if (!perfcore_file_arg) {
@ -71,7 +71,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto profile_or_error = Profile::load_from_perfcore_file(perfcore_file);
if (profile_or_error.is_error()) {
GUI::MessageBox::show(nullptr, String::formatted("{}", profile_or_error.error()), "Profiler", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(nullptr, String::formatted("{}", profile_or_error.error()), "Profiler"sv, GUI::MessageBox::Type::Error);
return 0;
}
@ -170,12 +170,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
update_source_model();
};
auto disassembly_action = GUI::Action::create_checkable("Show &Disassembly", { Mod_Ctrl, Key_D }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/x86.png").release_value_but_fixme_should_propagate_errors(), [&](auto& action) {
auto disassembly_action = GUI::Action::create_checkable("Show &Disassembly", { Mod_Ctrl, Key_D }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/x86.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto& action) {
disassembly_view->set_visible(action.is_checked());
update_disassembly_model();
});
auto source_action = GUI::Action::create_checkable("Show &Source", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/x86.png").release_value_but_fixme_should_propagate_errors(), [&](auto& action) {
auto source_action = GUI::Action::create_checkable("Show &Source", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/x86.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto& action) {
source_view->set_visible(action.is_checked());
update_source_model();
});
@ -314,7 +314,7 @@ static bool prompt_to_stop_profiling(pid_t pid, String const& process_name)
auto window = GUI::Window::construct();
window->set_title(String::formatted("Profiling {}({})", process_name, pid));
window->resize(240, 100);
window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png").release_value_but_fixme_should_propagate_errors());
window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors());
window->center_on_screen();
auto& widget = window->set_main_widget<GUI::Widget>();
@ -342,7 +342,7 @@ static bool prompt_to_stop_profiling(pid_t pid, String const& process_name)
bool generate_profile(pid_t& pid)
{
if (!pid) {
auto process_chooser = GUI::ProcessChooser::construct("Profiler", "Profile", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png").release_value_but_fixme_should_propagate_errors());
auto process_chooser = GUI::ProcessChooser::construct("Profiler"sv, "Profile"sv, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors());
if (process_chooser->exec() == GUI::Dialog::ExecResult::Cancel)
return false;
pid = process_chooser->pid();
@ -366,7 +366,7 @@ bool generate_profile(pid_t& pid)
if (profiling_enable(pid, event_mask) < 0) {
int saved_errno = errno;
GUI::MessageBox::show(nullptr, String::formatted("Unable to profile process {}({}): {}", process_name, pid, strerror(saved_errno)), "Profiler", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(nullptr, String::formatted("Unable to profile process {}({}): {}", process_name, pid, strerror(saved_errno)), "Profiler"sv, GUI::MessageBox::Type::Error);
return false;
}

View file

@ -35,7 +35,7 @@ MainWidget::MainWidget()
set_fill_with_background_color(true);
set_layout<GUI::VerticalBoxLayout>();
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
open_new_script();
});
@ -142,7 +142,7 @@ MainWidget::MainWidget()
update_editor_actions(editor);
});
m_run_script_action = GUI::Action::create("Run script", { Mod_Alt, Key_F9 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_run_script_action = GUI::Action::create("Run script", { Mod_Alt, Key_F9 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_results.clear();
m_current_line_for_parsing = 0;
// TODO select the database to use in UI.
@ -207,10 +207,10 @@ MainWidget::MainWidget()
m_statusbar = add<GUI::Statusbar>(3);
m_statusbar->segment(1).set_mode(GUI::Statusbar::Segment::Mode::Fixed);
m_statusbar->segment(1).set_fixed_width(font().width("000000 characters (00000 words) selected") + font().max_glyph_width());
m_statusbar->segment(1).set_fixed_width(font().width("000000 characters (00000 words) selected"sv) + font().max_glyph_width());
m_statusbar->segment(2).set_mode(GUI::Statusbar::Segment::Mode::Fixed);
m_statusbar->segment(2).set_fixed_width(font().width("Ln 0000, Col 000") + font().max_glyph_width());
m_statusbar->segment(2).set_fixed_width(font().width("Ln 0000, Col 000"sv) + font().max_glyph_width());
m_sql_client = SQL::SQLClient::try_create().release_value_but_fixme_should_propagate_errors();
m_sql_client->on_execution_success = [this](int, bool, int, int, int) {
@ -266,7 +266,7 @@ void MainWidget::initialize_menu(GUI::Window* window)
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/SQLStudio.md"), "/bin/Help");
}));
help_menu.add_action(GUI::CommonActions::make_about_action("SQL Studio", GUI::Icon::default_icon("app-sql-studio"), window));
help_menu.add_action(GUI::CommonActions::make_about_action("SQL Studio", GUI::Icon::default_icon("app-sql-studio"sv), window));
}
void MainWidget::open_new_script()
@ -394,7 +394,7 @@ void MainWidget::drop_event(GUI::DropEvent& drop_event)
for (auto& url : urls) {
auto& scheme = url.scheme();
if (!scheme.equals_ignoring_case("file"))
if (!scheme.equals_ignoring_case("file"sv))
continue;
auto lexical_path = LexicalPath(url.path());

View file

@ -23,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app = TRY(GUI::Application::try_create(arguments));
auto app_icon = GUI::Icon::default_icon("app-sql-studio");
auto app_icon = GUI::Icon::default_icon("app-sql-studio"sv);
auto window = TRY(GUI::Window::try_create());
window->resize(640, 480);

View file

@ -85,7 +85,7 @@ Vector<ELF::AuxiliaryValue> Emulator::generate_auxiliary_vector(FlatPtr load_bas
auxv.append({ ELF::AuxiliaryValue::Entry, (void*)entry_eip });
// FIXME: Don't hard code this? We might support other platforms later.. (e.g. x86_64)
auxv.append({ ELF::AuxiliaryValue::Platform, "i386" });
auxv.append({ ELF::AuxiliaryValue::Platform, "i386"sv });
auxv.append({ ELF::AuxiliaryValue::ExecFilename, executable_path });
@ -154,7 +154,7 @@ bool Emulator::load_elf()
{
auto file_or_error = Core::MappedFile::map(m_executable_path);
if (file_or_error.is_error()) {
reportln("Unable to map {}: {}", m_executable_path, file_or_error.error());
reportln("Unable to map {}: {}"sv, m_executable_path, file_or_error.error());
return false;
}
@ -169,7 +169,7 @@ bool Emulator::load_elf()
StringBuilder interpreter_path_builder;
auto result_or_error = ELF::validate_program_headers(*(Elf32_Ehdr const*)elf_image_data.data(), elf_image_data.size(), elf_image_data, &interpreter_path_builder);
if (result_or_error.is_error() || !result_or_error.value()) {
reportln("failed to validate ELF file");
reportln("failed to validate ELF file"sv);
return false;
}
auto interpreter_path = interpreter_path_builder.string_view();
@ -229,7 +229,7 @@ int Emulator::exec()
size_t instructions_until_next_profile_dump = profile_instruction_interval();
if (is_profiling() && m_loader_text_size.has_value())
emit_profile_event(profile_stream(), "mmap", String::formatted(R"("ptr": {}, "size": {}, "name": "/usr/lib/Loader.so")", *m_loader_text_base, *m_loader_text_size));
emit_profile_event(profile_stream(), "mmap"sv, String::formatted(R"("ptr": {}, "size": {}, "name": "/usr/lib/Loader.so")", *m_loader_text_base, *m_loader_text_size));
while (!m_shutdown) {
if (m_steps_til_pause) [[likely]] {
@ -493,7 +493,7 @@ String Emulator::create_backtrace_line(FlatPtr address)
void Emulator::dump_backtrace(Vector<FlatPtr> const& backtrace)
{
for (auto const& address : backtrace) {
reportln("{}", create_backtrace_line(address));
reportln("{}"sv, create_backtrace_line(address));
}
}
@ -511,7 +511,7 @@ void Emulator::emit_profile_sample(AK::OutputStream& output)
gettimeofday(&tv, nullptr);
builder.appendff(R"~(, {{"type": "sample", "pid": {}, "tid": {}, "timestamp": {}, "lost_samples": 0, "stack": [)~", getpid(), gettid(), tv.tv_sec * 1000 + tv.tv_usec / 1000);
builder.join(',', raw_backtrace());
builder.append("]}\n");
builder.append("]}\n"sv);
output.write_or_error(builder.string_view().bytes());
}
@ -626,7 +626,7 @@ void Emulator::dispatch_one_pending_signal()
auto action = default_signal_action(signum);
if (action == DefaultSignalAction::Ignore)
return;
reportln("\n=={}== Got signal {} ({}), no handler registered", getpid(), signum, strsignal(signum));
reportln("\n=={}== Got signal {} ({}), no handler registered"sv, getpid(), signum, strsignal(signum));
dump_backtrace();
m_shutdown = true;
return;
@ -637,7 +637,7 @@ void Emulator::dispatch_one_pending_signal()
return;
}
reportln("\n=={}== Got signal {} ({}), handler at {:p}", getpid(), signum, strsignal(signum), handler.handler);
reportln("\n=={}== Got signal {} ({}), handler at {:p}"sv, getpid(), signum, strsignal(signum), handler.handler);
auto old_esp = m_cpu->esp().value();
@ -762,7 +762,7 @@ void Emulator::setup_signal_trampoline()
void Emulator::dump_regions() const
{
const_cast<SoftMMU&>(m_mmu).for_each_region([&](Region const& region) {
reportln("{:p}-{:p} {:c}{:c}{:c} {} {}{}{} ",
reportln("{:p}-{:p} {:c}{:c}{:c} {} {}{}{} "sv,
region.base(),
region.end() - 1,
region.is_readable() ? 'R' : '-',

View file

@ -38,7 +38,7 @@ namespace UserspaceEmulator {
u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
{
if constexpr (SPAM_DEBUG)
reportln("Syscall: {} ({:x})", Syscall::to_string((Syscall::Function)function), function);
reportln("Syscall: {} ({:x})"sv, Syscall::to_string((Syscall::Function)function), function);
switch (function) {
case SC_accept4:
return virt$accept4(arg1);
@ -261,7 +261,7 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
case SC_write:
return virt$write(arg1, arg2, arg3);
default:
reportln("\n=={}== \033[31;1mUnimplemented syscall: {}\033[0m, {:p}", getpid(), Syscall::to_string((Syscall::Function)function), function);
reportln("\n=={}== \033[31;1mUnimplemented syscall: {}\033[0m, {:p}"sv, getpid(), Syscall::to_string((Syscall::Function)function), function);
dump_backtrace();
TODO();
}
@ -297,7 +297,7 @@ FlatPtr Emulator::virt$perf_event(int event, FlatPtr arg1, FlatPtr arg2)
if (event == PERF_EVENT_SIGNPOST) {
if (is_profiling()) {
if (profiler_string_id_map().size() > arg1)
emit_profile_event(profile_stream(), "signpost", String::formatted("\"arg1\": {}, \"arg2\": {}", arg1, arg2));
emit_profile_event(profile_stream(), "signpost"sv, String::formatted("\"arg1\": {}, \"arg2\": {}", arg1, arg2));
syscall(SC_perf_event, PERF_EVENT_SIGNPOST, profiler_string_id_map().at(arg1), arg2);
} else {
syscall(SC_perf_event, PERF_EVENT_SIGNPOST, arg1, arg2);
@ -846,7 +846,7 @@ static void round_to_page_size(FlatPtr& address, size_t& size)
u32 Emulator::virt$munmap(FlatPtr address, size_t size)
{
if (is_profiling())
emit_profile_event(profile_stream(), "munmap", String::formatted("\"ptr\": {}, \"size\": {}", address, size));
emit_profile_event(profile_stream(), "munmap"sv, String::formatted("\"ptr\": {}, \"size\": {}", address, size));
round_to_page_size(address, size);
Vector<Region*, 4> marked_for_deletion;
bool has_non_mmap_region = false;
@ -894,7 +894,7 @@ u32 Emulator::virt$mmap(u32 params_addr)
} else {
// mmap(nullptr, …, MAP_FIXED) is technically okay, but tends to be a bug.
// Therefore, refuse to be helpful.
reportln("\n=={}== \033[31;1mTried to mmap at nullptr with MAP_FIXED.\033[0m, {:#x} bytes.", getpid(), params.size);
reportln("\n=={}== \033[31;1mTried to mmap at nullptr with MAP_FIXED.\033[0m, {:#x} bytes."sv, getpid(), params.size);
dump_backtrace();
}
} else {
@ -916,7 +916,7 @@ u32 Emulator::virt$mmap(u32 params_addr)
}
if (is_profiling())
emit_profile_event(profile_stream(), "mmap", String::formatted(R"("ptr": {}, "size": {}, "name": "{}")", final_address, final_size, name_str));
emit_profile_event(profile_stream(), "mmap"sv, String::formatted(R"("ptr": {}, "size": {}, "name": "{}")", final_address, final_size, name_str));
if (params.flags & MAP_ANONYMOUS) {
mmu().add_region(MmapRegion::create_anonymous(final_address, final_size, params.prot, move(name_str)));
@ -1082,7 +1082,7 @@ void Emulator::virt$sync()
void Emulator::virt$exit(int status)
{
reportln("\n=={}== \033[33;1mSyscall: exit({})\033[0m, shutting down!", getpid(), status);
reportln("\n=={}== \033[33;1mSyscall: exit({})\033[0m, shutting down!"sv, getpid(), status);
m_exit_status = status;
m_shutdown = true;
}
@ -1173,7 +1173,7 @@ int Emulator::virt$ioctl([[maybe_unused]] int fd, unsigned request, [[maybe_unus
return syscall(SC_ioctl, fd, request, &enabled);
}
default:
reportln("Unsupported ioctl: {}", request);
reportln("Unsupported ioctl: {}"sv, request);
dump_backtrace();
TODO();
}
@ -1245,10 +1245,10 @@ int Emulator::virt$execve(FlatPtr params_addr)
copy_string_list(arguments, params.arguments);
copy_string_list(environment, params.environment);
reportln("\n=={}== \033[33;1mSyscall:\033[0m execve", getpid());
reportln("=={}== @ {}", getpid(), path);
reportln("\n=={}== \033[33;1mSyscall:\033[0m execve"sv, getpid());
reportln("=={}== @ {}"sv, getpid(), path);
for (auto& argument : arguments)
reportln("=={}== - {}", getpid(), argument);
reportln("=={}== - {}"sv, getpid(), argument);
if (access(path.characters(), X_OK) < 0) {
if (errno == ENOENT || errno == EACCES)
@ -1336,7 +1336,7 @@ int Emulator::virt$gethostname(FlatPtr buffer, ssize_t buffer_size)
int Emulator::virt$sigaction(int signum, FlatPtr act, FlatPtr oldact)
{
if (signum == SIGKILL) {
reportln("Attempted to sigaction() with SIGKILL");
reportln("Attempted to sigaction() with SIGKILL"sv);
return -EINVAL;
}

View file

@ -130,8 +130,8 @@ void MallocTracer::target_did_free(Badge<Emulator>, FlatPtr address)
if (auto* mallocation = find_mallocation(address)) {
if (mallocation->freed) {
reportln("\n=={}== \033[31;1mDouble free()\033[0m, {:p}", getpid(), address);
reportln("=={}== Address {} has already been passed to free()", getpid(), address);
reportln("\n=={}== \033[31;1mDouble free()\033[0m, {:p}"sv, getpid(), address);
reportln("=={}== Address {} has already been passed to free()"sv, getpid(), address);
m_emulator.dump_backtrace();
} else {
mallocation->freed = true;
@ -140,8 +140,8 @@ void MallocTracer::target_did_free(Badge<Emulator>, FlatPtr address)
return;
}
reportln("\n=={}== \033[31;1mInvalid free()\033[0m, {:p}", getpid(), address);
reportln("=={}== Address {} has never been returned by malloc()", getpid(), address);
reportln("\n=={}== \033[31;1mInvalid free()\033[0m, {:p}"sv, getpid(), address);
reportln("=={}== Address {} has never been returned by malloc()"sv, getpid(), address);
m_emulator.dump_backtrace();
}
@ -228,19 +228,19 @@ void MallocTracer::audit_read(Region const& region, FlatPtr address, size_t size
auto* mallocation = find_mallocation(region, address);
if (!mallocation) {
reportln("\n=={}== \033[31;1mHeap buffer overflow\033[0m, invalid {}-byte read at address {:p}", getpid(), size, address);
reportln("\n=={}== \033[31;1mHeap buffer overflow\033[0m, invalid {}-byte read at address {:p}"sv, getpid(), size, address);
m_emulator.dump_backtrace();
auto* mallocation_before = find_mallocation_before(address);
auto* mallocation_after = find_mallocation_after(address);
size_t distance_to_mallocation_before = mallocation_before ? (address - mallocation_before->address - mallocation_before->size) : 0;
size_t distance_to_mallocation_after = mallocation_after ? (mallocation_after->address - address) : 0;
if (mallocation_before && (!mallocation_after || distance_to_mallocation_before < distance_to_mallocation_after)) {
reportln("=={}== Address is {} byte(s) after block of size {}, identity {:p}, allocated at:", getpid(), distance_to_mallocation_before, mallocation_before->size, mallocation_before->address);
reportln("=={}== Address is {} byte(s) after block of size {}, identity {:p}, allocated at:"sv, getpid(), distance_to_mallocation_before, mallocation_before->size, mallocation_before->address);
m_emulator.dump_backtrace(mallocation_before->malloc_backtrace);
return;
}
if (mallocation_after && (!mallocation_before || distance_to_mallocation_after < distance_to_mallocation_before)) {
reportln("=={}== Address is {} byte(s) before block of size {}, identity {:p}, allocated at:", getpid(), distance_to_mallocation_after, mallocation_after->size, mallocation_after->address);
reportln("=={}== Address is {} byte(s) before block of size {}, identity {:p}, allocated at:"sv, getpid(), distance_to_mallocation_after, mallocation_after->size, mallocation_after->address);
m_emulator.dump_backtrace(mallocation_after->malloc_backtrace);
}
return;
@ -249,11 +249,11 @@ void MallocTracer::audit_read(Region const& region, FlatPtr address, size_t size
size_t offset_into_mallocation = address - mallocation->address;
if (mallocation->freed) {
reportln("\n=={}== \033[31;1mUse-after-free\033[0m, invalid {}-byte read at address {:p}", getpid(), size, address);
reportln("\n=={}== \033[31;1mUse-after-free\033[0m, invalid {}-byte read at address {:p}"sv, getpid(), size, address);
m_emulator.dump_backtrace();
reportln("=={}== Address is {} byte(s) into block of size {}, allocated at:", getpid(), offset_into_mallocation, mallocation->size);
reportln("=={}== Address is {} byte(s) into block of size {}, allocated at:"sv, getpid(), offset_into_mallocation, mallocation->size);
m_emulator.dump_backtrace(mallocation->malloc_backtrace);
reportln("=={}== Later freed at:", getpid());
reportln("=={}== Later freed at:"sv, getpid());
m_emulator.dump_backtrace(mallocation->free_backtrace);
return;
}
@ -274,19 +274,19 @@ void MallocTracer::audit_write(Region const& region, FlatPtr address, size_t siz
auto* mallocation = find_mallocation(region, address);
if (!mallocation) {
reportln("\n=={}== \033[31;1mHeap buffer overflow\033[0m, invalid {}-byte write at address {:p}", getpid(), size, address);
reportln("\n=={}== \033[31;1mHeap buffer overflow\033[0m, invalid {}-byte write at address {:p}"sv, getpid(), size, address);
m_emulator.dump_backtrace();
auto* mallocation_before = find_mallocation_before(address);
auto* mallocation_after = find_mallocation_after(address);
size_t distance_to_mallocation_before = mallocation_before ? (address - mallocation_before->address - mallocation_before->size) : 0;
size_t distance_to_mallocation_after = mallocation_after ? (mallocation_after->address - address) : 0;
if (mallocation_before && (!mallocation_after || distance_to_mallocation_before < distance_to_mallocation_after)) {
reportln("=={}== Address is {} byte(s) after block of size {}, identity {:p}, allocated at:", getpid(), distance_to_mallocation_before, mallocation_before->size, mallocation_before->address);
reportln("=={}== Address is {} byte(s) after block of size {}, identity {:p}, allocated at:"sv, getpid(), distance_to_mallocation_before, mallocation_before->size, mallocation_before->address);
m_emulator.dump_backtrace(mallocation_before->malloc_backtrace);
return;
}
if (mallocation_after && (!mallocation_before || distance_to_mallocation_after < distance_to_mallocation_before)) {
reportln("=={}== Address is {} byte(s) before block of size {}, identity {:p}, allocated at:", getpid(), distance_to_mallocation_after, mallocation_after->size, mallocation_after->address);
reportln("=={}== Address is {} byte(s) before block of size {}, identity {:p}, allocated at:"sv, getpid(), distance_to_mallocation_after, mallocation_after->size, mallocation_after->address);
m_emulator.dump_backtrace(mallocation_after->malloc_backtrace);
}
return;
@ -295,11 +295,11 @@ void MallocTracer::audit_write(Region const& region, FlatPtr address, size_t siz
size_t offset_into_mallocation = address - mallocation->address;
if (mallocation->freed) {
reportln("\n=={}== \033[31;1mUse-after-free\033[0m, invalid {}-byte write at address {:p}", getpid(), size, address);
reportln("\n=={}== \033[31;1mUse-after-free\033[0m, invalid {}-byte write at address {:p}"sv, getpid(), size, address);
m_emulator.dump_backtrace();
reportln("=={}== Address is {} byte(s) into block of size {}, allocated at:", getpid(), offset_into_mallocation, mallocation->size);
reportln("=={}== Address is {} byte(s) into block of size {}, allocated at:"sv, getpid(), offset_into_mallocation, mallocation->size);
m_emulator.dump_backtrace(mallocation->malloc_backtrace);
reportln("=={}== Later freed at:", getpid());
reportln("=={}== Later freed at:"sv, getpid());
m_emulator.dump_backtrace(mallocation->free_backtrace);
return;
}
@ -329,7 +329,7 @@ void MallocTracer::populate_memory_graph()
auto other_address = value.value();
if (!value.is_uninitialized() && m_memory_graph.contains(value.value())) {
if constexpr (REACHABLE_DEBUG)
reportln("region/mallocation {:p} is reachable from other mallocation {:p}", other_address, mallocation.address);
reportln("region/mallocation {:p} is reachable from other mallocation {:p}"sv, other_address, mallocation.address);
edges_from_mallocation.edges_from_node.append(other_address);
}
}
@ -357,7 +357,7 @@ void MallocTracer::populate_memory_graph()
auto other_address = value.value();
if (!value.is_uninitialized() && m_memory_graph.contains(value.value())) {
if constexpr (REACHABLE_DEBUG)
reportln("region/mallocation {:p} is reachable from region {:p}-{:p}", other_address, region.base(), region.end() - 1);
reportln("region/mallocation {:p} is reachable from region {:p}-{:p}"sv, other_address, region.base(), region.end() - 1);
m_memory_graph.find(other_address)->value.is_reachable = true;
reachable_mallocations.append(other_address);
}
@ -417,14 +417,14 @@ void MallocTracer::dump_leak_report()
return IterationDecision::Continue;
++leaks_found;
bytes_leaked += mallocation.size;
reportln("\n=={}== \033[31;1mLeak\033[0m, {}-byte allocation at address {:p}", getpid(), mallocation.size, mallocation.address);
reportln("\n=={}== \033[31;1mLeak\033[0m, {}-byte allocation at address {:p}"sv, getpid(), mallocation.size, mallocation.address);
m_emulator.dump_backtrace(mallocation.malloc_backtrace);
return IterationDecision::Continue;
});
if (!leaks_found)
reportln("\n=={}== \033[32;1mNo leaks found!\033[0m", getpid());
reportln("\n=={}== \033[32;1mNo leaks found!\033[0m"sv, getpid());
else
reportln("\n=={}== \033[31;1m{} leak(s) found: {} byte(s) leaked\033[0m", getpid(), leaks_found, bytes_leaked);
reportln("\n=={}== \033[31;1m{} leak(s) found: {} byte(s) leaked\033[0m"sv, getpid(), leaks_found, bytes_leaked);
}
}

View file

@ -65,7 +65,7 @@ MmapRegion::~MmapRegion()
ValueWithShadow<u8> MmapRegion::read8(FlatPtr offset)
{
if (!is_readable()) {
reportln("8-bit read from unreadable MmapRegion @ {:p}", base() + offset);
reportln("8-bit read from unreadable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -82,7 +82,7 @@ ValueWithShadow<u8> MmapRegion::read8(FlatPtr offset)
ValueWithShadow<u16> MmapRegion::read16(u32 offset)
{
if (!is_readable()) {
reportln("16-bit read from unreadable MmapRegion @ {:p}", base() + offset);
reportln("16-bit read from unreadable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -103,7 +103,7 @@ ValueWithShadow<u16> MmapRegion::read16(u32 offset)
ValueWithShadow<u32> MmapRegion::read32(u32 offset)
{
if (!is_readable()) {
reportln("32-bit read from unreadable MmapRegion @ {:p}", base() + offset);
reportln("32-bit read from unreadable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -124,7 +124,7 @@ ValueWithShadow<u32> MmapRegion::read32(u32 offset)
ValueWithShadow<u64> MmapRegion::read64(u32 offset)
{
if (!is_readable()) {
reportln("64-bit read from unreadable MmapRegion @ {:p}", base() + offset);
reportln("64-bit read from unreadable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -145,7 +145,7 @@ ValueWithShadow<u64> MmapRegion::read64(u32 offset)
ValueWithShadow<u128> MmapRegion::read128(u32 offset)
{
if (!is_readable()) {
reportln("128-bit read from unreadable MmapRegion @ {:p}", base() + offset);
reportln("128-bit read from unreadable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -165,7 +165,7 @@ ValueWithShadow<u128> MmapRegion::read128(u32 offset)
ValueWithShadow<u256> MmapRegion::read256(u32 offset)
{
if (!is_readable()) {
reportln("256-bit read from unreadable MmapRegion @ {:p}", base() + offset);
reportln("256-bit read from unreadable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -185,7 +185,7 @@ ValueWithShadow<u256> MmapRegion::read256(u32 offset)
void MmapRegion::write8(u32 offset, ValueWithShadow<u8> value)
{
if (!is_writable()) {
reportln("8-bit write from unwritable MmapRegion @ {:p}", base() + offset);
reportln("8-bit write from unwritable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -203,7 +203,7 @@ void MmapRegion::write8(u32 offset, ValueWithShadow<u8> value)
void MmapRegion::write16(u32 offset, ValueWithShadow<u16> value)
{
if (!is_writable()) {
reportln("16-bit write from unwritable MmapRegion @ {:p}", base() + offset);
reportln("16-bit write from unwritable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -221,7 +221,7 @@ void MmapRegion::write16(u32 offset, ValueWithShadow<u16> value)
void MmapRegion::write32(u32 offset, ValueWithShadow<u32> value)
{
if (!is_writable()) {
reportln("32-bit write from unwritable MmapRegion @ {:p}", base() + offset);
reportln("32-bit write from unwritable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -240,7 +240,7 @@ void MmapRegion::write32(u32 offset, ValueWithShadow<u32> value)
void MmapRegion::write64(u32 offset, ValueWithShadow<u64> value)
{
if (!is_writable()) {
reportln("64-bit write from unwritable MmapRegion @ {:p}", base() + offset);
reportln("64-bit write from unwritable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -259,7 +259,7 @@ void MmapRegion::write64(u32 offset, ValueWithShadow<u64> value)
void MmapRegion::write128(u32 offset, ValueWithShadow<u128> value)
{
if (!is_writable()) {
reportln("128-bit write from unwritable MmapRegion @ {:p}", base() + offset);
reportln("128-bit write from unwritable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}
@ -277,7 +277,7 @@ void MmapRegion::write128(u32 offset, ValueWithShadow<u128> value)
void MmapRegion::write256(u32 offset, ValueWithShadow<u256> value)
{
if (!is_writable()) {
reportln("256-bit write from unwritable MmapRegion @ {:p}", base() + offset);
reportln("256-bit write from unwritable MmapRegion @ {:p}"sv, base() + offset);
emulator().dump_backtrace();
TODO();
}

View file

@ -19,11 +19,11 @@
# pragma GCC optimize("O3")
#endif
#define TODO_INSN() \
do { \
reportln("\n=={}== Unimplemented instruction: {}\n", getpid(), __FUNCTION__); \
m_emulator.dump_backtrace(); \
_exit(0); \
#define TODO_INSN() \
do { \
reportln("\n=={}== Unimplemented instruction: {}\n"sv, getpid(), __FUNCTION__); \
m_emulator.dump_backtrace(); \
_exit(0); \
} while (0)
#define FPU_INSTRUCTION(name) \
@ -55,7 +55,7 @@ template<typename T>
ALWAYS_INLINE void warn_if_uninitialized(T value_with_shadow, char const* message)
{
if (value_with_shadow.is_uninitialized()) [[unlikely]] {
reportln("\033[31;1mWarning! Use of uninitialized value: {}\033[0m\n", message);
reportln("\033[31;1mWarning! Use of uninitialized value: {}\033[0m\n"sv, message);
Emulator::the().dump_backtrace();
}
}
@ -63,7 +63,7 @@ ALWAYS_INLINE void warn_if_uninitialized(T value_with_shadow, char const* messag
ALWAYS_INLINE void SoftCPU::warn_if_flags_tainted(char const* message) const
{
if (m_flags_tainted) [[unlikely]] {
reportln("\n=={}== \033[31;1mConditional depends on uninitialized data\033[0m ({})\n", getpid(), message);
reportln("\n=={}== \033[31;1mConditional depends on uninitialized data\033[0m ({})\n"sv, getpid(), message);
Emulator::the().dump_backtrace();
}
}
@ -108,7 +108,7 @@ void SoftCPU::update_code_cache()
VERIFY(region);
if (!region->is_executable()) {
reportln("SoftCPU::update_code_cache: Non-executable region @ {:p}", eip());
reportln("SoftCPU::update_code_cache: Non-executable region @ {:p}"sv, eip());
Emulator::the().dump_backtrace();
TODO();
}
@ -1388,13 +1388,13 @@ void SoftCPU::DIV_RM16(const X86::Instruction& insn)
{
auto divisor = insn.modrm().read16(*this, insn);
if (divisor.value() == 0) {
reportln("Divide by zero");
reportln("Divide by zero"sv);
TODO();
}
u32 dividend = ((u32)dx().value() << 16) | ax().value();
auto quotient = dividend / divisor.value();
if (quotient > NumericLimits<u16>::max()) {
reportln("Divide overflow");
reportln("Divide overflow"sv);
TODO();
}
@ -1409,13 +1409,13 @@ void SoftCPU::DIV_RM32(const X86::Instruction& insn)
{
auto divisor = insn.modrm().read32(*this, insn);
if (divisor.value() == 0) {
reportln("Divide by zero");
reportln("Divide by zero"sv);
TODO();
}
u64 dividend = ((u64)edx().value() << 32) | eax().value();
auto quotient = dividend / divisor.value();
if (quotient > NumericLimits<u32>::max()) {
reportln("Divide overflow");
reportln("Divide overflow"sv);
TODO();
}
@ -1430,13 +1430,13 @@ void SoftCPU::DIV_RM8(const X86::Instruction& insn)
{
auto divisor = insn.modrm().read8(*this, insn);
if (divisor.value() == 0) {
reportln("Divide by zero");
reportln("Divide by zero"sv);
TODO();
}
u16 dividend = ax().value();
auto quotient = dividend / divisor.value();
if (quotient > NumericLimits<u8>::max()) {
reportln("Divide overflow");
reportln("Divide overflow"sv);
TODO();
}
@ -1451,7 +1451,7 @@ void SoftCPU::ENTER32(const X86::Instruction&) { TODO_INSN(); }
void SoftCPU::ESCAPE(const X86::Instruction&)
{
reportln("FIXME: x87 floating-point support");
reportln("FIXME: x87 floating-point support"sv);
m_emulator.dump_backtrace();
TODO();
}
@ -1582,13 +1582,13 @@ void SoftCPU::IDIV_RM16(const X86::Instruction& insn)
auto divisor_with_shadow = insn.modrm().read16(*this, insn);
auto divisor = (i16)divisor_with_shadow.value();
if (divisor == 0) {
reportln("Divide by zero");
reportln("Divide by zero"sv);
TODO();
}
i32 dividend = (i32)(((u32)dx().value() << 16) | (u32)ax().value());
i32 result = dividend / divisor;
if (result > NumericLimits<i16>::max() || result < NumericLimits<i16>::min()) {
reportln("Divide overflow");
reportln("Divide overflow"sv);
TODO();
}
@ -1602,13 +1602,13 @@ void SoftCPU::IDIV_RM32(const X86::Instruction& insn)
auto divisor_with_shadow = insn.modrm().read32(*this, insn);
auto divisor = (i32)divisor_with_shadow.value();
if (divisor == 0) {
reportln("Divide by zero");
reportln("Divide by zero"sv);
TODO();
}
i64 dividend = (i64)(((u64)edx().value() << 32) | (u64)eax().value());
i64 result = dividend / divisor;
if (result > NumericLimits<i32>::max() || result < NumericLimits<i32>::min()) {
reportln("Divide overflow");
reportln("Divide overflow"sv);
TODO();
}
@ -1622,13 +1622,13 @@ void SoftCPU::IDIV_RM8(const X86::Instruction& insn)
auto divisor_with_shadow = insn.modrm().read8(*this, insn);
auto divisor = (i8)divisor_with_shadow.value();
if (divisor == 0) {
reportln("Divide by zero");
reportln("Divide by zero"sv);
TODO();
}
i16 dividend = ax().value();
i16 result = dividend / divisor;
if (result > NumericLimits<i8>::max() || result < NumericLimits<i8>::min()) {
reportln("Divide overflow");
reportln("Divide overflow"sv);
TODO();
}

View file

@ -20,18 +20,18 @@
# pragma GCC optimize("O3")
#endif
#define TODO_INSN() \
do { \
reportln("\n=={}== Unimplemented instruction: {}\n", getpid(), __FUNCTION__); \
m_emulator.dump_backtrace(); \
_exit(0); \
#define TODO_INSN() \
do { \
reportln("\n=={}== Unimplemented instruction: {}\n"sv, getpid(), __FUNCTION__); \
m_emulator.dump_backtrace(); \
_exit(0); \
} while (0)
template<typename T>
ALWAYS_INLINE void warn_if_uninitialized(T value_with_shadow, char const* message)
{
if (value_with_shadow.is_uninitialized()) [[unlikely]] {
reportln("\033[31;1mWarning! Use of uninitialized value: {}\033[0m\n", message);
reportln("\033[31;1mWarning! Use of uninitialized value: {}\033[0m\n"sv, message);
UserspaceEmulator::Emulator::the().dump_backtrace();
}
}
@ -41,14 +41,14 @@ namespace UserspaceEmulator { // NOLINT(readability-implicit-bool-conversion) 0/
ALWAYS_INLINE void SoftFPU::warn_if_mmx_absolute(u8 index) const
{
if (m_reg_is_mmx[index]) [[unlikely]] {
reportln("\033[31;1mWarning! Use of an MMX register as an FPU value ({} abs)\033[0m\n", index);
reportln("\033[31;1mWarning! Use of an MMX register as an FPU value ({} abs)\033[0m\n"sv, index);
m_emulator.dump_backtrace();
}
}
ALWAYS_INLINE void SoftFPU::warn_if_fpu_absolute(u8 index) const
{
if (!m_reg_is_mmx[index]) [[unlikely]] {
reportln("\033[31;1mWarning! Use of an FPU value ({} abs) as an MMX register\033[0m\n", index);
reportln("\033[31;1mWarning! Use of an FPU value ({} abs) as an MMX register\033[0m\n"sv, index);
m_emulator.dump_backtrace();
}
}
@ -161,7 +161,7 @@ ALWAYS_INLINE void SoftFPU::fpu_set_exception(FPU_Exception ex)
// the previous eip
// FIXME: Call FPU Exception handler
reportln("Trying to call Exception handler from {}", fpu_exception_string(ex));
reportln("Trying to call Exception handler from {}"sv, fpu_exception_string(ex));
fpu_dump_env();
m_emulator.dump_backtrace();
TODO();

View file

@ -87,7 +87,7 @@ private:
void fpu_dump_env()
{
reportln("Exceptions: #I:{} #D:{} #Z:{} #O:{} #U:{} #P:{} #SF:{} Summary:{}",
reportln("Exceptions: #I:{} #D:{} #Z:{} #O:{} #U:{} #P:{} #SF:{} Summary:{}"sv,
m_fpu_error_invalid,
m_fpu_error_denorm,
m_fpu_error_zero_div,
@ -96,18 +96,18 @@ private:
m_fpu_error_precision,
m_fpu_error_stackfault,
m_fpu_error_summary);
reportln("Masks: #I:{} #D:{} #Z:{} #O:{} #U:{} #P:{}",
reportln("Masks: #I:{} #D:{} #Z:{} #O:{} #U:{} #P:{}"sv,
m_fpu_cw.mask_invalid,
m_fpu_cw.mask_denorm,
m_fpu_cw.mask_zero_div,
m_fpu_cw.mask_overflow,
m_fpu_cw.mask_underflow,
m_fpu_cw.mask_precision);
reportln("C0:{} C1:{} C2:{} C3:{}", c0(), c1(), c2(), c3());
reportln("fpu-stacktop: {}", m_fpu_stack_top);
reportln("fpu-stack /w stacktop (real):");
reportln("C0:{} C1:{} C2:{} C3:{}"sv, c0(), c1(), c2(), c3());
reportln("fpu-stacktop: {}"sv, m_fpu_stack_top);
reportln("fpu-stack /w stacktop (real):"sv);
for (u8 i = 0; i < 8; ++i) {
reportln("\t{} ({}): fp {} ({}), mmx {:016x}",
reportln("\t{} ({}): fp {} ({}), mmx {:016x}"sv,
i, (u8)((m_fpu_stack_top + i) % 8),
m_storage[(m_fpu_stack_top + i) % 8].fp, fpu_is_set(i) ? "set" : "free",
m_storage[(m_fpu_stack_top + i) % 8].mmx.raw);
@ -142,14 +142,14 @@ private:
ALWAYS_INLINE void fpu_set_stack_overflow()
{
reportln("Stack Overflow");
reportln("Stack Overflow"sv);
set_c1(1);
fpu_set_exception(FPU_Exception::StackFault);
}
ALWAYS_INLINE void fpu_set_stack_underflow()
{
reportln("Stack Underflow");
reportln("Stack Underflow"sv);
set_c1(0);
fpu_set_exception(FPU_Exception::StackFault);
}

View file

@ -94,13 +94,13 @@ ValueWithShadow<u8> SoftMMU::read8(X86::LogicalAddress address)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::read8: No region for @ {:p}", address.offset());
reportln("SoftMMU::read8: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_readable()) {
reportln("SoftMMU::read8: Non-readable region @ {:p}", address.offset());
reportln("SoftMMU::read8: Non-readable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -112,13 +112,13 @@ ValueWithShadow<u16> SoftMMU::read16(X86::LogicalAddress address)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::read16: No region for @ {:p}", address.offset());
reportln("SoftMMU::read16: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_readable()) {
reportln("SoftMMU::read16: Non-readable region @ {:p}", address.offset());
reportln("SoftMMU::read16: Non-readable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -130,13 +130,13 @@ ValueWithShadow<u32> SoftMMU::read32(X86::LogicalAddress address)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::read32: No region for @ {:04x}:{:p}", address.selector(), address.offset());
reportln("SoftMMU::read32: No region for @ {:04x}:{:p}"sv, address.selector(), address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_readable()) {
reportln("SoftMMU::read32: Non-readable region @ {:p}", address.offset());
reportln("SoftMMU::read32: Non-readable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -148,13 +148,13 @@ ValueWithShadow<u64> SoftMMU::read64(X86::LogicalAddress address)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::read64: No region for @ {:p}", address.offset());
reportln("SoftMMU::read64: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_readable()) {
reportln("SoftMMU::read64: Non-readable region @ {:p}", address.offset());
reportln("SoftMMU::read64: Non-readable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -166,13 +166,13 @@ ValueWithShadow<u128> SoftMMU::read128(X86::LogicalAddress address)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::read128: No region for @ {:p}", address.offset());
reportln("SoftMMU::read128: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_readable()) {
reportln("SoftMMU::read128: Non-readable region @ {:p}", address.offset());
reportln("SoftMMU::read128: Non-readable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -184,13 +184,13 @@ ValueWithShadow<u256> SoftMMU::read256(X86::LogicalAddress address)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::read256: No region for @ {:p}", address.offset());
reportln("SoftMMU::read256: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_readable()) {
reportln("SoftMMU::read256: Non-readable region @ {:p}", address.offset());
reportln("SoftMMU::read256: Non-readable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -202,13 +202,13 @@ void SoftMMU::write8(X86::LogicalAddress address, ValueWithShadow<u8> value)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::write8: No region for @ {:p}", address.offset());
reportln("SoftMMU::write8: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_writable()) {
reportln("SoftMMU::write8: Non-writable region @ {:p}", address.offset());
reportln("SoftMMU::write8: Non-writable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -219,13 +219,13 @@ void SoftMMU::write16(X86::LogicalAddress address, ValueWithShadow<u16> value)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::write16: No region for @ {:p}", address.offset());
reportln("SoftMMU::write16: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_writable()) {
reportln("SoftMMU::write16: Non-writable region @ {:p}", address.offset());
reportln("SoftMMU::write16: Non-writable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -237,13 +237,13 @@ void SoftMMU::write32(X86::LogicalAddress address, ValueWithShadow<u32> value)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::write32: No region for @ {:p}", address.offset());
reportln("SoftMMU::write32: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_writable()) {
reportln("SoftMMU::write32: Non-writable region @ {:p}", address.offset());
reportln("SoftMMU::write32: Non-writable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -255,13 +255,13 @@ void SoftMMU::write64(X86::LogicalAddress address, ValueWithShadow<u64> value)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::write64: No region for @ {:p}", address.offset());
reportln("SoftMMU::write64: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_writable()) {
reportln("SoftMMU::write64: Non-writable region @ {:p}", address.offset());
reportln("SoftMMU::write64: Non-writable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -273,13 +273,13 @@ void SoftMMU::write128(X86::LogicalAddress address, ValueWithShadow<u128> value)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::write128: No region for @ {:p}", address.offset());
reportln("SoftMMU::write128: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_writable()) {
reportln("SoftMMU::write128: Non-writable region @ {:p}", address.offset());
reportln("SoftMMU::write128: Non-writable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
@ -291,13 +291,13 @@ void SoftMMU::write256(X86::LogicalAddress address, ValueWithShadow<u256> value)
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::write256: No region for @ {:p}", address.offset());
reportln("SoftMMU::write256: No region for @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}
if (!region->is_writable()) {
reportln("SoftMMU::write256: Non-writable region @ {:p}", address.offset());
reportln("SoftMMU::write256: Non-writable region @ {:p}"sv, address.offset());
m_emulator.dump_backtrace();
TODO();
}

View file

@ -37,13 +37,13 @@ public:
{
auto* region = find_region(address);
if (!region) {
reportln("SoftMMU::read256: No region for @ {:p}", address.offset());
reportln("SoftMMU::read256: No region for @ {:p}"sv, address.offset());
dump_backtrace();
TODO();
}
if (!region->is_readable()) {
reportln("SoftMMU::read256: Non-readable region @ {:p}", address.offset());
reportln("SoftMMU::read256: Non-readable region @ {:p}"sv, address.offset());
dump_backtrace();
TODO();
}

View file

@ -51,7 +51,7 @@ int main(int argc, char** argv, char** env)
else
executable_path = Core::find_executable_in_path(arguments[0]);
if (executable_path.is_empty()) {
reportln("Cannot find executable for '{}'.", arguments[0]);
reportln("Cannot find executable for '{}'."sv, arguments[0]);
return 1;
}
@ -98,7 +98,7 @@ int main(int argc, char** argv, char** env)
return 1;
StringBuilder builder;
builder.append("(UE) ");
builder.append("(UE) "sv);
builder.append(LexicalPath::basename(arguments[0]));
if (set_process_name(builder.string_view().characters_without_null_termination(), builder.string_view().length()) < 0) {
perror("set_process_name");
@ -106,7 +106,7 @@ int main(int argc, char** argv, char** env)
}
int rc = pthread_setname_np(pthread_self(), builder.to_string().characters());
if (rc != 0) {
reportln("pthread_setname_np: {}", strerror(rc));
reportln("pthread_setname_np: {}"sv, strerror(rc));
return 1;
}