diff options
Diffstat (limited to 'Userland/Applications')
7 files changed, 31 insertions, 31 deletions
diff --git a/Userland/Applications/Browser/CookieJar.cpp b/Userland/Applications/Browser/CookieJar.cpp index 67e7fcce7a..2cdab6aea6 100644 --- a/Userland/Applications/Browser/CookieJar.cpp +++ b/Userland/Applications/Browser/CookieJar.cpp @@ -21,16 +21,16 @@ String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source) if (!domain.has_value()) return {}; - Vector<Web::Cookie::Cookie*> cookie_list = get_matching_cookies(url, domain.value(), source); + auto cookie_list = get_matching_cookies(url, domain.value(), source); StringBuilder builder; - for (const auto* cookie : cookie_list) { + for (const auto& cookie : cookie_list) { // If there is an unprocessed cookie in the cookie-list, output the characters %x3B and %x20 ("; ") if (!builder.is_empty()) builder.append("; "); // Output the cookie's name, the %x3D ("=") character, and the cookie's value. - builder.appendff("{}={}", cookie->name, cookie->value); + builder.appendff("{}={}", cookie.name, cookie.value); } return builder.build(); @@ -238,14 +238,14 @@ void CookieJar::store_cookie(const Web::Cookie::ParsedCookie& parsed_cookie, con m_cookies.set(key, move(cookie)); } -Vector<Web::Cookie::Cookie*> CookieJar::get_matching_cookies(const URL& url, const String& canonicalized_domain, Web::Cookie::Source source) +Vector<Web::Cookie::Cookie&> CookieJar::get_matching_cookies(const URL& url, const String& canonicalized_domain, Web::Cookie::Source source) { // https://tools.ietf.org/html/rfc6265#section-5.4 auto now = Core::DateTime::now(); // 1. Let cookie-list be the set of cookies from the cookie store that meets all of the following requirements: - Vector<Web::Cookie::Cookie*> cookie_list; + Vector<Web::Cookie::Cookie&> cookie_list; for (auto& cookie : m_cookies) { // Either: The cookie's host-only-flag is true and the canonicalized request-host is identical to the cookie's domain. @@ -270,11 +270,11 @@ Vector<Web::Cookie::Cookie*> CookieJar::get_matching_cookies(const URL& url, con // 2. The user agent SHOULD sort the cookie-list in the following order: // - Cookies with longer paths are listed before cookies with shorter paths. // - Among cookies that have equal-length path fields, cookies with earlier creation-times are listed before cookies with later creation-times. - cookie_list.insert_before_matching(&cookie.value, [&cookie](auto* entry) { - if (cookie.value.path.length() > entry->path.length()) { + cookie_list.insert_before_matching(cookie.value, [&cookie](auto& entry) { + if (cookie.value.path.length() > entry.path.length()) { return true; - } else if (cookie.value.path.length() == entry->path.length()) { - if (cookie.value.creation_time.timestamp() < entry->creation_time.timestamp()) + } else if (cookie.value.path.length() == entry.path.length()) { + if (cookie.value.creation_time.timestamp() < entry.creation_time.timestamp()) return true; } return false; diff --git a/Userland/Applications/Browser/CookieJar.h b/Userland/Applications/Browser/CookieJar.h index 2ca8ffc673..b93ce44a95 100644 --- a/Userland/Applications/Browser/CookieJar.h +++ b/Userland/Applications/Browser/CookieJar.h @@ -37,7 +37,7 @@ private: static String default_path(const URL& url); void store_cookie(const Web::Cookie::ParsedCookie& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source); - Vector<Web::Cookie::Cookie*> get_matching_cookies(const URL& url, const String& canonicalized_domain, Web::Cookie::Source source); + Vector<Web::Cookie::Cookie&> get_matching_cookies(const URL& url, const String& canonicalized_domain, Web::Cookie::Source source); void purge_expired_cookies(); HashMap<CookieStorageKey, Web::Cookie::Cookie> m_cookies; diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index 3a06fd5585..49a625cf75 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -136,9 +136,9 @@ void KeyboardMapperWidget::load_from_file(String filename) m_character_map = result.value(); set_current_map("map"); - for (Widget* widget : m_map_group->child_widgets()) { - auto radio_button = (GUI::RadioButton*)widget; - radio_button->set_checked(radio_button->name() == "map"); + for (auto& widget : m_map_group->child_widgets()) { + auto& radio_button = static_cast<GUI::RadioButton&>(widget); + radio_button.set_checked(radio_button.name() == "map"); } update_window_title(); @@ -153,9 +153,9 @@ void KeyboardMapperWidget::load_from_system() m_character_map = result.value().character_map_data(); set_current_map("map"); - for (Widget* widget : m_map_group->child_widgets()) { - auto radio_button = (GUI::RadioButton*)widget; - radio_button->set_checked(radio_button->name() == "map"); + for (auto& widget : m_map_group->child_widgets()) { + auto& radio_button = static_cast<GUI::RadioButton&>(widget); + radio_button.set_checked(radio_button.name() == "map"); } update_window_title(); diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp index a1b6b9b75e..4365ba222c 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -112,14 +112,14 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po for (auto& type_name : CellType::names()) g_types.append(type_name); - Vector<Cell*> cells; + Vector<Cell&> cells; for (auto& position : positions) { if (auto cell = sheet.at(position)) - cells.append(cell); + cells.append(*cell); } if (cells.size() == 1) { - auto& cell = *cells.first(); + auto& cell = cells.first(); m_format = cell.type_metadata().format; m_length = cell.type_metadata().length; m_type = &cell.type(); diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index 1e3dce5e8f..42186bcebc 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -115,18 +115,18 @@ void Sheet::update() return; } m_visited_cells_in_update.clear(); - Vector<Cell*> cells_copy; + Vector<Cell&> cells_copy; // Grab a copy as updates might insert cells into the table. for (auto& it : m_cells) { if (it.value->dirty()) { - cells_copy.append(it.value); + cells_copy.append(*it.value); m_workbook.set_dirty(true); } } for (auto& cell : cells_copy) - update(*cell); + update(cell); m_visited_cells_in_update.clear(); } diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index 3401819baa..db30b7b55b 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -171,11 +171,11 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets) m_current_cell_label->set_enabled(true); m_current_cell_label->set_text(builder.string_view()); - Vector<Cell*> cells; + Vector<Cell&> cells; for (auto& position : selection) - cells.append(&sheet.ensure(position)); + cells.append(sheet.ensure(position)); - auto first_cell = cells.first(); + auto& first_cell = cells.first(); m_cell_value_editor->on_change = nullptr; m_cell_value_editor->set_text(""); m_should_change_selected_cells = false; @@ -191,14 +191,14 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets) // FIXME: Lines? auto offset = m_cell_value_editor->cursor().column(); try_generate_tip_for_input_expression(text, offset); - for (auto* cell : cells) - cell->set_data(text); + for (auto& cell : cells) + cell.set_data(text); sheet.update(); update(); } }; m_cell_value_editor->set_enabled(true); - static_cast<CellSyntaxHighlighter*>(const_cast<Syntax::Highlighter*>(m_cell_value_editor->syntax_highlighter()))->set_cell(first_cell); + static_cast<CellSyntaxHighlighter*>(const_cast<Syntax::Highlighter*>(m_cell_value_editor->syntax_highlighter()))->set_cell(&first_cell); }; m_selected_view->on_selection_dropped = [&]() { m_cell_value_editor->set_enabled(false); diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index 41155e5055..7fb83efd5e 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -663,7 +663,7 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab() cpu_graph_group_box.set_layout<GUI::HorizontalBoxLayout>(); cpu_graph_group_box.layout()->set_margins({ 6, 16, 6, 6 }); cpu_graph_group_box.set_fixed_height(120); - Vector<GraphWidget*> cpu_graphs; + Vector<GraphWidget&> cpu_graphs; for (size_t i = 0; i < ProcessModel::the().cpus().size(); i++) { auto& cpu_graph = cpu_graph_group_box.add<GraphWidget>(); cpu_graph.set_max(100); @@ -679,12 +679,12 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab() return String::formatted("Kernel: {}%", value); }, }); - cpu_graphs.append(&cpu_graph); + cpu_graphs.append(cpu_graph); } ProcessModel::the().on_cpu_info_change = [cpu_graphs](const NonnullOwnPtrVector<ProcessModel::CpuInfo>& cpus) { float sum_cpu = 0; for (size_t i = 0; i < cpus.size(); ++i) { - cpu_graphs[i]->add_value({ (int)cpus[i].total_cpu_percent, (int)cpus[i].total_cpu_percent_kernel }); + cpu_graphs[i].add_value({ (int)cpus[i].total_cpu_percent, (int)cpus[i].total_cpu_percent_kernel }); sum_cpu += cpus[i].total_cpu_percent; } float cpu_usage = sum_cpu / (float)cpus.size(); |