diff options
author | Lenny Maiorani <lenny@serenityos.org> | 2022-03-02 17:55:14 -0700 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-03-02 22:01:58 -0800 |
commit | 064cfd6cb74b8d79449b8cc16d290009cb4f8eff (patch) | |
tree | 6d6f4e69b2d6844d1036fc7613b6a004e01d65fd | |
parent | 7a538c1e390908e96ad7d087b60cefa831491a07 (diff) | |
download | serenity-064cfd6cb74b8d79449b8cc16d290009cb4f8eff.zip |
Applications: Fix undefined behavior capturing non-static constexpr
-rw-r--r-- | Userland/Applications/FontEditor/FontEditor.cpp | 22 | ||||
-rw-r--r-- | Userland/Applications/HexEditor/FindDialog.cpp | 16 |
2 files changed, 19 insertions, 19 deletions
diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp index 42061d8edc..6724eefc18 100644 --- a/Userland/Applications/FontEditor/FontEditor.cpp +++ b/Userland/Applications/FontEditor/FontEditor.cpp @@ -43,6 +43,17 @@ #include <LibGfx/TextDirection.h> #include <LibUnicode/CharacterTypes.h> +static constexpr Array pangrams = { + "quick fox jumps nightly above wizard", + "five quacking zephyrs jolt my wax bed", + "pack my box with five dozen liquor jugs", + "quick brown fox jumps over the lazy dog", + "waxy and quivering jocks fumble the pizza", + "~#:[@_1%]*{$2.3}/4^(5'6\")-&|7+8!=<9,0\\>?;", + "byxfjärmat föl gick på duvshowen", + " " +}; + static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor) { auto window = GUI::Window::construct(&editor); @@ -73,17 +84,6 @@ static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor) textbox_button_container.set_layout<GUI::HorizontalBoxLayout>(); textbox_button_container.set_fixed_height(22); - constexpr Array pangrams = { - "quick fox jumps nightly above wizard", - "five quacking zephyrs jolt my wax bed", - "pack my box with five dozen liquor jugs", - "quick brown fox jumps over the lazy dog", - "waxy and quivering jocks fumble the pizza", - "~#:[@_1%]*{$2.3}/4^(5'6\")-&|7+8!=<9,0\\>?;", - "byxfjärmat föl gick på duvshowen", - " " - }; - auto& preview_textbox = textbox_button_container.add<GUI::TextBox>(); preview_textbox.set_text(pangrams[0]); preview_textbox.set_placeholder("Preview text"); diff --git a/Userland/Applications/HexEditor/FindDialog.cpp b/Userland/Applications/HexEditor/FindDialog.cpp index 312475883a..fd4728dbd7 100644 --- a/Userland/Applications/HexEditor/FindDialog.cpp +++ b/Userland/Applications/HexEditor/FindDialog.cpp @@ -24,6 +24,13 @@ struct Option { bool default_action; }; +static constexpr Array<Option, 2> options = { + { + { "ASCII String", OPTION_ASCII_STRING, true, true }, + { "Hex value", OPTION_HEX_VALUE, true, false }, + } +}; + int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer, bool& find_all) { auto dialog = FindDialog::construct(); @@ -101,13 +108,6 @@ FindDialog::FindDialog() m_find_all_button = *main_widget.find_descendant_of_type_named<GUI::Button>("find_all_button"); m_cancel_button = *main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button"); - constexpr Array<Option, 2> options = { - { - { "ASCII String", OPTION_ASCII_STRING, true, true }, - { "Hex value", OPTION_HEX_VALUE, true, false }, - } - }; - auto& radio_container = *main_widget.find_descendant_of_type_named<GUI::Widget>("radio_container"); for (size_t i = 0; i < options.size(); i++) { auto action = options[i]; @@ -115,7 +115,7 @@ FindDialog::FindDialog() radio.set_enabled(action.enabled); radio.set_text(action.title); - radio.on_checked = [this, i, &options](auto) { + radio.on_checked = [this, i](auto) { m_selected_option = options[i].opt; }; |