diff --git a/AK/TypeList.h b/AK/TypeList.h index c1ee868c0e1..eb8377a9a99 100644 --- a/AK/TypeList.h +++ b/AK/TypeList.h @@ -39,10 +39,10 @@ struct TypeWrapper { using Type = T; }; -template -constexpr void for_each_type_impl(F&& f, IndexSequence) +template +constexpr void for_each_type_impl(F&& f, IndexSequence) { - (forward(f)(TypeWrapper> {}), ...); + (forward(f)(TypeWrapper> {}), ...); } template @@ -51,10 +51,10 @@ constexpr void for_each_type(F&& f) for_each_type_impl(forward(f), MakeIndexSequence {}); } -template -constexpr void for_each_type_zipped_impl(F&& f, IndexSequence) +template +constexpr void for_each_type_zipped_impl(F&& f, IndexSequence) { - (forward(f)(TypeWrapper> {}, TypeWrapper> {}), ...); + (forward(f)(TypeWrapper> {}, TypeWrapper> {}), ...); } template diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 9b03792f541..6e03f441517 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -208,32 +208,32 @@ Ext2FS::BlockListShape Ext2FS::compute_block_list_shape(unsigned blocks) const return shape; } -KResult Ext2FSInode::write_indirect_block(BlockBasedFS::BlockIndex block, Span blocks_indexes) +KResult Ext2FSInode::write_indirect_block(BlockBasedFS::BlockIndex block, Span blocks_indices) { const auto entries_per_block = EXT2_ADDR_PER_BLOCK(&fs().super_block()); - VERIFY(blocks_indexes.size() <= entries_per_block); + VERIFY(blocks_indices.size() <= entries_per_block); auto block_contents = ByteBuffer::create_uninitialized(fs().block_size()); OutputMemoryStream stream { block_contents }; auto buffer = UserOrKernelBuffer::for_kernel_buffer(stream.data()); - VERIFY(blocks_indexes.size() <= EXT2_ADDR_PER_BLOCK(&fs().super_block())); - for (unsigned i = 0; i < blocks_indexes.size(); ++i) - stream << static_cast(blocks_indexes[i].value()); + VERIFY(blocks_indices.size() <= EXT2_ADDR_PER_BLOCK(&fs().super_block())); + for (unsigned i = 0; i < blocks_indices.size(); ++i) + stream << static_cast(blocks_indices[i].value()); stream.fill_to_end(0); return fs().write_block(block, buffer, stream.size()); } -KResult Ext2FSInode::grow_doubly_indirect_block(BlockBasedFS::BlockIndex block, size_t old_blocks_length, Span blocks_indexes, Vector& new_meta_blocks, unsigned& meta_blocks) +KResult Ext2FSInode::grow_doubly_indirect_block(BlockBasedFS::BlockIndex block, size_t old_blocks_length, Span blocks_indices, Vector& new_meta_blocks, unsigned& meta_blocks) { const auto entries_per_block = EXT2_ADDR_PER_BLOCK(&fs().super_block()); const auto entries_per_doubly_indirect_block = entries_per_block * entries_per_block; const auto old_indirect_blocks_length = divide_rounded_up(old_blocks_length, entries_per_block); - const auto new_indirect_blocks_length = divide_rounded_up(blocks_indexes.size(), entries_per_block); - VERIFY(blocks_indexes.size() > 0); - VERIFY(blocks_indexes.size() > old_blocks_length); - VERIFY(blocks_indexes.size() <= entries_per_doubly_indirect_block); + const auto new_indirect_blocks_length = divide_rounded_up(blocks_indices.size(), entries_per_block); + VERIFY(blocks_indices.size() > 0); + VERIFY(blocks_indices.size() > old_blocks_length); + VERIFY(blocks_indices.size() <= entries_per_doubly_indirect_block); auto block_contents = ByteBuffer::create_uninitialized(fs().block_size()); auto* block_as_pointers = (unsigned*)block_contents.data(); @@ -259,7 +259,7 @@ KResult Ext2FSInode::grow_doubly_indirect_block(BlockBasedFS::BlockIndex block, // Write out the indirect blocks. for (unsigned i = old_blocks_length / entries_per_block; i < new_indirect_blocks_length; i++) { const auto offset_block = i * entries_per_block; - if (auto result = write_indirect_block(block_as_pointers[i], blocks_indexes.slice(offset_block, min(blocks_indexes.size() - offset_block, entries_per_block))); result.is_error()) + if (auto result = write_indirect_block(block_as_pointers[i], blocks_indices.slice(offset_block, min(blocks_indices.size() - offset_block, entries_per_block))); result.is_error()) return result; } @@ -302,16 +302,16 @@ KResult Ext2FSInode::shrink_doubly_indirect_block(BlockBasedFS::BlockIndex block return KSuccess; } -KResult Ext2FSInode::grow_triply_indirect_block(BlockBasedFS::BlockIndex block, size_t old_blocks_length, Span blocks_indexes, Vector& new_meta_blocks, unsigned& meta_blocks) +KResult Ext2FSInode::grow_triply_indirect_block(BlockBasedFS::BlockIndex block, size_t old_blocks_length, Span blocks_indices, Vector& new_meta_blocks, unsigned& meta_blocks) { const auto entries_per_block = EXT2_ADDR_PER_BLOCK(&fs().super_block()); const auto entries_per_doubly_indirect_block = entries_per_block * entries_per_block; const auto entries_per_triply_indirect_block = entries_per_block * entries_per_block; const auto old_doubly_indirect_blocks_length = divide_rounded_up(old_blocks_length, entries_per_doubly_indirect_block); - const auto new_doubly_indirect_blocks_length = divide_rounded_up(blocks_indexes.size(), entries_per_doubly_indirect_block); - VERIFY(blocks_indexes.size() > 0); - VERIFY(blocks_indexes.size() > old_blocks_length); - VERIFY(blocks_indexes.size() <= entries_per_triply_indirect_block); + const auto new_doubly_indirect_blocks_length = divide_rounded_up(blocks_indices.size(), entries_per_doubly_indirect_block); + VERIFY(blocks_indices.size() > 0); + VERIFY(blocks_indices.size() > old_blocks_length); + VERIFY(blocks_indices.size() <= entries_per_triply_indirect_block); auto block_contents = ByteBuffer::create_uninitialized(fs().block_size()); auto* block_as_pointers = (unsigned*)block_contents.data(); @@ -338,8 +338,8 @@ KResult Ext2FSInode::grow_triply_indirect_block(BlockBasedFS::BlockIndex block, for (unsigned i = old_blocks_length / entries_per_doubly_indirect_block; i < new_doubly_indirect_blocks_length; i++) { const auto processed_blocks = i * entries_per_doubly_indirect_block; const auto old_doubly_indirect_blocks_length = min(old_blocks_length > processed_blocks ? old_blocks_length - processed_blocks : 0, entries_per_doubly_indirect_block); - const auto new_doubly_indirect_blocks_length = min(blocks_indexes.size() > processed_blocks ? blocks_indexes.size() - processed_blocks : 0, entries_per_doubly_indirect_block); - if (auto result = grow_doubly_indirect_block(block_as_pointers[i], old_doubly_indirect_blocks_length, blocks_indexes.slice(processed_blocks, new_doubly_indirect_blocks_length), new_meta_blocks, meta_blocks); result.is_error()) + const auto new_doubly_indirect_blocks_length = min(blocks_indices.size() > processed_blocks ? blocks_indices.size() - processed_blocks : 0, entries_per_doubly_indirect_block); + if (auto result = grow_doubly_indirect_block(block_as_pointers[i], old_doubly_indirect_blocks_length, blocks_indices.slice(processed_blocks, new_doubly_indirect_blocks_length), new_meta_blocks, meta_blocks); result.is_error()) return result; } diff --git a/Kernel/Storage/AHCI.h b/Kernel/Storage/AHCI.h index e97da201c5f..d014aa0ecdc 100644 --- a/Kernel/Storage/AHCI.h +++ b/Kernel/Storage/AHCI.h @@ -161,15 +161,15 @@ public: Vector to_vector() const { // FIXME: Add a sync mechanism! - Vector indexes; + Vector indices; u32 bitfield = m_bitfield & m_bit_mask; for (size_t index = 0; index < 32; index++) { if (bitfield & 1) { - indexes.append(index); + indices.append(index); } bitfield >>= 1; } - return indexes; + return indices; } u32 bit_mask() const { return m_bit_mask; }; diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index 6e66ee9b4e4..614fe41edab 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -343,7 +343,7 @@ DirectoryView::~DirectoryView() void DirectoryView::model_did_update(unsigned flags) { - if (flags & GUI::Model::UpdateFlag::InvalidateAllIndexes) { + if (flags & GUI::Model::UpdateFlag::InvalidateAllIndices) { for_each_view_implementation([](auto& view) { view.selection().clear(); }); diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp index 38facd13159..142c27f3fd9 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -152,7 +152,7 @@ void SheetModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& valu void SheetModel::update() { m_sheet->update(); - did_update(UpdateFlag::DontInvalidateIndexes); + did_update(UpdateFlag::DontInvalidateIndices); } } diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp index 92957d17040..42b57cbf3a0 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp @@ -191,7 +191,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet) m_table_view->on_selection_change = [&] { m_sheet->selected_cells().clear(); - for (auto& index : m_table_view->selection().indexes()) { + for (auto& index : m_table_view->selection().indices()) { Position position { (size_t)index.column(), (size_t)index.row() }; m_sheet->selected_cells().set(position); } @@ -201,7 +201,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet) Vector selected_positions; selected_positions.ensure_capacity(m_table_view->selection().size()); - for (auto& selection : m_table_view->selection().indexes()) + for (auto& selection : m_table_view->selection().indices()) selected_positions.empend((size_t)selection.column(), (size_t)selection.row()); if (on_selection_changed) { @@ -222,7 +222,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet) m_cell_range_context_menu = GUI::Menu::construct(); m_cell_range_context_menu->add_action(GUI::Action::create("Type and Formatting...", [this](auto&) { Vector positions; - for (auto& index : m_table_view->selection().indexes()) { + for (auto& index : m_table_view->selection().indices()) { Position position { (size_t)index.column(), (size_t)index.row() }; positions.append(move(position)); } @@ -295,7 +295,7 @@ void SpreadsheetView::show_event(GUI::ShowEvent&) if (on_selection_changed && !m_table_view->selection().is_empty()) { Vector selected_positions; selected_positions.ensure_capacity(m_table_view->selection().size()); - for (auto& selection : m_table_view->selection().indexes()) + for (auto& selection : m_table_view->selection().indices()) selected_positions.empend((size_t)selection.column(), (size_t)selection.row()); on_selection_changed(move(selected_positions)); diff --git a/Userland/Applications/SystemMonitor/ProcessModel.cpp b/Userland/Applications/SystemMonitor/ProcessModel.cpp index 32f2e8576b5..6b625d748f1 100644 --- a/Userland/Applications/SystemMonitor/ProcessModel.cpp +++ b/Userland/Applications/SystemMonitor/ProcessModel.cpp @@ -416,7 +416,7 @@ void ProcessModel::update() if (on_state_update) on_state_update(all_processes->size(), m_threads.size()); - // FIXME: This is a rather hackish way of invalidating indexes. - // It would be good if GUI::Model had a way to orchestrate removal/insertion while preserving indexes. - did_update(previous_tid_count == m_tids.size() ? GUI::Model::UpdateFlag::DontInvalidateIndexes : GUI::Model::UpdateFlag::InvalidateAllIndexes); + // FIXME: This is a rather hackish way of invalidating indices. + // It would be good if GUI::Model had a way to orchestrate removal/insertion while preserving indices. + did_update(previous_tid_count == m_tids.size() ? GUI::Model::UpdateFlag::DontInvalidateIndices : GUI::Model::UpdateFlag::InvalidateAllIndices); } diff --git a/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp b/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp index c7a0b6b8f38..dea0b5e7d6c 100644 --- a/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp @@ -54,7 +54,7 @@ public: virtual void update() override { - did_update(GUI::Model::DontInvalidateIndexes); + did_update(GUI::Model::DontInvalidateIndices); } virtual void model_did_update([[maybe_unused]] unsigned flags) override diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.cpp b/Userland/DevTools/Profiler/IndividualSampleModel.cpp index 77118d1d0c3..d3e7823d454 100644 --- a/Userland/DevTools/Profiler/IndividualSampleModel.cpp +++ b/Userland/DevTools/Profiler/IndividualSampleModel.cpp @@ -67,5 +67,5 @@ GUI::Variant IndividualSampleModel::data(const GUI::ModelIndex& index, GUI::Mode void IndividualSampleModel::update() { - did_update(Model::InvalidateAllIndexes); + did_update(Model::InvalidateAllIndices); } diff --git a/Userland/DevTools/Profiler/ProfileModel.cpp b/Userland/DevTools/Profiler/ProfileModel.cpp index 3e9aa67b15b..2b77e38b75e 100644 --- a/Userland/DevTools/Profiler/ProfileModel.cpp +++ b/Userland/DevTools/Profiler/ProfileModel.cpp @@ -127,5 +127,5 @@ GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol void ProfileModel::update() { - did_update(Model::InvalidateAllIndexes); + did_update(Model::InvalidateAllIndices); } diff --git a/Userland/DevTools/Profiler/SamplesModel.cpp b/Userland/DevTools/Profiler/SamplesModel.cpp index e46866e9562..e4cae4ab1b3 100644 --- a/Userland/DevTools/Profiler/SamplesModel.cpp +++ b/Userland/DevTools/Profiler/SamplesModel.cpp @@ -89,5 +89,5 @@ GUI::Variant SamplesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol void SamplesModel::update() { - did_update(Model::InvalidateAllIndexes); + did_update(Model::InvalidateAllIndices); } diff --git a/Userland/Libraries/LibC/elf.h b/Userland/Libraries/LibC/elf.h index 6e3bcf729c9..342dbd1f2ef 100644 --- a/Userland/Libraries/LibC/elf.h +++ b/Userland/Libraries/LibC/elf.h @@ -67,7 +67,7 @@ typedef uint32_t Elf64_Half; typedef uint16_t Elf64_Quarter; /* - * e_ident[] identification indexes + * e_ident[] identification indices * See http://www.sco.com/developers/gabi/latest/ch4.eheader.html */ #define EI_MAG0 0 /* file ID */ @@ -241,15 +241,15 @@ typedef struct { Elf64_Xword sh_entsize; /* table entry size */ } Elf64_Shdr; -/* Special Section Indexes */ +/* Special Section Indices */ #define SHN_UNDEF 0 /* undefined */ -#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ +#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indices */ #define SHN_LOPROC 0xff00 /* reserved range for processor */ -#define SHN_HIPROC 0xff1f /* specific section indexes */ +#define SHN_HIPROC 0xff1f /* specific section indices */ #define SHN_ABS 0xfff1 /* absolute value */ #define SHN_COMMON 0xfff2 /* common symbol */ #define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere. */ -#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ +#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indices */ /* sh_type */ #define SHT_NULL 0 /* inactive */ @@ -269,7 +269,7 @@ typedef struct { #define SHT_FINI_ARRAY 15 /* pointers to termination functions */ #define SHT_PREINIT_ARRAY 16 /* ptrs to funcs called before init */ #define SHT_GROUP 17 /* defines a section group */ -#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX). */ +#define SHT_SYMTAB_SHNDX 18 /* Section indices (see SHN_XINDEX). */ #define SHT_LOOS 0x60000000 /* reserved range for OS specific */ #define SHT_SUNW_dof 0x6ffffff4 /* used by dtrace */ #define SHT_GNU_LIBLIST 0x6ffffff7 /* libraries to be prelinked */ @@ -282,7 +282,7 @@ typedef struct { #define SHT_LOPROC 0x70000000 /* reserved range for processor */ #define SHT_HIPROC 0x7fffffff /* specific section header types */ #define SHT_LOUSER 0x80000000 /* reserved range for application */ -#define SHT_HIUSER 0xffffffff /* specific indexes */ +#define SHT_HIUSER 0xffffffff /* specific indices */ #define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table section */ diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp index 989c6ec1c25..5f7408800a7 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp @@ -578,7 +578,7 @@ FLATTEN void UnsignedBigInteger::shift_left_without_allocation( * Complexity: O(N^2) where N is the number of words in the larger number * Multiplication method: * An integer is equal to the sum of the powers of two - * according to the indexes of its 'on' bits. + * according to the indices of its 'on' bits. * So to multiple x*y, we go over each '1' bit in x (say the i'th bit), * and add y< model) m_model = move(model); if (m_model) m_model->register_view({}, *this); - model_did_update(GUI::Model::InvalidateAllIndexes); + model_did_update(GUI::Model::InvalidateAllIndices); scroll_to_top(); } void AbstractView::model_did_update(unsigned int flags) { - if (!model() || (flags & GUI::Model::InvalidateAllIndexes)) { + if (!model() || (flags & GUI::Model::InvalidateAllIndices)) { stop_editing(); m_edit_index = {}; m_hovered_index = {}; @@ -630,9 +630,9 @@ void AbstractView::do_search(String&& searching) return; } - auto found_indexes = model()->matches(searching, Model::MatchesFlag::FirstMatchOnly | Model::MatchesFlag::MatchAtStart | Model::MatchesFlag::CaseInsensitive, model()->parent_index(cursor_index())); - if (!found_indexes.is_empty() && found_indexes[0].is_valid()) { - auto& index = found_indexes[0]; + auto found_indices = model()->matches(searching, Model::MatchesFlag::FirstMatchOnly | Model::MatchesFlag::MatchAtStart | Model::MatchesFlag::CaseInsensitive, model()->parent_index(cursor_index())); + if (!found_indices.is_empty() && found_indices[0].is_valid()) { + auto& index = found_indices[0]; m_highlighted_search_index = index; m_searching = move(searching); set_selection(index); diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index dd55c4eca22..4b63d818056 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -629,17 +629,17 @@ Vector FileSystemModel::matches(const StringView& searching, unsi { Node& node = const_cast(this->node(index)); node.reify_if_needed(); - Vector found_indexes; + Vector found_indices; for (auto& child : node.children) { if (string_matches(child.name, searching, flags)) { const_cast(child).reify_if_needed(); - found_indexes.append(child.index(Column::Name)); + found_indices.append(child.index(Column::Name)); if (flags & FirstMatchOnly) break; } } - return found_indexes; + return found_indices; } } diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp index b36a2d73fa8..229e193a700 100644 --- a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp +++ b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp @@ -106,10 +106,10 @@ bool FilteringProxyModel::is_searchable() const Vector FilteringProxyModel::matches(const StringView& searching, unsigned flags, const ModelIndex& index) { - auto found_indexes = m_model.matches(searching, flags, index); - for (size_t i = 0; i < found_indexes.size(); i++) - found_indexes[i] = map(found_indexes[i]); - return found_indexes; + auto found_indices = m_model.matches(searching, flags, index); + for (size_t i = 0; i < found_indices.size(); i++) + found_indices[i] = map(found_indices[i]); + return found_indices; } } diff --git a/Userland/Libraries/LibGUI/IconView.cpp b/Userland/Libraries/LibGUI/IconView.cpp index b0c13387f66..2506fb190b3 100644 --- a/Userland/Libraries/LibGUI/IconView.cpp +++ b/Userland/Libraries/LibGUI/IconView.cpp @@ -122,7 +122,7 @@ auto IconView::item_data_from_content_position(const Gfx::IntPoint& content_posi void IconView::model_did_update(unsigned flags) { AbstractView::model_did_update(flags); - if (!model() || (flags & GUI::Model::InvalidateAllIndexes)) { + if (!model() || (flags & GUI::Model::InvalidateAllIndices)) { m_item_data_cache.clear(); AbstractView::clear_selection(); m_selected_count_cache = 0; diff --git a/Userland/Libraries/LibGUI/Model.h b/Userland/Libraries/LibGUI/Model.h index a34256f3e6d..8a314c45633 100644 --- a/Userland/Libraries/LibGUI/Model.h +++ b/Userland/Libraries/LibGUI/Model.h @@ -37,8 +37,8 @@ public: class Model : public RefCounted { public: enum UpdateFlag { - DontInvalidateIndexes = 0, - InvalidateAllIndexes = 1 << 0, + DontInvalidateIndices = 0, + InvalidateAllIndices = 1 << 0, }; enum MatchesFlag { @@ -88,7 +88,7 @@ protected: Model(); void for_each_view(Function); - void did_update(unsigned flags = UpdateFlag::InvalidateAllIndexes); + void did_update(unsigned flags = UpdateFlag::InvalidateAllIndices); static bool string_matches(const StringView& str, const StringView& needle, unsigned flags) { diff --git a/Userland/Libraries/LibGUI/ModelSelection.cpp b/Userland/Libraries/LibGUI/ModelSelection.cpp index c4d3aa5c607..12cd9191f41 100644 --- a/Userland/Libraries/LibGUI/ModelSelection.cpp +++ b/Userland/Libraries/LibGUI/ModelSelection.cpp @@ -14,13 +14,13 @@ namespace GUI { void ModelSelection::remove_matching(Function filter) { Vector to_remove; - for (auto& index : m_indexes) { + for (auto& index : m_indices) { if (filter(index)) to_remove.append(index); } if (!to_remove.is_empty()) { for (auto& index : to_remove) - m_indexes.remove(index); + m_indices.remove(index); notify_selection_changed(); } } @@ -28,19 +28,19 @@ void ModelSelection::remove_matching(Function filter) void ModelSelection::set(const ModelIndex& index) { VERIFY(index.is_valid()); - if (m_indexes.size() == 1 && m_indexes.contains(index)) + if (m_indices.size() == 1 && m_indices.contains(index)) return; - m_indexes.clear(); - m_indexes.set(index); + m_indices.clear(); + m_indices.set(index); notify_selection_changed(); } void ModelSelection::add(const ModelIndex& index) { VERIFY(index.is_valid()); - if (m_indexes.contains(index)) + if (m_indices.contains(index)) return; - m_indexes.set(index); + m_indices.set(index); notify_selection_changed(); } @@ -59,28 +59,28 @@ void ModelSelection::add_all(const Vector& indices) void ModelSelection::toggle(const ModelIndex& index) { VERIFY(index.is_valid()); - if (m_indexes.contains(index)) - m_indexes.remove(index); + if (m_indices.contains(index)) + m_indices.remove(index); else - m_indexes.set(index); + m_indices.set(index); notify_selection_changed(); } bool ModelSelection::remove(const ModelIndex& index) { VERIFY(index.is_valid()); - if (!m_indexes.contains(index)) + if (!m_indices.contains(index)) return false; - m_indexes.remove(index); + m_indices.remove(index); notify_selection_changed(); return true; } void ModelSelection::clear() { - if (m_indexes.is_empty()) + if (m_indices.is_empty()) return; - m_indexes.clear(); + m_indices.clear(); notify_selection_changed(); } diff --git a/Userland/Libraries/LibGUI/ModelSelection.h b/Userland/Libraries/LibGUI/ModelSelection.h index 86999930a7e..8b6ed047104 100644 --- a/Userland/Libraries/LibGUI/ModelSelection.h +++ b/Userland/Libraries/LibGUI/ModelSelection.h @@ -25,12 +25,12 @@ public: { } - int size() const { return m_indexes.size(); } - bool is_empty() const { return m_indexes.is_empty(); } - bool contains(const ModelIndex& index) const { return m_indexes.contains(index); } + int size() const { return m_indices.size(); } + bool is_empty() const { return m_indices.is_empty(); } + bool contains(const ModelIndex& index) const { return m_indices.contains(index); } bool contains_row(int row) const { - for (auto& index : m_indexes) { + for (auto& index : m_indices) { if (index.row() == row) return true; } @@ -47,33 +47,33 @@ public: template void for_each_index(Callback callback) { - for (auto& index : indexes()) + for (auto& index : indices()) callback(index); } template void for_each_index(Callback callback) const { - for (auto& index : indexes()) + for (auto& index : indices()) callback(index); } - Vector indexes() const + Vector indices() const { - Vector selected_indexes; + Vector selected_indices; - for (auto& index : m_indexes) - selected_indexes.append(index); + for (auto& index : m_indices) + selected_indices.append(index); - return selected_indexes; + return selected_indices; } // FIXME: This doesn't guarantee that what you get is the lowest or "first" index selected.. ModelIndex first() const { - if (m_indexes.is_empty()) + if (m_indices.is_empty()) return {}; - return *m_indexes.begin(); + return *m_indices.begin(); } void remove_matching(Function); @@ -94,7 +94,7 @@ private: void notify_selection_changed(); AbstractView& m_view; - HashTable m_indexes; + HashTable m_indices; bool m_disable_notify { false }; bool m_notify_pending { false }; }; diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.cpp b/Userland/Libraries/LibGUI/SortingProxyModel.cpp index f1feae9b722..7ae72e907ee 100644 --- a/Userland/Libraries/LibGUI/SortingProxyModel.cpp +++ b/Userland/Libraries/LibGUI/SortingProxyModel.cpp @@ -24,7 +24,7 @@ SortingProxyModel::~SortingProxyModel() void SortingProxyModel::invalidate(unsigned int flags) { - if (flags == UpdateFlag::DontInvalidateIndexes) { + if (flags == UpdateFlag::DontInvalidateIndices) { sort(m_last_key_column, m_last_sort_order); } else { m_mappings.clear(); @@ -201,20 +201,20 @@ void SortingProxyModel::sort_mapping(Mapping& mapping, int column, SortOrder sor // Update the view's selection. view.selection().change_from_model({}, [&](ModelSelection& selection) { - Vector selected_indexes_in_source; - Vector stale_indexes_in_selection; + Vector selected_indices_in_source; + Vector stale_indices_in_selection; selection.for_each_index([&](const ModelIndex& index) { if (index.parent() == mapping.source_parent) { - stale_indexes_in_selection.append(index); - selected_indexes_in_source.append(source().index(old_source_rows[index.row()], index.column(), mapping.source_parent)); + stale_indices_in_selection.append(index); + selected_indices_in_source.append(source().index(old_source_rows[index.row()], index.column(), mapping.source_parent)); } }); - for (auto& index : stale_indexes_in_selection) { + for (auto& index : stale_indices_in_selection) { selection.remove(index); } - for (auto& index : selected_indexes_in_source) { + for (auto& index : selected_indices_in_source) { for (size_t i = 0; i < mapping.source_rows.size(); ++i) { if (mapping.source_rows[i] == index.row()) { auto new_source_index = this->index(i, index.column(), mapping.source_parent); @@ -237,7 +237,7 @@ void SortingProxyModel::sort(int column, SortOrder sort_order) m_last_key_column = column; m_last_sort_order = sort_order; - did_update(UpdateFlag::DontInvalidateIndexes); + did_update(UpdateFlag::DontInvalidateIndices); } SortingProxyModel::InternalMapIterator SortingProxyModel::build_mapping(const ModelIndex& source_parent) @@ -287,10 +287,10 @@ bool SortingProxyModel::is_searchable() const Vector SortingProxyModel::matches(const StringView& searching, unsigned flags, const ModelIndex& proxy_index) { - auto found_indexes = source().matches(searching, flags, map_to_source(proxy_index)); - for (size_t i = 0; i < found_indexes.size(); i++) - found_indexes[i] = map_to_proxy(found_indexes[i]); - return found_indexes; + auto found_indices = source().matches(searching, flags, map_to_source(proxy_index)); + for (size_t i = 0; i < found_indices.size(); i++) + found_indices[i] = map_to_proxy(found_indices[i]); + return found_indices; } } diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.h b/Userland/Libraries/LibGUI/SortingProxyModel.h index 57da81998f7..22ce2935a4a 100644 --- a/Userland/Libraries/LibGUI/SortingProxyModel.h +++ b/Userland/Libraries/LibGUI/SortingProxyModel.h @@ -46,7 +46,7 @@ public: private: explicit SortingProxyModel(NonnullRefPtr source); - // NOTE: The internal_data() of indexes points to the corresponding Mapping object for that index. + // NOTE: The internal_data() of indices points to the corresponding Mapping object for that index. struct Mapping { Vector source_rows; Vector proxy_rows; @@ -63,7 +63,7 @@ private: Model& source() { return *m_source; } const Model& source() const { return *m_source; } - void invalidate(unsigned flags = Model::UpdateFlag::DontInvalidateIndexes); + void invalidate(unsigned flags = Model::UpdateFlag::DontInvalidateIndices); InternalMapIterator build_mapping(const ModelIndex& proxy_index); NonnullRefPtr m_source; diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp index 28693cac948..2e866ffb8b2 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/PNGLoader.cpp @@ -430,10 +430,10 @@ NEVER_INLINE FLATTEN static bool unfilter(PNGLoadingContext& context) auto pixels_per_byte = 8 / context.bit_depth; auto mask = (1 << context.bit_depth) - 1; for (int y = 0; y < context.height; ++y) { - auto* palette_indexes = context.scanlines[y].data.data(); + auto* palette_indices = context.scanlines[y].data.data(); for (int i = 0; i < context.width; ++i) { auto bit_offset = (8 - context.bit_depth) - (context.bit_depth * (i % pixels_per_byte)); - auto palette_index = (palette_indexes[i / pixels_per_byte] >> bit_offset) & mask; + auto palette_index = (palette_indices[i / pixels_per_byte] >> bit_offset) & mask; auto& pixel = (Pixel&)context.bitmap->scanline(y)[i]; if ((size_t)palette_index >= context.palette_data.size()) return false; diff --git a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js index 9b984fea031..5f423d7fa5e 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js @@ -79,21 +79,21 @@ describe("normal behavior", () => { }, 100); expect(result).toBe(121); - var indexes = []; + var indices = []; result = ["foo", 1, true].reduce((a, v, i) => { - indexes.push(i); + indices.push(i); }); expect(result).toBeUndefined(); - expect(indexes.length).toBe(2); - expect(indexes[0]).toBe(1); - expect(indexes[1]).toBe(2); + expect(indices.length).toBe(2); + expect(indices[0]).toBe(1); + expect(indices[1]).toBe(2); - indexes = []; + indices = []; result = ["foo", 1, true].reduce((a, v, i) => { - indexes.push(i); + indices.push(i); }, "foo"); expect(result).toBeUndefined(); - expect(indexes).toEqual([0, 1, 2]); + expect(indices).toEqual([0, 1, 2]); var mutable = { prop: 0 }; result = ["foo", 1, true].reduce((a, v) => { diff --git a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js index 3d718a04468..394335f1c38 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js @@ -84,21 +84,21 @@ describe("normal behavior", () => { }, 100); expect(result).toBe("100123456"); - var indexes = []; + var indices = []; result = ["foo", 1, true].reduceRight((a, v, i) => { - indexes.push(i); + indices.push(i); }); expect(result).toBeUndefined(); - expect(indexes.length).toBe(2); - expect(indexes[0]).toBe(1); - expect(indexes[1]).toBe(0); + expect(indices.length).toBe(2); + expect(indices[0]).toBe(1); + expect(indices[1]).toBe(0); - indexes = []; + indices = []; result = ["foo", 1, true].reduceRight((a, v, i) => { - indexes.push(i); + indices.push(i); }, "foo"); expect(result).toBeUndefined(); - expect(indexes).toEqual([2, 1, 0]); + expect(indices).toEqual([2, 1, 0]); var mutable = { prop: 0 }; result = ["foo", 1, true].reduceRight((a, v) => { diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 0ace3f5fd7c..01a938fd5f4 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -618,15 +618,15 @@ void Menu::set_visible(bool visible) void Menu::add_item(NonnullOwnPtr item) { if (auto alt_shortcut = find_ampersand_shortcut_character(item->text())) { - m_alt_shortcut_character_to_item_indexes.ensure(tolower(alt_shortcut)).append(m_items.size()); + m_alt_shortcut_character_to_item_indices.ensure(tolower(alt_shortcut)).append(m_items.size()); } m_items.append(move(item)); } const Vector* Menu::items_with_alt_shortcut(u32 alt_shortcut) const { - auto it = m_alt_shortcut_character_to_item_indexes.find(tolower(alt_shortcut)); - if (it == m_alt_shortcut_character_to_item_indexes.end()) + auto it = m_alt_shortcut_character_to_item_indices.find(tolower(alt_shortcut)); + if (it == m_alt_shortcut_character_to_item_indices.end()) return nullptr; return &it->value; } diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h index e3dac4b1b6c..dcc72d8a272 100644 --- a/Userland/Services/WindowServer/Menu.h +++ b/Userland/Services/WindowServer/Menu.h @@ -154,7 +154,7 @@ private: int m_scroll_offset { 0 }; int m_max_scroll_offset { 0 }; - HashMap> m_alt_shortcut_character_to_item_indexes; + HashMap> m_alt_shortcut_character_to_item_indices; }; u32 find_ampersand_shortcut_character(const StringView&); diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp index 9152bd2747a..9e2e78156f5 100644 --- a/Userland/Services/WindowServer/MenuManager.cpp +++ b/Userland/Services/WindowServer/MenuManager.cpp @@ -70,11 +70,11 @@ void MenuManager::event(Core::Event& event) && ((key_event.key() >= Key_A && key_event.key() <= Key_Z) || (key_event.key() >= Key_0 && key_event.key() <= Key_9))) { - if (auto* shortcut_item_indexes = m_current_menu->items_with_alt_shortcut(key_event.code_point())) { - VERIFY(!shortcut_item_indexes->is_empty()); + if (auto* shortcut_item_indices = m_current_menu->items_with_alt_shortcut(key_event.code_point())) { + VERIFY(!shortcut_item_indices->is_empty()); // FIXME: If there are multiple items with the same Alt shortcut, we should cycle through them // with each keypress instead of activating immediately. - auto index = shortcut_item_indexes->at(0); + auto index = shortcut_item_indices->at(0); auto& item = m_current_menu->item(index); m_current_menu->set_hovered_index(index); if (item.is_submenu()) diff --git a/Userland/Utilities/cut.cpp b/Userland/Utilities/cut.cpp index 152798c5bd4..15c6e8bf09a 100644 --- a/Userland/Utilities/cut.cpp +++ b/Userland/Utilities/cut.cpp @@ -37,10 +37,10 @@ static void print_usage_and_exit(int ret) exit(ret); } -static void add_if_not_exists(Vector& indexes, Index data) +static void add_if_not_exists(Vector& indices, Index data) { bool append_to_vector = true; - for (auto& index : indexes) { + for (auto& index : indices) { if (index.intersects(data)) { if (index.m_type == Index::Type::RangedIndex) { index.m_from = min(index.m_from, data.m_from); @@ -51,11 +51,11 @@ static void add_if_not_exists(Vector& indexes, Index data) } if (append_to_vector) { - indexes.append(data); + indices.append(data); } } -static void expand_list(Vector& tokens, Vector& indexes) +static void expand_list(Vector& tokens, Vector& indices) { for (auto& token : tokens) { if (token.length() == 0) { @@ -81,7 +81,7 @@ static void expand_list(Vector& tokens, Vector& indexes) } Index tmp = { 1, index.value(), Index::Type::RangedIndex }; - add_if_not_exists(indexes, tmp); + add_if_not_exists(indices, tmp); } else if (token[token.length() - 1] == '-') { auto index = token.substring(0, token.length() - 1).to_int(); if (!index.has_value()) { @@ -94,7 +94,7 @@ static void expand_list(Vector& tokens, Vector& indexes) print_usage_and_exit(1); } Index tmp = { index.value(), -1, Index::Type::SliceIndex }; - add_if_not_exists(indexes, tmp); + add_if_not_exists(indices, tmp); } else { auto range = token.split('-'); if (range.size() == 2) { @@ -119,7 +119,7 @@ static void expand_list(Vector& tokens, Vector& indexes) } Index tmp = { index1.value(), index2.value(), Index::Type::RangedIndex }; - add_if_not_exists(indexes, tmp); + add_if_not_exists(indices, tmp); } else if (range.size() == 1) { auto index = range[0].to_int(); if (!index.has_value()) { @@ -133,7 +133,7 @@ static void expand_list(Vector& tokens, Vector& indexes) } Index tmp = { index.value(), index.value(), Index::Type::SingleIndex }; - add_if_not_exists(indexes, tmp); + add_if_not_exists(indices, tmp); } else { fprintf(stderr, "cut: invalid byte or character range\n"); print_usage_and_exit(1);