diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp index 7ed16ba1369fce..466ccdc42b4d0e 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp @@ -1724,42 +1724,44 @@ struct PropertyMetadata { // this process reduces over 1 million entries (0x10ffff) to ~44,030. // // For much more in-depth reading, see: https://icu.unicode.org/design/struct/utrie -static ErrorOr create_code_point_tables(UnicodeData& unicode_data) +static constexpr auto MAX_CODE_POINT = 0x10ffffu; + +template +static ErrorOr update_tables(u32 code_point, CodePointTables& tables, auto& metadata, auto const& values) { - static constexpr auto MAX_CODE_POINT = 0x10ffffu; + static constexpr auto BLOCK_SIZE = CODE_POINT_TABLES_LSB_MASK + 1; + + size_t unique_properties_index = 0; + if (auto block_index = tables.unique_properties.find_first_index(values); block_index.has_value()) { + unique_properties_index = *block_index; + } else { + unique_properties_index = tables.unique_properties.size(); + TRY(tables.unique_properties.try_append(values)); + } - auto update_tables = [&](auto code_point, auto& tables, auto& metadata, auto const& values) -> ErrorOr { - static constexpr auto BLOCK_SIZE = CODE_POINT_TABLES_LSB_MASK + 1; + TRY(metadata.current_block.try_append(unique_properties_index)); - size_t unique_properties_index = 0; - if (auto block_index = tables.unique_properties.find_first_index(values); block_index.has_value()) { - unique_properties_index = *block_index; + if (metadata.current_block.size() == BLOCK_SIZE || code_point == MAX_CODE_POINT) { + size_t stage2_index = 0; + if (auto block_index = metadata.unique_blocks.get(metadata.current_block); block_index.has_value()) { + stage2_index = *block_index; } else { - unique_properties_index = tables.unique_properties.size(); - TRY(tables.unique_properties.try_append(values)); - } - - TRY(metadata.current_block.try_append(unique_properties_index)); - - if (metadata.current_block.size() == BLOCK_SIZE || code_point == MAX_CODE_POINT) { - size_t stage2_index = 0; - if (auto block_index = metadata.unique_blocks.get(metadata.current_block); block_index.has_value()) { - stage2_index = *block_index; - } else { - stage2_index = tables.stage2.size(); - TRY(tables.stage2.try_extend(metadata.current_block)); - - TRY(metadata.unique_blocks.try_set(metadata.current_block, stage2_index)); - } + stage2_index = tables.stage2.size(); + TRY(tables.stage2.try_extend(metadata.current_block)); - TRY(tables.stage1.try_append(stage2_index)); - metadata.current_block.clear_with_capacity(); + TRY(metadata.unique_blocks.try_set(metadata.current_block, stage2_index)); } - return {}; - }; + TRY(tables.stage1.try_append(stage2_index)); + metadata.current_block.clear_with_capacity(); + } + + return {}; +} - auto update_casing_tables = [&](auto code_point, auto& tables, auto& metadata) -> ErrorOr { +static ErrorOr create_code_point_tables(UnicodeData& unicode_data) +{ + auto update_casing_tables = [&](u32 code_point, CodePointTables& tables, CasingMetadata& metadata) -> ErrorOr { CasingTable casing {}; while (metadata.iterator != metadata.end) { @@ -1778,7 +1780,7 @@ static ErrorOr create_code_point_tables(UnicodeData& unicode_data) return {}; }; - auto update_property_tables = [&](auto code_point, auto& tables, auto& metadata) -> ErrorOr { + auto update_property_tables = [&](u32 code_point, CodePointTables& tables, PropertyMetadata& metadata) -> ErrorOr { static Unicode::CodePointRangeComparator comparator {}; for (auto& property_values : metadata.property_values) { diff --git a/Userland/Applications/PixelPaint/Filters/HueAndSaturation.cpp b/Userland/Applications/PixelPaint/Filters/HueAndSaturation.cpp index 1ad1727a85564a..bc1add7d058f86 100644 --- a/Userland/Applications/PixelPaint/Filters/HueAndSaturation.cpp +++ b/Userland/Applications/PixelPaint/Filters/HueAndSaturation.cpp @@ -33,7 +33,7 @@ ErrorOr> HueAndSaturation::get_settings_widget() auto settings_widget = GUI::Widget::construct(); settings_widget->set_layout(); - auto add_slider = [&](auto name, int min, int max, auto member) -> ErrorOr { + auto add_slider = [&](StringView name, int min, int max, auto member) -> ErrorOr { auto& name_label = settings_widget->add(TRY(String::from_utf8(name))); name_label.set_font_weight(Gfx::FontWeight::Bold); name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index 7911ddf73766e1..38af8d3ee59d1f 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -706,7 +706,7 @@ ErrorOr> Shell::run_command(const AST::Command& command) // Resolve redirections. Vector> rewirings; - auto resolve_redirection = [&](auto& redirection) -> ErrorOr { + auto resolve_redirection = [&](NonnullRefPtr const& redirection) -> ErrorOr { auto rewiring = TRY(redirection->apply()); if (rewiring->fd_action != AST::Rewiring::Close::ImmediatelyCloseNew)