Skip to content

Commit 59f9da5

Browse files
committed
impr: Less unnecessary copying
1 parent 8d4415f commit 59f9da5

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

lib/libimhex/source/helpers/magic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ namespace hex::magic {
336336

337337
if (pattern->matches(bytes)) {
338338
foundCorrectType = true;
339-
magicOffset = *address;
339+
magicOffset = address;
340340
}
341341
}
342342
}

plugins/builtin/source/content/views/view_find.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -742,12 +742,12 @@ namespace hex::plugin::builtin {
742742
ImGui::BeginGroup();
743743
if (ImGui::BeginTabBar("SearchMethods")) {
744744
const std::array<std::string, 6> StringTypes = {
745-
"hex.ui.common.encoding.ascii"_lang,
746-
"hex.ui.common.encoding.utf8"_lang,
747-
"hex.ui.common.encoding.utf16le"_lang,
748-
"hex.ui.common.encoding.utf16be"_lang,
749-
fmt::format("{} + {}", "hex.ui.common.encoding.ascii"_lang, "hex.ui.common.encoding.utf16le"_lang),
750-
fmt::format("{} + {}", "hex.ui.common.encoding.ascii"_lang, "hex.ui.common.encoding.utf16be"_lang)
745+
"hex.ui.common.encoding.ascii"_lang,
746+
"hex.ui.common.encoding.utf8"_lang,
747+
"hex.ui.common.encoding.utf16le"_lang,
748+
"hex.ui.common.encoding.utf16be"_lang,
749+
fmt::format("{} + {}", "hex.ui.common.encoding.ascii"_lang, "hex.ui.common.encoding.utf16le"_lang),
750+
fmt::format("{} + {}", "hex.ui.common.encoding.ascii"_lang, "hex.ui.common.encoding.utf16be"_lang)
751751
};
752752

753753
auto &mode = m_searchSettings.mode;
@@ -899,24 +899,24 @@ namespace hex::plugin::builtin {
899899
}
900900
ImGui::NewLine();
901901

902-
const std::array<std::string, 10> InputTypes = {
903-
"hex.ui.common.type.u8"_lang,
904-
"hex.ui.common.type.u16"_lang,
905-
"hex.ui.common.type.u32"_lang,
906-
"hex.ui.common.type.u64"_lang,
907-
"hex.ui.common.type.i8"_lang,
908-
"hex.ui.common.type.i16"_lang,
909-
"hex.ui.common.type.i32"_lang,
910-
"hex.ui.common.type.i64"_lang,
911-
"hex.ui.common.type.f32"_lang,
912-
"hex.ui.common.type.f64"_lang
902+
constexpr static std::array InputTypes = {
903+
"hex.ui.common.type.u8"_lang,
904+
"hex.ui.common.type.u16"_lang,
905+
"hex.ui.common.type.u32"_lang,
906+
"hex.ui.common.type.u64"_lang,
907+
"hex.ui.common.type.i8"_lang,
908+
"hex.ui.common.type.i16"_lang,
909+
"hex.ui.common.type.i32"_lang,
910+
"hex.ui.common.type.i64"_lang,
911+
"hex.ui.common.type.f32"_lang,
912+
"hex.ui.common.type.f64"_lang
913913
};
914914

915-
if (ImGui::BeginCombo("hex.ui.common.type"_lang, InputTypes[std::to_underlying(settings.type)].c_str())) {
915+
if (ImGui::BeginCombo("hex.ui.common.type"_lang, InputTypes[std::to_underlying(settings.type)].get())) {
916916
for (size_t i = 0; i < InputTypes.size(); i++) {
917917
auto type = static_cast<SearchSettings::Value::Type>(i);
918918

919-
if (ImGui::Selectable(InputTypes[i].c_str(), type == settings.type)) {
919+
if (ImGui::Selectable(InputTypes[i].get(), type == settings.type)) {
920920
settings.type = type;
921921
edited = true;
922922
}

0 commit comments

Comments
 (0)