From 17c2dfcbd0808a5ada77024e1630a34549061ff3 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Sat, 20 Dec 2025 15:59:48 +0100 Subject: [PATCH] chore: apply more light lints (#2575) ### Problem description ### Implementation description ### Screenshots ### Additional things --- .clang-tidy | 11 +- lib/libimhex/source/api/content_registry.cpp | 82 ++++---- lib/libimhex/source/api/imhex_api.cpp | 8 +- .../source/api/localization_manager.cpp | 2 +- lib/libimhex/source/api/shortcut_manager.cpp | 8 +- lib/libimhex/source/api/theme_manager.cpp | 2 +- lib/libimhex/source/api/tutorial_manager.cpp | 24 +-- lib/libimhex/source/data_processor/node.cpp | 2 +- .../source/helpers/binary_pattern.cpp | 6 +- lib/libimhex/source/helpers/crypto.cpp | 19 +- lib/libimhex/source/helpers/default_paths.cpp | 1 - lib/libimhex/source/mcp/server.cpp | 4 +- .../source/providers/cached_provider.cpp | 4 +- lib/libimhex/source/providers/provider.cpp | 10 +- lib/libimhex/source/test/tests.cpp | 2 +- .../source/ui/imgui_imhex_extensions.cpp | 5 +- lib/trace/source/stacktrace.cpp | 4 +- main/gui/source/init/splash_window.cpp | 2 +- main/updater/source/main.cpp | 16 +- .../content/data_information_sections.cpp | 2 +- .../builtin/source/content/data_inspector.cpp | 4 +- .../source/content/main_menu_items.cpp | 2 +- .../source/content/minimap_visualizers.cpp | 4 +- .../source/content/pl_builtin_functions.cpp | 2 +- .../hex_editor/popup_hex_editor_find.cpp | 4 +- .../hex_editor/popup_hex_editor_select.cpp | 6 +- .../content/providers/disk_provider.cpp | 2 +- .../content/providers/file_provider.cpp | 6 +- .../source/content/providers/gdb_provider.cpp | 2 +- .../content/providers/intel_hex_provider.cpp | 14 +- .../providers/memory_file_provider.cpp | 4 +- .../providers/process_memory_provider.cpp | 6 +- .../content/providers/view_provider.cpp | 4 +- .../text_highlighting/pattern_language.cpp | 2 +- plugins/builtin/source/content/themes.cpp | 184 +++++++++--------- .../source/content/tools/color_picker.cpp | 8 +- .../source/content/tools/ieee_decoder.cpp | 2 +- .../source/content/tutorials/introduction.cpp | 2 +- .../source/content/views/view_about.cpp | 114 +++++------ .../source/content/views/view_bookmarks.cpp | 18 +- .../content/views/view_data_inspector.cpp | 10 +- .../content/views/view_data_processor.cpp | 2 +- .../source/content/views/view_find.cpp | 24 +-- .../source/content/views/view_hex_editor.cpp | 14 +- .../source/content/views/view_patches.cpp | 4 +- .../content/views/view_pattern_editor.cpp | 4 +- .../builtin/source/content/welcome_screen.cpp | 2 +- plugins/fonts/source/fonts.cpp | 8 +- plugins/ui/source/ui/hex_editor.cpp | 14 +- plugins/ui/source/ui/text_editor/navigate.cpp | 4 +- plugins/ui/source/ui/text_editor/support.cpp | 17 +- plugins/ui/source/ui/text_editor/utf8.cpp | 6 +- plugins/ui/source/ui/widgets.cpp | 6 +- tests/algorithms/source/crypto.cpp | 182 ++++++++--------- 54 files changed, 444 insertions(+), 457 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index df98b12ff..3c2eb1ea2 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,5 @@ -# Disabled rules should have a comment associated +# All rules should have a comment associated +# Directives that do not have any effect (e.g. disabling a rule that is not enabled) can be done to add an explanation comment. # Or at least an empty comment # to show they were put here explicitely, # and not as part of the historical CLion-generated rules # Note: `- -X` means disable X @@ -30,7 +31,7 @@ Checks: - cppcoreguidelines-pro-type-member-init # We want to use default member initializers - cppcoreguidelines-slicing - cppcoreguidelines-interfaces-global-init -- cppcoreguidelines-pro-type-static-cast-downcast +- -cppcoreguidelines-pro-type-static-cast-downcast # dynamic_cast has a runtime overhead - -cppcoreguidelines-narrowing-conversions # - google-default-arguments - google-runtime-operator @@ -79,10 +80,8 @@ Checks: - -readability-convert-member-functions-to-static # - -readability-use-concise-preprocessor-directives # We do not use #ifdef - -readability-uppercase-literal-suffix # Not important enough -- -readability-static-accessed-through-instance -- '*-include-cleaner' - -# idk +- -readability-redundant-string-cstr # Sometimes used to stop at first null byte +- -readability-static-accessed-through-instance # # Will check later if useful or not - -readability-make-member-function-const # to make functions const. Seems to not catch everything ? diff --git a/lib/libimhex/source/api/content_registry.cpp b/lib/libimhex/source/api/content_registry.cpp index 1100c48b0..5adabc2dc 100644 --- a/lib/libimhex/source/api/content_registry.cpp +++ b/lib/libimhex/source/api/content_registry.cpp @@ -630,22 +630,22 @@ namespace hex { void add(Type type, const std::string &command, const UnlocalizedString &unlocalizedDescription, const impl::DisplayCallback &displayCallback, const impl::ExecuteCallback &executeCallback) { log::debug("Registered new command palette command: {}", command); - impl::s_entries->push_back(impl::Entry { type, command, unlocalizedDescription, displayCallback, executeCallback }); + impl::s_entries->push_back(impl::Entry { .type=type, .command=command, .unlocalizedDescription=unlocalizedDescription, .displayCallback=displayCallback, .executeCallback=executeCallback }); } void addHandler(Type type, const std::string &command, const impl::QueryCallback &queryCallback, const impl::DisplayCallback &displayCallback) { log::debug("Registered new command palette command handler: {}", command); - impl::s_handlers->push_back(impl::Handler { type, command, queryCallback, displayCallback }); + impl::s_handlers->push_back(impl::Handler { .type=type, .command=command, .queryCallback=queryCallback, .displayCallback=displayCallback }); } void setDisplayedContent(const impl::ContentDisplayCallback &displayCallback) { - impl::s_displayedContent = impl::ContentDisplay { true, displayCallback }; + impl::s_displayedContent = impl::ContentDisplay { .showSearchBox=true, .callback=displayCallback }; } void openWithContent(const impl::ContentDisplayCallback &displayCallback) { RequestOpenCommandPalette::post(); - impl::s_displayedContent = impl::ContentDisplay { false, displayCallback }; + impl::s_displayedContent = impl::ContentDisplay { .showSearchBox=false, .callback=displayCallback }; } } @@ -783,12 +783,12 @@ namespace hex { void addVisualizer(const std::string &name, const impl::VisualizerFunctionCallback &function, pl::api::FunctionParameterCount parameterCount) { log::debug("Registered new pattern visualizer function: {}", name); - (*impl::s_visualizers)[name] = impl::Visualizer { parameterCount, function }; + (*impl::s_visualizers)[name] = impl::Visualizer { .parameterCount=parameterCount, .callback=function }; } void addInlineVisualizer(const std::string &name, const impl::VisualizerFunctionCallback &function, pl::api::FunctionParameterCount parameterCount) { log::debug("Registered new inline pattern visualizer function: {}", name); - (*impl::s_inlineVisualizers)[name] = impl::Visualizer { parameterCount, function }; + (*impl::s_inlineVisualizers)[name] = impl::Visualizer { .parameterCount=parameterCount, .callback=function }; } } @@ -854,7 +854,7 @@ namespace hex { void add(const UnlocalizedString &unlocalizedName, const char *icon, const impl::Callback &function) { log::debug("Registered new tool: {}", unlocalizedName.get()); - impl::s_tools->emplace_back(impl::Entry { unlocalizedName, icon, function }); + impl::s_tools->emplace_back(impl::Entry { .unlocalizedName=unlocalizedName, .icon=icon, .function=function }); } } @@ -1009,7 +1009,7 @@ namespace hex { coloredIcon.color = ImGuiCustomCol_ToolbarGray; impl::s_menuItems->insert({ - priority, impl::MenuItem { unlocalizedMainMenuNames, coloredIcon, shortcut, view, function, enabledCallback, selectedCallback, -1 } + priority, impl::MenuItem { .unlocalizedNames=unlocalizedMainMenuNames, .icon=coloredIcon, .shortcut=shortcut, .view=view, .callback=function, .enabledCallback=enabledCallback, .selectedCallback=selectedCallback, .toolbarIndex=-1 } }); if (shortcut != Shortcut::None) { @@ -1033,14 +1033,14 @@ namespace hex { unlocalizedMainMenuNames.emplace_back(impl::SubMenuValue); impl::s_menuItems->insert({ - priority, impl::MenuItem { unlocalizedMainMenuNames, icon, showOnWelcomeScreen ? Shortcut({ ShowOnWelcomeScreen }) : Shortcut::None, view, function, enabledCallback, []{ return false; }, -1 } + priority, impl::MenuItem { .unlocalizedNames=unlocalizedMainMenuNames, .icon=icon, .shortcut=showOnWelcomeScreen ? Shortcut({ ShowOnWelcomeScreen }) : Shortcut::None, .view=view, .callback=function, .enabledCallback=enabledCallback, .selectedCallback=[]{ return false; }, .toolbarIndex=-1 } }); } void addMenuItemSeparator(std::vector unlocalizedMainMenuNames, u32 priority, View *view) { unlocalizedMainMenuNames.emplace_back(impl::SeparatorValue); impl::s_menuItems->insert({ - priority, impl::MenuItem { unlocalizedMainMenuNames, "", Shortcut::None, view, []{}, []{ return true; }, []{ return false; }, -1 } + priority, impl::MenuItem { .unlocalizedNames=unlocalizedMainMenuNames, .icon="", .shortcut=Shortcut::None, .view=view, .callback=[]{}, .enabledCallback=[]{ return true; }, .selectedCallback=[]{ return false; }, .toolbarIndex=-1 } }); } @@ -1114,9 +1114,9 @@ namespace hex { } - namespace ContentRegistry::Provider { + - namespace impl { + namespace ContentRegistry::Provider::impl { void add(const std::string &typeName, ProviderCreationFunction creationFunction) { (void)RequestCreateProvider::subscribe([expectedName = typeName, creationFunction](const std::string &name, bool skipLoadInterface, bool selectProvider, std::shared_ptr *provider) { @@ -1145,7 +1145,7 @@ namespace hex { } - } + namespace ContentRegistry::DataFormatter { @@ -1301,40 +1301,35 @@ namespace hex { } - namespace ContentRegistry::Diffing { - namespace impl { + namespace ContentRegistry::Diffing::impl { - static AutoReset>> s_algorithms; - const std::vector>& getAlgorithms() { - return *s_algorithms; - } - - void addAlgorithm(std::unique_ptr &&hash) { - s_algorithms->emplace_back(std::move(hash)); - } + static AutoReset>> s_algorithms; + const std::vector>& getAlgorithms() { + return *s_algorithms; + } + void addAlgorithm(std::unique_ptr &&hash) { + s_algorithms->emplace_back(std::move(hash)); } } - namespace ContentRegistry::Hashes { - namespace impl { + namespace ContentRegistry::Hashes::impl { - static AutoReset>> s_hashes; - const std::vector>& getHashes() { - return *s_hashes; - } - - void add(std::unique_ptr &&hash) { - s_hashes->emplace_back(std::move(hash)); - } + static AutoReset>> s_hashes; + const std::vector>& getHashes() { + return *s_hashes; + } + void add(std::unique_ptr &&hash) { + s_hashes->emplace_back(std::move(hash)); } } + namespace ContentRegistry::BackgroundServices { namespace impl { @@ -1540,22 +1535,19 @@ namespace hex { } } + - namespace ContentRegistry::Disassemblers { + namespace ContentRegistry::Disassemblers::impl { - namespace impl { + static AutoReset> s_architectures; - static AutoReset> s_architectures; - - void addArchitectureCreator(impl::CreatorFunction function) { - const auto arch = function(); - (*s_architectures)[arch->getName()] = std::move(function); - } - - const std::map& getArchitectures() { - return *s_architectures; - } + void addArchitectureCreator(impl::CreatorFunction function) { + const auto arch = function(); + (*s_architectures)[arch->getName()] = std::move(function); + } + const std::map& getArchitectures() { + return *s_architectures; } } diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index 2bb00550d..d303a61ec 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -261,7 +261,7 @@ namespace hex { } void setSelection(u64 address, size_t size, prv::Provider *provider) { - setSelection({ { address, size }, provider == nullptr ? Provider::get() : provider }); + setSelection({ { .address=address, .size=size }, provider == nullptr ? Provider::get() : provider }); } void addVirtualFile(const std::string &path, std::vector data, Region region) { @@ -285,7 +285,7 @@ namespace hex { } u64 add(u64 address, size_t size, const std::string &name, const std::string &comment, u32 color) { - return add(Region { address, size }, name, comment, color); + return add(Region { .address=address, .size=size }, name, comment, color); } void remove(u64 id) { @@ -904,7 +904,7 @@ namespace hex { } } - return { { name, version } }; + return { { .name=name, .version=version } }; } const SemanticVersion& getImHexVersion() { @@ -1224,7 +1224,7 @@ namespace hex { if (it == impl::s_fontDefinitions->end()) { const auto defaultFont = ImGui::GetDefaultFont(); - return { defaultFont, defaultFont, defaultFont }; + return { .regular=defaultFont, .bold=defaultFont, .italic=defaultFont }; } else return it->second; } diff --git a/lib/libimhex/source/api/localization_manager.cpp b/lib/libimhex/source/api/localization_manager.cpp index 16ac67a94..06c65cf30 100644 --- a/lib/libimhex/source/api/localization_manager.cpp +++ b/lib/libimhex/source/api/localization_manager.cpp @@ -56,7 +56,7 @@ namespace hex { const auto path = item["path"].get(); - definition.languageFilePaths.emplace_back(PathEntry{ path, callback }); + definition.languageFilePaths.emplace_back(PathEntry{ .path=path, .callback=callback }); } } diff --git a/lib/libimhex/source/api/shortcut_manager.cpp b/lib/libimhex/source/api/shortcut_manager.cpp index ee6b7d0ba..353860852 100644 --- a/lib/libimhex/source/api/shortcut_manager.cpp +++ b/lib/libimhex/source/api/shortcut_manager.cpp @@ -281,25 +281,25 @@ namespace hex { void ShortcutManager::addGlobalShortcut(const Shortcut &shortcut, const std::vector &unlocalizedName, const std::function &callback, const EnabledCallback &enabledCallback) { log::debug("Adding global shortcut {} for {}", shortcut.toString(), unlocalizedName.back().get()); - auto [it, inserted] = s_globalShortcuts->insert({ shortcut, { shortcut, unlocalizedName, callback, enabledCallback } }); + auto [it, inserted] = s_globalShortcuts->insert({ shortcut, { .shortcut=shortcut, .unlocalizedName=unlocalizedName, .callback=callback, .enabledCallback=enabledCallback } }); if (!inserted) log::error("Failed to add shortcut!"); } void ShortcutManager::addGlobalShortcut(const Shortcut &shortcut, const UnlocalizedString &unlocalizedName, const std::function &callback, const EnabledCallback &enabledCallback) { log::debug("Adding global shortcut {} for {}", shortcut.toString(), unlocalizedName.get()); - auto [it, inserted] = s_globalShortcuts->insert({ shortcut, { shortcut, { unlocalizedName }, callback, enabledCallback } }); + auto [it, inserted] = s_globalShortcuts->insert({ shortcut, { .shortcut=shortcut, .unlocalizedName={ unlocalizedName }, .callback=callback, .enabledCallback=enabledCallback } }); if (!inserted) log::error("Failed to add shortcut!"); } void ShortcutManager::addShortcut(View *view, const Shortcut &shortcut, const std::vector &unlocalizedName, const std::function &callback, const EnabledCallback &enabledCallback) { log::debug("Adding shortcut {} for {}", shortcut.toString(), unlocalizedName.back().get()); - auto [it, inserted] = view->m_shortcuts.insert({ shortcut + CurrentView, { shortcut, unlocalizedName, callback, enabledCallback } }); + auto [it, inserted] = view->m_shortcuts.insert({ shortcut + CurrentView, { .shortcut=shortcut, .unlocalizedName=unlocalizedName, .callback=callback, .enabledCallback=enabledCallback } }); if (!inserted) log::error("Failed to add shortcut!"); } void ShortcutManager::addShortcut(View *view, const Shortcut &shortcut, const UnlocalizedString &unlocalizedName, const std::function &callback, const EnabledCallback &enabledCallback) { log::debug("Adding shortcut {} for {}", shortcut.toString(), unlocalizedName.get()); - auto [it, inserted] = view->m_shortcuts.insert({ shortcut + CurrentView, { shortcut, { unlocalizedName }, callback, enabledCallback } }); + auto [it, inserted] = view->m_shortcuts.insert({ shortcut + CurrentView, { .shortcut=shortcut, .unlocalizedName={ unlocalizedName }, .callback=callback, .enabledCallback=enabledCallback } }); if (!inserted) log::error("Failed to add shortcut!"); } diff --git a/lib/libimhex/source/api/theme_manager.cpp b/lib/libimhex/source/api/theme_manager.cpp index b76c9ec00..0ebade3d1 100644 --- a/lib/libimhex/source/api/theme_manager.cpp +++ b/lib/libimhex/source/api/theme_manager.cpp @@ -31,7 +31,7 @@ namespace hex { void ThemeManager::addThemeHandler(const std::string &name, const ColorMap &colorMap, const std::function &getFunction, const std::function &setFunction) { std::unique_lock lock(s_themeMutex); - (*s_themeHandlers)[name] = { colorMap, getFunction, setFunction }; + (*s_themeHandlers)[name] = { .colorMap=colorMap, .getFunction=getFunction, .setFunction=setFunction }; } void ThemeManager::addStyleHandler(const std::string &name, const StyleMap &styleMap) { diff --git a/lib/libimhex/source/api/tutorial_manager.cpp b/lib/libimhex/source/api/tutorial_manager.cpp index de221976c..970290081 100644 --- a/lib/libimhex/source/api/tutorial_manager.cpp +++ b/lib/libimhex/source/api/tutorial_manager.cpp @@ -320,10 +320,10 @@ namespace hex { if (!message.has_value()) { message = Tutorial::Step::Message { - Position::None, - "", - "", - false + .position=Position::None, + .unlocalizedTitle="", + .unlocalizedMessage="", + .allowSkip=false }; } @@ -483,10 +483,10 @@ namespace hex { TutorialManager::Tutorial::Step& TutorialManager::Tutorial::Step::setMessage(const UnlocalizedString &unlocalizedTitle, const UnlocalizedString &unlocalizedMessage, Position position) { m_message = Message { - position, - unlocalizedTitle, - unlocalizedMessage, - false + .position=position, + .unlocalizedTitle=unlocalizedTitle, + .unlocalizedMessage=unlocalizedMessage, + .allowSkip=false }; return *this; @@ -497,10 +497,10 @@ namespace hex { m_message->allowSkip = true; } else { m_message = Message { - Position::Bottom | Position::Right, - "", - "", - true + .position=Position::Bottom | Position::Right, + .unlocalizedTitle="", + .unlocalizedMessage="", + .allowSkip=true }; } diff --git a/lib/libimhex/source/data_processor/node.cpp b/lib/libimhex/source/data_processor/node.cpp index 11a0a9945..abdbd6454 100644 --- a/lib/libimhex/source/data_processor/node.cpp +++ b/lib/libimhex/source/data_processor/node.cpp @@ -152,7 +152,7 @@ namespace hex::dp { } [[noreturn]] void Node::throwNodeError(const std::string &message) { - throw NodeError { this, message }; + throw NodeError { .node=this, .message=message }; } void Node::setAttributes(std::vector attributes) { diff --git a/lib/libimhex/source/helpers/binary_pattern.cpp b/lib/libimhex/source/helpers/binary_pattern.cpp index d0e2da959..f7e82932a 100644 --- a/lib/libimhex/source/helpers/binary_pattern.cpp +++ b/lib/libimhex/source/helpers/binary_pattern.cpp @@ -90,14 +90,14 @@ namespace hex { bool inString = false; while (!string.empty()) { - BinaryPattern::Pattern pattern = { 0, 0 }; + BinaryPattern::Pattern pattern = { .mask=0, .value=0 }; if (string.starts_with("\"")) { inString = !inString; string = string.substr(1); continue; } else if (inString) { - pattern = { 0xFF, u8(string.front()) }; + pattern = { .mask=0xFF, .value=u8(string.front()) }; string = string.substr(1); } else if (string.starts_with("u") || string.starts_with("s")) { auto newPatterns = parseValueExpression(string); @@ -106,7 +106,7 @@ namespace hex { std::ranges::move(newPatterns, std::back_inserter(result)); continue; } else if (string.starts_with("??")) { - pattern = { 0x00, 0x00 }; + pattern = { .mask=0x00, .value=0x00 }; string = string.substr(2); } else if ((std::isxdigit(string.front()) || string.front() == '?') && string.length() >= 2) { const auto hex = string.substr(0, 2); diff --git a/lib/libimhex/source/helpers/crypto.cpp b/lib/libimhex/source/helpers/crypto.cpp index 0eef9828b..b75bbf907 100644 --- a/lib/libimhex/source/helpers/crypto.cpp +++ b/lib/libimhex/source/helpers/crypto.cpp @@ -28,7 +28,6 @@ #endif #include -#include #include #include #include @@ -82,7 +81,7 @@ namespace hex::crypt { public: constexpr Crc(u64 polynomial, u64 init, u64 xorOut, bool reflectInput, bool reflectOutput) - : m_value(0x00), m_init(init & ((0b10ull << (NumBits - 1)) - 1)), m_xorOut(xorOut & ((0b10ull << (NumBits - 1)) - 1)), + : m_init(init & ((0b10ull << (NumBits - 1)) - 1)), m_xorOut(xorOut & ((0b10ull << (NumBits - 1)) - 1)), m_reflectInput(reflectInput), m_reflectOutput(reflectOutput), m_table([polynomial] { auto reflectedPoly = reflect(polynomial & ((0b10ull << (NumBits - 1)) - 1), NumBits); @@ -129,7 +128,7 @@ namespace hex::crypt { } private: - u64 m_value; + u64 m_value = 0x00; u64 m_init; u64 m_xorOut; @@ -144,7 +143,7 @@ namespace hex::crypt { using Crc = Crc; Crc crc(polynomial, init, xorout, reflectIn, reflectOut); - processDataByChunks(data, offset, size, std::bind(&Crc::processBytes, &crc, _1, _2)); + processDataByChunks(data, offset, size, [&crc](auto && data, auto && size) { crc.processBytes(data, size); }); return crc.checksum(); } @@ -170,7 +169,7 @@ namespace hex::crypt { mbedtls_md5_starts(&ctx); - processDataByChunks(data, offset, size, std::bind(mbedtls_md5_update, &ctx, _1, _2)); + processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_md5_update(&ctx, data, size); }); mbedtls_md5_finish(&ctx, result.data()); @@ -202,7 +201,7 @@ namespace hex::crypt { mbedtls_sha1_starts(&ctx); - processDataByChunks(data, offset, size, std::bind(mbedtls_sha1_update, &ctx, _1, _2)); + processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_sha1_update(&ctx, data, size); }); mbedtls_sha1_finish(&ctx, result.data()); @@ -234,7 +233,7 @@ namespace hex::crypt { mbedtls_sha256_starts(&ctx, true); - processDataByChunks(data, offset, size, std::bind(mbedtls_sha256_update, &ctx, _1, _2)); + processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_sha256_update(&ctx, data, size); }); mbedtls_sha256_finish(&ctx, result.data()); @@ -266,7 +265,7 @@ namespace hex::crypt { mbedtls_sha256_starts(&ctx, false); - processDataByChunks(data, offset, size, std::bind(mbedtls_sha256_update, &ctx, _1, _2)); + processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_sha256_update(&ctx, data, size); }); mbedtls_sha256_finish(&ctx, result.data()); @@ -298,7 +297,7 @@ namespace hex::crypt { mbedtls_sha512_starts(&ctx, true); - processDataByChunks(data, offset, size, std::bind(mbedtls_sha512_update, &ctx, _1, _2)); + processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_sha512_update(&ctx, data, size); }); mbedtls_sha512_finish(&ctx, result.data()); @@ -330,7 +329,7 @@ namespace hex::crypt { mbedtls_sha512_starts(&ctx, false); - processDataByChunks(data, offset, size, std::bind(mbedtls_sha512_update, &ctx, _1, _2)); + processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_sha512_update(&ctx, data, size); }); mbedtls_sha512_finish(&ctx, result.data()); diff --git a/lib/libimhex/source/helpers/default_paths.cpp b/lib/libimhex/source/helpers/default_paths.cpp index 8a06954da..c0093cd3e 100644 --- a/lib/libimhex/source/helpers/default_paths.cpp +++ b/lib/libimhex/source/helpers/default_paths.cpp @@ -5,7 +5,6 @@ #include #include -#include #if defined(OS_WINDOWS) #include diff --git a/lib/libimhex/source/mcp/server.cpp b/lib/libimhex/source/mcp/server.cpp index bdae493e7..b99ab72a3 100644 --- a/lib/libimhex/source/mcp/server.cpp +++ b/lib/libimhex/source/mcp/server.cpp @@ -189,8 +189,8 @@ namespace hex::mcp { auto name = json["name"].get(); m_primitives[type][name] = { - json, - function + .capabilities=json, + .function=function }; } diff --git a/lib/libimhex/source/providers/cached_provider.cpp b/lib/libimhex/source/providers/cached_provider.cpp index 423271c59..63d26b7d4 100644 --- a/lib/libimhex/source/providers/cached_provider.cpp +++ b/lib/libimhex/source/providers/cached_provider.cpp @@ -49,7 +49,7 @@ namespace hex::prv { { std::unique_lock lock(m_cacheMutex); - m_cache[cacheSlot] = Block{blockIndex, std::move(blockData), false}; + m_cache[cacheSlot] = Block{.index=blockIndex, .data=std::move(blockData), .dirty=false}; std::copy_n(m_cache[cacheSlot]->data.begin() + blockOffset, toRead, out); } @@ -76,7 +76,7 @@ namespace hex::prv { if (!slot || slot->index != blockIndex) { std::vector blockData(m_cacheBlockSize); readFromSource(blockIndex * m_cacheBlockSize, blockData.data(), m_cacheBlockSize); - slot = Block { blockIndex, std::move(blockData), false }; + slot = Block { .index=blockIndex, .data=std::move(blockData), .dirty=false }; } std::copy_n(in, toWrite, slot->data.begin() + blockOffset); diff --git a/lib/libimhex/source/providers/provider.cpp b/lib/libimhex/source/providers/provider.cpp index 9ed32f0d0..b9764e663 100644 --- a/lib/libimhex/source/providers/provider.cpp +++ b/lib/libimhex/source/providers/provider.cpp @@ -57,7 +57,7 @@ namespace hex::prv { m_overlays.clear(); if (auto selection = ImHexApi::HexEditor::getSelection(); selection.has_value() && selection->provider == this) - EventRegionSelected::post(ImHexApi::HexEditor::ProviderRegion { { 0x00, 0x00 }, nullptr }); + EventRegionSelected::post(ImHexApi::HexEditor::ProviderRegion { { .address=0x00, .size=0x00 }, nullptr }); } void Provider::read(u64 offset, void *buffer, size_t size, bool overlays) { @@ -289,19 +289,19 @@ namespace hex::prv { u64 absoluteAddress = address - this->getBaseAddress(); if (absoluteAddress < this->getActualSize()) - return { Region { this->getBaseAddress() + absoluteAddress, this->getActualSize() - absoluteAddress }, true }; + return { Region { .address=this->getBaseAddress() + absoluteAddress, .size=this->getActualSize() - absoluteAddress }, true }; bool insideValidRegion = false; std::optional nextRegionAddress; for (const auto &overlay : m_overlays) { - Region overlayRegion = { overlay->getAddress(), overlay->getSize() }; + Region overlayRegion = { .address=overlay->getAddress(), .size=overlay->getSize() }; if (!nextRegionAddress.has_value() || overlay->getAddress() < nextRegionAddress) { nextRegionAddress = overlayRegion.getStartAddress(); } - if (Region { address, 1 }.overlaps(overlayRegion)) { + if (Region { .address=address, .size=1 }.overlaps(overlayRegion)) { insideValidRegion = true; } } @@ -309,7 +309,7 @@ namespace hex::prv { if (!nextRegionAddress.has_value()) return { Region::Invalid(), false }; else - return { Region { address, *nextRegionAddress - address }, insideValidRegion }; + return { Region { .address=address, .size=*nextRegionAddress - address }, insideValidRegion }; } diff --git a/lib/libimhex/source/test/tests.cpp b/lib/libimhex/source/test/tests.cpp index 5ce4bbe1f..ab4514b3b 100644 --- a/lib/libimhex/source/test/tests.cpp +++ b/lib/libimhex/source/test/tests.cpp @@ -5,7 +5,7 @@ namespace hex::test { static std::map s_tests; int Tests::addTest(const std::string &name, Function func, bool shouldFail) noexcept { s_tests.insert({ - name, { func, shouldFail } + name, { .function=func, .shouldFail=shouldFail } }); return 0; diff --git a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp index 815c4c91d..d3048e398 100644 --- a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp +++ b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -1370,9 +1371,9 @@ namespace ImGuiExt { bool VSliderAngle(const char* label, const ImVec2& size, float* v_rad, float v_degrees_min, float v_degrees_max, const char* format, ImGuiSliderFlags flags) { if (format == nullptr) format = "%.0f deg"; - float v_deg = (*v_rad) * 360.0F / (2 * IM_PI); + float v_deg = (*v_rad) * 360.0F / (2 * std::numbers::pi_v); bool value_changed = ImGui::VSliderFloat(label, size, &v_deg, v_degrees_min, v_degrees_max, format, flags); - *v_rad = v_deg * (2 * IM_PI) / 360.0F; + *v_rad = v_deg * (2 * std::numbers::pi_v) / 360.0F; return value_changed; } diff --git a/lib/trace/source/stacktrace.cpp b/lib/trace/source/stacktrace.cpp index 1028a3f7d..cf018bdb3 100644 --- a/lib/trace/source/stacktrace.cpp +++ b/lib/trace/source/stacktrace.cpp @@ -232,10 +232,10 @@ static std::mutex s_traceMutex; auto fileName = info.dli_fname != nullptr ? std::filesystem::path(info.dli_fname).filename().string() : "??"; auto demangledName = info.dli_sname != nullptr ? demangle(info.dli_sname) : "??"; - result.push_back(StackFrame { std::move(fileName), std::move(demangledName), 0 }); + result.push_back(StackFrame { .file=std::move(fileName), .function=std::move(demangledName), .line=0 }); } - return StackTraceResult{ result, "execinfo" }; + return StackTraceResult{ .stackFrames=result, .implementationName="execinfo" }; } } diff --git a/main/gui/source/init/splash_window.cpp b/main/gui/source/init/splash_window.cpp index 281c373ee..9788e728b 100644 --- a/main/gui/source/init/splash_window.cpp +++ b/main/gui/source/init/splash_window.cpp @@ -42,7 +42,7 @@ namespace hex::init { RequestAddInitTask::subscribe([this](const std::string& name, bool async, const TaskFunction &function){ std::scoped_lock guard(m_progressMutex); - m_tasks.push_back(Task{ name, function, async, false }); + m_tasks.push_back(Task{ .name=name, .callback=function, .async=async, .running=false }); m_totalTaskCount += 1; m_progress = float(m_completedTaskCount) / float(m_totalTaskCount); }); diff --git a/main/updater/source/main.cpp b/main/updater/source/main.cpp index 82dfd8c3e..38b7d918b 100644 --- a/main/updater/source/main.cpp +++ b/main/updater/source/main.cpp @@ -153,14 +153,14 @@ bool installUpdate(const std::fs::path &updatePath) { }; const static auto UpdateHandlers = { - UpdateHandler { ".msi", "msiexec /i \"{}\" /qb" }, - UpdateHandler { ".dmg", "hdiutil attach -autoopen \"{}\"" }, - UpdateHandler { ".deb", "zenity --password | sudo -S apt install -y --fix-broken \"{}\"" }, - UpdateHandler { ".rpm", "zenity --password | sudo -S rpm -i \"{}\"" }, - UpdateHandler { ".pkg.tar.zst", "zenity --password | sudo -S pacman -Syy && sudo pacman -U --noconfirm \"{}\"" }, - UpdateHandler { ".AppImage", fmt::format(R"(zenity --password | sudo -S cp "{{}}" "{}")", hex::getEnvironmentVariable("APPIMAGE").value_or("")) }, - UpdateHandler { ".flatpak", "zenity --password | sudo -S flatpak install -y --reinstall \"{}\"" }, - UpdateHandler { ".snap", "zenity --password | sudo -S snap install --dangerous \"{}\"" }, + UpdateHandler { .ending=".msi", .command="msiexec /i \"{}\" /qb" }, + UpdateHandler { .ending=".dmg", .command="hdiutil attach -autoopen \"{}\"" }, + UpdateHandler { .ending=".deb", .command="zenity --password | sudo -S apt install -y --fix-broken \"{}\"" }, + UpdateHandler { .ending=".rpm", .command="zenity --password | sudo -S rpm -i \"{}\"" }, + UpdateHandler { .ending=".pkg.tar.zst", .command="zenity --password | sudo -S pacman -Syy && sudo pacman -U --noconfirm \"{}\"" }, + UpdateHandler { .ending=".AppImage", .command=fmt::format(R"(zenity --password | sudo -S cp "{{}}" "{}")", hex::getEnvironmentVariable("APPIMAGE").value_or("")) }, + UpdateHandler { .ending=".flatpak", .command="zenity --password | sudo -S flatpak install -y --reinstall \"{}\"" }, + UpdateHandler { .ending=".snap", .command="zenity --password | sudo -S snap install --dangerous \"{}\"" }, }; const auto updateFileName = wolv::util::toUTF8String(updatePath.filename()); diff --git a/plugins/builtin/source/content/data_information_sections.cpp b/plugins/builtin/source/content/data_information_sections.cpp index e931b7737..46d725792 100644 --- a/plugins/builtin/source/content/data_information_sections.cpp +++ b/plugins/builtin/source/content/data_information_sections.cpp @@ -117,7 +117,7 @@ namespace hex::plugin::builtin { // Retry analysis with only the first 100 KiB if (region.getSize() != 100_kiB) { - process(task, provider, { region.getStartAddress(), 100_kiB }); + process(task, provider, { .address=region.getStartAddress(), .size=100_kiB }); } } } diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index 123644e7a..e12c43b0a 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -134,7 +134,7 @@ namespace hex::plugin::builtin { if (ImGui::MenuItemEx("hex.builtin.inspector.jump_to_address"_lang, ICON_VS_DEBUG_STEP_OUT)) { auto address = bufferToInteger(buffer, endian); if (address >= 0) { - ImHexApi::HexEditor::setSelection(Region { u64(address), sizeof(u8) }); + ImHexApi::HexEditor::setSelection(Region { .address=u64(address), .size=sizeof(u8) }); } } }); @@ -318,7 +318,7 @@ namespace hex::plugin::builtin { } ); - ContentRegistry::DataInspector::add("hex.builtin.inspector.fixed_point", 1, [totalBits = int(16), fractionBits = int(8)](const std::vector &, std::endian endian, Style style) mutable { + ContentRegistry::DataInspector::add("hex.builtin.inspector.fixed_point", 1, [totalBits = 16, fractionBits = 8](const std::vector &, std::endian endian, Style style) mutable { std::string value; auto provider = ImHexApi::Provider::get(); diff --git a/plugins/builtin/source/content/main_menu_items.cpp b/plugins/builtin/source/content/main_menu_items.cpp index fb4912837..0c0e09cdb 100644 --- a/plugins/builtin/source/content/main_menu_items.cpp +++ b/plugins/builtin/source/content/main_menu_items.cpp @@ -231,7 +231,7 @@ namespace hex::plugin::builtin { auto selection = ImHexApi::HexEditor::getSelection() .value_or( ImHexApi::HexEditor::ProviderRegion { - { provider->getBaseAddress(), provider->getSize() }, + { .address=provider->getBaseAddress(), .size=provider->getSize() }, provider }); diff --git a/plugins/builtin/source/content/minimap_visualizers.cpp b/plugins/builtin/source/content/minimap_visualizers.cpp index f44a3630a..e3f1bc6f7 100644 --- a/plugins/builtin/source/content/minimap_visualizers.cpp +++ b/plugins/builtin/source/content/minimap_visualizers.cpp @@ -122,7 +122,7 @@ namespace hex::plugin::builtin { if (!result.has_value()) { for (const auto &[id, highlighting] : ImHexApi::HexEditor::impl::getBackgroundHighlights()) { - if (highlighting.getRegion().overlaps({ address, 1 })) { + if (highlighting.getRegion().overlaps({ .address=address, .size=1 })) { result = highlighting.getColor(); break; } @@ -133,7 +133,7 @@ namespace hex::plugin::builtin { result->Value.w = 1.0F; } else { if (auto region = ImHexApi::HexEditor::getSelection(); region.has_value()) { - if (region->overlaps({ address + i, 1 })) + if (region->overlaps({ .address=address + i, .size=1 })) result = 0x60C08080; } } diff --git a/plugins/builtin/source/content/pl_builtin_functions.cpp b/plugins/builtin/source/content/pl_builtin_functions.cpp index dd0c06b88..af113674a 100644 --- a/plugins/builtin/source/content/pl_builtin_functions.cpp +++ b/plugins/builtin/source/content/pl_builtin_functions.cpp @@ -27,7 +27,7 @@ namespace hex::plugin::builtin { auto selection = ImHexApi::HexEditor::getSelection(); - return u128(u128(selection->getStartAddress()) << 64 | u128(selection->getSize())); + return (u128(selection->getStartAddress()) << 64 | u128(selection->getSize())); }); /* add_virtual_file(path, pattern) */ diff --git a/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_find.cpp b/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_find.cpp index 9cdf25a54..1b8769622 100644 --- a/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_find.cpp +++ b/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_find.cpp @@ -249,7 +249,7 @@ namespace hex::plugin::builtin { auto occurrence = searchFunction(reader.begin(), reader.end(), sequence.begin(), sequence.end()); if (occurrence != reader.end()) { - return Region{occurrence.getAddress(), sequence.size()}; + return Region{.address=occurrence.getAddress(), .size=sequence.size()}; } } else { if (m_reachedEnd || !m_foundRegion.has_value()) { @@ -261,7 +261,7 @@ namespace hex::plugin::builtin { auto occurrence = searchFunction(reader.rbegin(), reader.rend(), sequence.rbegin(), sequence.rend()); if (occurrence != reader.rend()) { - return Region{occurrence.getAddress() - (sequence.size() - 1), sequence.size()}; + return Region{.address=occurrence.getAddress() - (sequence.size() - 1), .size=sequence.size()}; } } diff --git a/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_select.cpp b/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_select.cpp index 12c6f33c3..00faf0e07 100644 --- a/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_select.cpp +++ b/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_select.cpp @@ -8,7 +8,7 @@ namespace hex::plugin::builtin { - PopupSelect::PopupSelect(u64 address, size_t size) : m_region({address, size}) {} + PopupSelect::PopupSelect(u64 address, size_t size) : m_region({.address=address, .size=size}) {} void PopupSelect::draw(ViewHexEditor *editor) { if (ImGui::BeginTabBar("select_tabs")) { @@ -26,7 +26,7 @@ namespace hex::plugin::builtin { if (inputB < inputA) inputB = inputA; - m_region = { inputA, (inputB - inputA) + 1 }; + m_region = { .address=inputA, .size=(inputB - inputA) + 1 }; ImGui::EndTabItem(); } @@ -45,7 +45,7 @@ namespace hex::plugin::builtin { if (inputB <= 0) inputB = 1; - m_region = { inputA, inputB }; + m_region = { .address=inputA, .size=inputB }; ImGui::EndTabItem(); } diff --git a/plugins/builtin/source/content/providers/disk_provider.cpp b/plugins/builtin/source/content/providers/disk_provider.cpp index 1338f40a0..9be1d7f3d 100644 --- a/plugins/builtin/source/content/providers/disk_provider.cpp +++ b/plugins/builtin/source/content/providers/disk_provider.cpp @@ -521,7 +521,7 @@ namespace hex::plugin::builtin { address -= this->getBaseAddress(); if (address < this->getActualSize()) - return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true }; + return { Region { .address=this->getBaseAddress() + address, .size=this->getActualSize() - address }, true }; else return { Region::Invalid(), false }; } diff --git a/plugins/builtin/source/content/providers/file_provider.cpp b/plugins/builtin/source/content/providers/file_provider.cpp index ba32635a5..05b509004 100644 --- a/plugins/builtin/source/content/providers/file_provider.cpp +++ b/plugins/builtin/source/content/providers/file_provider.cpp @@ -187,9 +187,9 @@ namespace hex::plugin::builtin { MenuEntry loadMenuItem; if (m_loadedIntoMemory) - loadMenuItem = { "hex.builtin.provider.file.menu.direct_access"_lang, ICON_VS_ARROW_SWAP, [this] { this->convertToDirectAccess(); } }; + loadMenuItem = { .name="hex.builtin.provider.file.menu.direct_access"_lang, .icon=ICON_VS_ARROW_SWAP, .callback=[this] { this->convertToDirectAccess(); } }; else - loadMenuItem = { "hex.builtin.provider.file.menu.into_memory"_lang, ICON_VS_ARROW_SWAP, [this] { this->convertToMemoryFile(); } }; + loadMenuItem = { .name="hex.builtin.provider.file.menu.into_memory"_lang, .icon=ICON_VS_ARROW_SWAP, .callback=[this] { this->convertToMemoryFile(); } }; return { { "hex.builtin.provider.file.menu.open_folder"_lang, ICON_VS_FOLDER_OPENED, [this] { fs::openFolderWithSelectionExternal(m_path); } }, @@ -342,7 +342,7 @@ namespace hex::plugin::builtin { address -= this->getBaseAddress(); if (address < this->getActualSize()) - return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true }; + return { Region { .address=this->getBaseAddress() + address, .size=this->getActualSize() - address }, true }; else return { Region::Invalid(), false }; } diff --git a/plugins/builtin/source/content/providers/gdb_provider.cpp b/plugins/builtin/source/content/providers/gdb_provider.cpp index d9aed184f..25786efef 100644 --- a/plugins/builtin/source/content/providers/gdb_provider.cpp +++ b/plugins/builtin/source/content/providers/gdb_provider.cpp @@ -319,7 +319,7 @@ namespace hex::plugin::builtin { address -= this->getBaseAddress(); if (address < this->getActualSize()) - return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true }; + return { Region { .address=this->getBaseAddress() + address, .size=this->getActualSize() - address }, true }; else return { Region::Invalid(), false }; } diff --git a/plugins/builtin/source/content/providers/intel_hex_provider.cpp b/plugins/builtin/source/content/providers/intel_hex_provider.cpp index c0e3d5273..0f610ff95 100644 --- a/plugins/builtin/source/content/providers/intel_hex_provider.cpp +++ b/plugins/builtin/source/content/providers/intel_hex_provider.cpp @@ -165,11 +165,11 @@ namespace hex::plugin::builtin { void IntelHexProvider::setBaseAddress(u64 address) { auto oldBase = this->getBaseAddress(); - auto regions = m_data.overlapping({ oldBase, oldBase + this->getActualSize() }); + auto regions = m_data.overlapping({ .start=oldBase, .end=oldBase + this->getActualSize() }); decltype(m_data) newIntervals; for (auto &[interval, data] : regions) { - newIntervals.insert({ interval.start - oldBase + address, interval.end - oldBase + address }, *data); + newIntervals.insert({ .start=interval.start - oldBase + address, .end=interval.end - oldBase + address }, *data); } m_data = newIntervals; @@ -177,7 +177,7 @@ namespace hex::plugin::builtin { } void IntelHexProvider::readRaw(u64 offset, void *buffer, size_t size) { - auto intervals = m_data.overlapping({ offset, (offset + size) - 1 }); + auto intervals = m_data.overlapping({ .start=offset, .end=(offset + size) - 1 }); std::memset(buffer, 0x00, size); auto bytes = static_cast(buffer); @@ -222,7 +222,7 @@ namespace hex::plugin::builtin { blockSize += bytes.size(); prevAddrEnd = endAddress; - m_data.emplace({ address, endAddress }, std::move(bytes)); + m_data.emplace({ .start=address, .end=endAddress }, std::move(bytes)); if (endAddress > maxAddress) maxAddress = endAddress; } @@ -305,18 +305,18 @@ namespace hex::plugin::builtin { } std::pair IntelHexProvider::getRegionValidity(u64 address) const { - auto intervals = m_data.overlapping({ address, address }); + auto intervals = m_data.overlapping({ .start=address, .end=address }); if (intervals.empty()) { return { Region(address, 1), false }; } - decltype(m_data)::Interval closestInterval = { 0, 0 }; + decltype(m_data)::Interval closestInterval = { .start=0, .end=0 }; for (const auto &[interval, data] : intervals) { if (interval.start <= closestInterval.end) closestInterval = interval; } - return { Region { closestInterval.start, (closestInterval.end - closestInterval.start) + 1}, Provider::getRegionValidity(address).second }; + return { Region { .address=closestInterval.start, .size=(closestInterval.end - closestInterval.start) + 1}, Provider::getRegionValidity(address).second }; } bool IntelHexProvider::memoryRegionFilter(const std::string& search, const MemoryRegion& memoryRegion) { diff --git a/plugins/builtin/source/content/providers/memory_file_provider.cpp b/plugins/builtin/source/content/providers/memory_file_provider.cpp index b9edf4f56..8bf10408d 100644 --- a/plugins/builtin/source/content/providers/memory_file_provider.cpp +++ b/plugins/builtin/source/content/providers/memory_file_provider.cpp @@ -80,7 +80,7 @@ namespace hex::plugin::builtin { std::vector MemoryFileProvider::getMenuEntries() { return { - MenuEntry { Lang("hex.builtin.provider.mem_file.rename"), ICON_VS_TAG, [this] { this->renameFile(); } } + MenuEntry { .name=Lang("hex.builtin.provider.mem_file.rename"), .icon=ICON_VS_TAG, .callback=[this] { this->renameFile(); } } }; } @@ -88,7 +88,7 @@ namespace hex::plugin::builtin { address -= this->getBaseAddress(); if (address < this->getActualSize()) - return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true }; + return { Region { .address=this->getBaseAddress() + address, .size=this->getActualSize() - address }, true }; else return { Region::Invalid(), false }; } diff --git a/plugins/builtin/source/content/providers/process_memory_provider.cpp b/plugins/builtin/source/content/providers/process_memory_provider.cpp index 01dffa810..ae8faa07a 100644 --- a/plugins/builtin/source/content/providers/process_memory_provider.cpp +++ b/plugins/builtin/source/content/providers/process_memory_provider.cpp @@ -187,7 +187,7 @@ namespace hex::plugin::builtin { std::pair ProcessMemoryProvider::getRegionValidity(u64 address) const { for (const auto &memoryRegion : m_memoryRegions) { - if (memoryRegion.region.overlaps({ address, 1LLU })) + if (memoryRegion.region.overlaps({ .address=address, .size=1LLU })) return { memoryRegion.region, true }; } @@ -195,7 +195,7 @@ namespace hex::plugin::builtin { for (const auto &memoryRegion : m_memoryRegions) { if (address < memoryRegion.region.getStartAddress()) - return { Region { lastRegion.getEndAddress(), memoryRegion.region.getStartAddress() - lastRegion.getEndAddress() }, false }; + return { Region { .address=lastRegion.getEndAddress(), .size=memoryRegion.region.getStartAddress() - lastRegion.getEndAddress() }, false }; lastRegion = memoryRegion.region; } @@ -561,7 +561,7 @@ namespace hex::plugin::builtin { if (split.size() > 5) name = wolv::util::trim(wolv::util::combineStrings(std::vector(split.begin() + 5, split.end()), " ")); - m_memoryRegions.insert({ { start, end - start }, name }); + m_memoryRegions.insert({ { .address=start, .size=end - start }, name }); } #endif } diff --git a/plugins/builtin/source/content/providers/view_provider.cpp b/plugins/builtin/source/content/providers/view_provider.cpp index a91e2494a..6fe3232c4 100644 --- a/plugins/builtin/source/content/providers/view_provider.cpp +++ b/plugins/builtin/source/content/providers/view_provider.cpp @@ -182,14 +182,14 @@ namespace hex::plugin::builtin { address -= this->getBaseAddress(); if (address < this->getActualSize()) - return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true }; + return { Region { .address=this->getBaseAddress() + address, .size=this->getActualSize() - address }, true }; else return { Region::Invalid(), false }; } std::vector ViewProvider::getMenuEntries() { return { - MenuEntry { Lang("hex.builtin.provider.rename"), ICON_VS_TAG, [this] { this->renameFile(); } } + MenuEntry { .name=Lang("hex.builtin.provider.rename"), .icon=ICON_VS_TAG, .callback=[this] { this->renameFile(); } } }; } diff --git a/plugins/builtin/source/content/text_highlighting/pattern_language.cpp b/plugins/builtin/source/content/text_highlighting/pattern_language.cpp index d7d8e8fee..851098926 100644 --- a/plugins/builtin/source/content/text_highlighting/pattern_language.cpp +++ b/plugins/builtin/source/content/text_highlighting/pattern_language.cpp @@ -865,7 +865,7 @@ namespace hex::plugin::builtin { } } - return nameSpace != ""; + return !nameSpace.empty(); } //The context is the name of the function or UDT that the variable is in. diff --git a/plugins/builtin/source/content/themes.cpp b/plugins/builtin/source/content/themes.cpp index 7d047ebfe..bf539ef6d 100644 --- a/plugins/builtin/source/content/themes.cpp +++ b/plugins/builtin/source/content/themes.cpp @@ -284,55 +284,55 @@ namespace hex::plugin::builtin { { auto &style = ImGui::GetStyle(); const static ThemeManager::StyleMap ImGuiStyleMap = { - { "alpha", { &style.Alpha, 0.1F, 1.0F, false } }, - { "disabled-alpha", { &style.DisabledAlpha, 0.0F, 1.0F, false } }, - { "window-padding", { &style.WindowPadding, 0.0F, 20.0F, true } }, - { "window-rounding", { &style.WindowRounding, 0.0F, 12.0F, true } }, - { "window-border-size", { &style.WindowBorderSize, 0.0F, 1.0F, true } }, - { "window-border-hover-padding", { &style.WindowBorderHoverPadding, 1.0F, 20.0F, true } }, - { "window-min-size", { &style.WindowMinSize, 0.0F, 1000.0F, true } }, - { "window-title-align", { &style.WindowTitleAlign, 0.0F, 1.0F, false } }, - { "child-rounding", { &style.ChildRounding, 0.0F, 12.0F, true } }, - { "child-border-size", { &style.ChildBorderSize, 0.0F, 1.0F, true } }, - { "popup-rounding", { &style.PopupRounding, 0.0F, 12.0F, true } }, - { "popup-border-size", { &style.PopupBorderSize, 0.0F, 1.0F, true } }, - { "frame-padding", { &style.FramePadding, 0.0F, 20.0F, true } }, - { "frame-rounding", { &style.FrameRounding, 0.0F, 12.0F, true } }, - { "frame-border-size", { &style.FrameBorderSize, 0.0F, 1.0F, true } }, - { "item-spacing", { &style.ItemSpacing, 0.0F, 20.0F, true } }, - { "item-inner-spacing", { &style.ItemInnerSpacing, 0.0F, 20.0F, true } }, - { "indent-spacing", { &style.IndentSpacing, 0.0F, 30.0F, true } }, - { "cell-padding", { &style.CellPadding, 0.0F, 20.0F, true } }, - { "touch-extra-padding", { &style.TouchExtraPadding, 0.0F, 10.0F, true } }, - { "columns-min-spacing", { &style.ColumnsMinSpacing, 0.0F, 20.0F, true } }, - { "scrollbar-size", { &style.ScrollbarSize, 0.0F, 20.0F, true } }, - { "scrollbar-rounding", { &style.ScrollbarRounding, 0.0F, 12.0F, true } }, - { "grab-min-size", { &style.GrabMinSize, 0.0F, 20.0F, true } }, - { "grab-rounding", { &style.GrabRounding, 0.0F, 12.0F, true } }, - { "log-slider-deadzone", { &style.LogSliderDeadzone, 0.0F, 12.0F, true } }, - { "image-border-size", { &style.ImageBorderSize, 0.0F, 1.0F, true } }, - { "tab-rounding", { &style.TabRounding, 0.0F, 12.0F, true } }, - { "tab-border-size", { &style.TabBorderSize, 0.0F, 1.0F, true } }, - { "tab-min-width-base", { &style.TabMinWidthBase, 0.0F, 500.0F, true } }, - { "tab-min-width-shrink", { &style.TabMinWidthShrink, 0.0F, 500.0F, true } }, - { "tab-close-button-min-width-selected", { &style.TabCloseButtonMinWidthSelected, -1.0F, 100.0F, false } }, - { "tab-close-button-min-width-unselected", { &style.TabCloseButtonMinWidthUnselected, -1.0F, 100.0F, false } }, - { "tab-bar-border-size", { &style.TabBarBorderSize, 0.0F, 10.0F, true } }, - { "tab-bar-overline-size", { &style.TabBarOverlineSize, 0.0F, 10.0F, true } }, - { "button-text-align", { &style.ButtonTextAlign, 0.0F, 1.0F, false } }, - { "selectable-text-align", { &style.SelectableTextAlign, 0.0F, 1.0F, false } }, - { "separator-text-border-size", { &style.SeparatorTextBorderSize, 0.0F, 5.0F, true } }, - { "separator-text-align", { &style.SeparatorTextAlign, 0.0F, 1.0F, false } }, - { "separator-text-padding", { &style.SeparatorTextPadding, 0.0F, 20.0F, true } }, - { "display-window-padding", { &style.DisplayWindowPadding, 0.0F, 20.0F, true } }, - { "display-safe-area-padding", { &style.DisplaySafeAreaPadding, 0.0F, 20.0F, true } }, - { "docking-separator-size", { &style.DockingSeparatorSize, 0.0F, 20.0F, true } }, - { "mouse-cursor-scale", { &style.MouseCursorScale, 0.1F, 10.0F, true } }, - { "curve-tessellation-tol", { &style.CurveTessellationTol, 0.0F, 10.0F, true } }, - { "circle-tessellation-max-error", { &style.CircleTessellationMaxError, 0.0F, 10.0F, true } }, - { "window-shadow-size", { &style.WindowShadowSize, 0.0F, 100.0F, true } }, - { "window-shadow-offset", { &style.WindowShadowOffsetDist, 0.0F, 100.0F, true } }, - { "window-shadow-angle", { &style.WindowShadowOffsetAngle, 0.0F, 10.0F, false } } + { "alpha", { .value=&style.Alpha, .min=0.1F, .max=1.0F, .needsScaling=false } }, + { "disabled-alpha", { .value=&style.DisabledAlpha, .min=0.0F, .max=1.0F, .needsScaling=false } }, + { "window-padding", { .value=&style.WindowPadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "window-rounding", { .value=&style.WindowRounding, .min=0.0F, .max=12.0F, .needsScaling=true } }, + { "window-border-size", { .value=&style.WindowBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } }, + { "window-border-hover-padding", { .value=&style.WindowBorderHoverPadding, .min=1.0F, .max=20.0F, .needsScaling=true } }, + { "window-min-size", { .value=&style.WindowMinSize, .min=0.0F, .max=1000.0F, .needsScaling=true } }, + { "window-title-align", { .value=&style.WindowTitleAlign, .min=0.0F, .max=1.0F, .needsScaling=false } }, + { "child-rounding", { .value=&style.ChildRounding, .min=0.0F, .max=12.0F, .needsScaling=true } }, + { "child-border-size", { .value=&style.ChildBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } }, + { "popup-rounding", { .value=&style.PopupRounding, .min=0.0F, .max=12.0F, .needsScaling=true } }, + { "popup-border-size", { .value=&style.PopupBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } }, + { "frame-padding", { .value=&style.FramePadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "frame-rounding", { .value=&style.FrameRounding, .min=0.0F, .max=12.0F, .needsScaling=true } }, + { "frame-border-size", { .value=&style.FrameBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } }, + { "item-spacing", { .value=&style.ItemSpacing, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "item-inner-spacing", { .value=&style.ItemInnerSpacing, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "indent-spacing", { .value=&style.IndentSpacing, .min=0.0F, .max=30.0F, .needsScaling=true } }, + { "cell-padding", { .value=&style.CellPadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "touch-extra-padding", { .value=&style.TouchExtraPadding, .min=0.0F, .max=10.0F, .needsScaling=true } }, + { "columns-min-spacing", { .value=&style.ColumnsMinSpacing, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "scrollbar-size", { .value=&style.ScrollbarSize, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "scrollbar-rounding", { .value=&style.ScrollbarRounding, .min=0.0F, .max=12.0F, .needsScaling=true } }, + { "grab-min-size", { .value=&style.GrabMinSize, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "grab-rounding", { .value=&style.GrabRounding, .min=0.0F, .max=12.0F, .needsScaling=true } }, + { "log-slider-deadzone", { .value=&style.LogSliderDeadzone, .min=0.0F, .max=12.0F, .needsScaling=true } }, + { "image-border-size", { .value=&style.ImageBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } }, + { "tab-rounding", { .value=&style.TabRounding, .min=0.0F, .max=12.0F, .needsScaling=true } }, + { "tab-border-size", { .value=&style.TabBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } }, + { "tab-min-width-base", { .value=&style.TabMinWidthBase, .min=0.0F, .max=500.0F, .needsScaling=true } }, + { "tab-min-width-shrink", { .value=&style.TabMinWidthShrink, .min=0.0F, .max=500.0F, .needsScaling=true } }, + { "tab-close-button-min-width-selected", { .value=&style.TabCloseButtonMinWidthSelected, .min=-1.0F, .max=100.0F, .needsScaling=false } }, + { "tab-close-button-min-width-unselected", { .value=&style.TabCloseButtonMinWidthUnselected, .min=-1.0F, .max=100.0F, .needsScaling=false } }, + { "tab-bar-border-size", { .value=&style.TabBarBorderSize, .min=0.0F, .max=10.0F, .needsScaling=true } }, + { "tab-bar-overline-size", { .value=&style.TabBarOverlineSize, .min=0.0F, .max=10.0F, .needsScaling=true } }, + { "button-text-align", { .value=&style.ButtonTextAlign, .min=0.0F, .max=1.0F, .needsScaling=false } }, + { "selectable-text-align", { .value=&style.SelectableTextAlign, .min=0.0F, .max=1.0F, .needsScaling=false } }, + { "separator-text-border-size", { .value=&style.SeparatorTextBorderSize, .min=0.0F, .max=5.0F, .needsScaling=true } }, + { "separator-text-align", { .value=&style.SeparatorTextAlign, .min=0.0F, .max=1.0F, .needsScaling=false } }, + { "separator-text-padding", { .value=&style.SeparatorTextPadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "display-window-padding", { .value=&style.DisplayWindowPadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "display-safe-area-padding", { .value=&style.DisplaySafeAreaPadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "docking-separator-size", { .value=&style.DockingSeparatorSize, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "mouse-cursor-scale", { .value=&style.MouseCursorScale, .min=0.1F, .max=10.0F, .needsScaling=true } }, + { "curve-tessellation-tol", { .value=&style.CurveTessellationTol, .min=0.0F, .max=10.0F, .needsScaling=true } }, + { "circle-tessellation-max-error", { .value=&style.CircleTessellationMaxError, .min=0.0F, .max=10.0F, .needsScaling=true } }, + { "window-shadow-size", { .value=&style.WindowShadowSize, .min=0.0F, .max=100.0F, .needsScaling=true } }, + { "window-shadow-offset", { .value=&style.WindowShadowOffsetDist, .min=0.0F, .max=100.0F, .needsScaling=true } }, + { "window-shadow-angle", { .value=&style.WindowShadowOffsetAngle, .min=0.0F, .max=10.0F, .needsScaling=false } } }; ThemeManager::addStyleHandler("imgui", ImGuiStyleMap); @@ -341,32 +341,32 @@ namespace hex::plugin::builtin { { auto &style = ImPlot::GetStyle(); const static ThemeManager::StyleMap ImPlotStyleMap = { - { "line-weight", { &style.LineWeight, 0.0F, 5.0F, true } }, - { "marker-size", { &style.MarkerSize, 2.0F, 10.0F, true } }, - { "marker-weight", { &style.MarkerWeight, 0.0F, 5.0F, true } }, - { "fill-alpha", { &style.FillAlpha, 0.0F, 1.0F, false } }, - { "error-bar-size", { &style.ErrorBarSize, 0.0F, 10.0F, true } }, - { "error-bar-weight", { &style.ErrorBarWeight, 0.0F, 5.0F, true } }, - { "digital-bit-height", { &style.DigitalBitHeight, 0.0F, 20.0F, true } }, - { "digital-bit-gap", { &style.DigitalBitGap, 0.0F, 20.0F, true } }, - { "plot-border-size", { &style.PlotBorderSize, 0.0F, 2.0F, true } }, - { "minor-alpha", { &style.MinorAlpha, 0.0F, 1.0F, false } }, - { "major-tick-len", { &style.MajorTickLen, 0.0F, 20.0F, true } }, - { "minor-tick-len", { &style.MinorTickLen, 0.0F, 20.0F, true } }, - { "major-tick-size", { &style.MajorTickSize, 0.0F, 2.0F, true } }, - { "minor-tick-size", { &style.MinorTickSize, 0.0F, 2.0F, true } }, - { "major-grid-size", { &style.MajorGridSize, 0.0F, 2.0F, true } }, - { "minor-grid-size", { &style.MinorGridSize, 0.0F, 2.0F, true } }, - { "plot-padding", { &style.PlotPadding, 0.0F, 20.0F, true } }, - { "label-padding", { &style.LabelPadding, 0.0F, 20.0F, true } }, - { "legend-padding", { &style.LegendPadding, 0.0F, 20.0F, true } }, - { "legend-inner-padding", { &style.LegendInnerPadding, 0.0F, 10.0F, true } }, - { "legend-spacing", { &style.LegendSpacing, 0.0F, 5.0F, true } }, - { "mouse-pos-padding", { &style.MousePosPadding, 0.0F, 20.0F, true } }, - { "annotation-padding", { &style.AnnotationPadding, 0.0F, 5.0F, true } }, - { "fit-padding", { &style.FitPadding, 0.0F, 0.2F, true } }, - { "plot-default-size", { &style.PlotDefaultSize, 0.0F, 1000.0F, true } }, - { "plot-min-size", { &style.PlotMinSize, 0.0F, 300.0F, true } }, + { "line-weight", { .value=&style.LineWeight, .min=0.0F, .max=5.0F, .needsScaling=true } }, + { "marker-size", { .value=&style.MarkerSize, .min=2.0F, .max=10.0F, .needsScaling=true } }, + { "marker-weight", { .value=&style.MarkerWeight, .min=0.0F, .max=5.0F, .needsScaling=true } }, + { "fill-alpha", { .value=&style.FillAlpha, .min=0.0F, .max=1.0F, .needsScaling=false } }, + { "error-bar-size", { .value=&style.ErrorBarSize, .min=0.0F, .max=10.0F, .needsScaling=true } }, + { "error-bar-weight", { .value=&style.ErrorBarWeight, .min=0.0F, .max=5.0F, .needsScaling=true } }, + { "digital-bit-height", { .value=&style.DigitalBitHeight, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "digital-bit-gap", { .value=&style.DigitalBitGap, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "plot-border-size", { .value=&style.PlotBorderSize, .min=0.0F, .max=2.0F, .needsScaling=true } }, + { "minor-alpha", { .value=&style.MinorAlpha, .min=0.0F, .max=1.0F, .needsScaling=false } }, + { "major-tick-len", { .value=&style.MajorTickLen, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "minor-tick-len", { .value=&style.MinorTickLen, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "major-tick-size", { .value=&style.MajorTickSize, .min=0.0F, .max=2.0F, .needsScaling=true } }, + { "minor-tick-size", { .value=&style.MinorTickSize, .min=0.0F, .max=2.0F, .needsScaling=true } }, + { "major-grid-size", { .value=&style.MajorGridSize, .min=0.0F, .max=2.0F, .needsScaling=true } }, + { "minor-grid-size", { .value=&style.MinorGridSize, .min=0.0F, .max=2.0F, .needsScaling=true } }, + { "plot-padding", { .value=&style.PlotPadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "label-padding", { .value=&style.LabelPadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "legend-padding", { .value=&style.LegendPadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "legend-inner-padding", { .value=&style.LegendInnerPadding, .min=0.0F, .max=10.0F, .needsScaling=true } }, + { "legend-spacing", { .value=&style.LegendSpacing, .min=0.0F, .max=5.0F, .needsScaling=true } }, + { "mouse-pos-padding", { .value=&style.MousePosPadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "annotation-padding", { .value=&style.AnnotationPadding, .min=0.0F, .max=5.0F, .needsScaling=true } }, + { "fit-padding", { .value=&style.FitPadding, .min=0.0F, .max=0.2F, .needsScaling=true } }, + { "plot-default-size", { .value=&style.PlotDefaultSize, .min=0.0F, .max=1000.0F, .needsScaling=true } }, + { "plot-min-size", { .value=&style.PlotMinSize, .min=0.0F, .max=300.0F, .needsScaling=true } }, }; ThemeManager::addStyleHandler("implot", ImPlotStyleMap); @@ -375,21 +375,21 @@ namespace hex::plugin::builtin { { auto &style = ImNodes::GetStyle(); const static ThemeManager::StyleMap ImNodesStyleMap = { - { "grid-spacing", { &style.GridSpacing, 0.0F, 100.0F, true } }, - { "node-corner-rounding", { &style.NodeCornerRounding, 0.0F, 12.0F, true } }, - { "node-padding", { &style.NodePadding, 0.0F, 20.0F, true } }, - { "node-border-thickness", { &style.NodeBorderThickness, 0.0F, 1.0F, true } }, - { "link-thickness", { &style.LinkThickness, 0.0F, 10.0F, true } }, - { "link-line-segments-per-length", { &style.LinkLineSegmentsPerLength, 0.0F, 2.0F, true } }, - { "link-hover-distance", { &style.LinkHoverDistance, 0.0F, 20.0F, true } }, - { "pin-circle-radius", { &style.PinCircleRadius, 0.0F, 20.0F, true } }, - { "pin-quad-side-length", { &style.PinQuadSideLength, 0.0F, 20.0F, true } }, - { "pin-triangle-side-length", { &style.PinTriangleSideLength, 0.0F, 20.0F, true } }, - { "pin-line-thickness", { &style.PinLineThickness, 0.0F, 5.0F, true } }, - { "pin-hover-radius", { &style.PinHoverRadius, 0.0F, 20.0F, true } }, - { "pin-offset", { &style.PinOffset, -10.0F, 10.0F, true } }, - { "mini-map-padding", { &style.MiniMapPadding, 0.0F, 20.0F, true } }, - { "mini-map-offset", { &style.MiniMapOffset, -10.0F, 10.0F, true } }, + { "grid-spacing", { .value=&style.GridSpacing, .min=0.0F, .max=100.0F, .needsScaling=true } }, + { "node-corner-rounding", { .value=&style.NodeCornerRounding, .min=0.0F, .max=12.0F, .needsScaling=true } }, + { "node-padding", { .value=&style.NodePadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "node-border-thickness", { .value=&style.NodeBorderThickness, .min=0.0F, .max=1.0F, .needsScaling=true } }, + { "link-thickness", { .value=&style.LinkThickness, .min=0.0F, .max=10.0F, .needsScaling=true } }, + { "link-line-segments-per-length", { .value=&style.LinkLineSegmentsPerLength, .min=0.0F, .max=2.0F, .needsScaling=true } }, + { "link-hover-distance", { .value=&style.LinkHoverDistance, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "pin-circle-radius", { .value=&style.PinCircleRadius, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "pin-quad-side-length", { .value=&style.PinQuadSideLength, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "pin-triangle-side-length", { .value=&style.PinTriangleSideLength, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "pin-line-thickness", { .value=&style.PinLineThickness, .min=0.0F, .max=5.0F, .needsScaling=true } }, + { "pin-hover-radius", { .value=&style.PinHoverRadius, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "pin-offset", { .value=&style.PinOffset, .min=-10.0F, .max=10.0F, .needsScaling=true } }, + { "mini-map-padding", { .value=&style.MiniMapPadding, .min=0.0F, .max=20.0F, .needsScaling=true } }, + { "mini-map-offset", { .value=&style.MiniMapOffset, .min=-10.0F, .max=10.0F, .needsScaling=true } }, }; ThemeManager::addStyleHandler("imnodes", ImNodesStyleMap); @@ -398,8 +398,8 @@ namespace hex::plugin::builtin { { auto &style = ImGuiExt::GetCustomStyle(); const static ThemeManager::StyleMap ImHexStyleMap = { - { "window-blur", { &style.WindowBlur, 0.0F, 1.0F, true } }, - { "popup-alpha", { &style.PopupWindowAlpha, 0.0F, 1.0F, false } }, + { "window-blur", { .value=&style.WindowBlur, .min=0.0F, .max=1.0F, .needsScaling=true } }, + { "popup-alpha", { .value=&style.PopupWindowAlpha, .min=0.0F, .max=1.0F, .needsScaling=false } }, }; ThemeManager::addStyleHandler("imhex", ImHexStyleMap); diff --git a/plugins/builtin/source/content/tools/color_picker.cpp b/plugins/builtin/source/content/tools/color_picker.cpp index 51d46bfb5..4d8df88b9 100644 --- a/plugins/builtin/source/content/tools/color_picker.cpp +++ b/plugins/builtin/source/content/tools/color_picker.cpp @@ -24,10 +24,10 @@ namespace hex::plugin::builtin { }; static std::array bitValues = { - BitValue{ 8, 0.00F, 1.0F, "R", 0 }, - BitValue{ 8, 0.33F, 1.0F, "G", 1 }, - BitValue{ 8, 0.66F, 1.0F, "B", 2 }, - BitValue{ 8, 0.00F, 0.0F, "A", 3 } + BitValue{ .bits=8, .color=0.00F, .saturationMultiplier=1.0F, .name="R", .index=0 }, + BitValue{ .bits=8, .color=0.33F, .saturationMultiplier=1.0F, .name="G", .index=1 }, + BitValue{ .bits=8, .color=0.66F, .saturationMultiplier=1.0F, .name="B", .index=2 }, + BitValue{ .bits=8, .color=0.00F, .saturationMultiplier=0.0F, .name="A", .index=3 } }; if (ImGui::BeginTable("##color_picker_table", 3, ImGuiTableFlags_BordersInnerV)) { diff --git a/plugins/builtin/source/content/tools/ieee_decoder.cpp b/plugins/builtin/source/content/tools/ieee_decoder.cpp index f6d03b7d8..065ff538d 100644 --- a/plugins/builtin/source/content/tools/ieee_decoder.cpp +++ b/plugins/builtin/source/content/tools/ieee_decoder.cpp @@ -25,7 +25,7 @@ namespace hex::plugin::builtin { class IEEE754STATICS { public: - IEEE754STATICS() {} + IEEE754STATICS() = default; u128 value = 0; i32 exponentBitCount = 8; diff --git a/plugins/builtin/source/content/tutorials/introduction.cpp b/plugins/builtin/source/content/tutorials/introduction.cpp index 5f1039fe0..e72b756ad 100644 --- a/plugins/builtin/source/content/tutorials/introduction.cpp +++ b/plugins/builtin/source/content/tutorials/introduction.cpp @@ -60,7 +60,7 @@ namespace hex::plugin::builtin { View::toWindowName("hex.builtin.view.data_inspector.name") }) .onAppear([]{ - ImHexApi::HexEditor::setSelection(Region { 0, 1 }); + ImHexApi::HexEditor::setSelection(Region { .address=0, .size=1 }); }) .allowSkip(); } diff --git a/plugins/builtin/source/content/views/view_about.cpp b/plugins/builtin/source/content/views/view_about.cpp index 7fd31c660..3a0616a07 100644 --- a/plugins/builtin/source/content/views/view_about.cpp +++ b/plugins/builtin/source/content/views/view_about.cpp @@ -294,21 +294,21 @@ namespace hex::plugin::builtin { }; constexpr static std::array Contributors = { - Contributor { "iTrooz", "A huge amount of help maintaining ImHex and the CI", "https://github.com/iTrooz", true }, - Contributor { "jumanji144", "A ton of help with the Pattern Language, API and usage stats", "https://github.com/jumanji144", true }, - Contributor { "AxCut", "A ton of great pattern language improvements and help with the issue tracker", "https://github.com/paxcut", true }, - Contributor { "Mary", "Porting ImHex to macOS originally", "https://github.com/marysaka", false }, - Contributor { "Roblabla", "Adding the MSI Windows installer", "https://github.com/roblabla", false }, - Contributor { "jam1garner", "Adding support for Rust plugins", "https://github.com/jam1garner", false }, - Contributor { "All other amazing contributors", "Being part of the community, opening issues, PRs and donating", "https://github.com/WerWolv/ImHex/graphs/contributors", false } + Contributor { .name="iTrooz", .description="A huge amount of help maintaining ImHex and the CI", .link="https://github.com/iTrooz", .mainContributor=true }, + Contributor { .name="jumanji144", .description="A ton of help with the Pattern Language, API and usage stats", .link="https://github.com/jumanji144", .mainContributor=true }, + Contributor { .name="AxCut", .description="A ton of great pattern language improvements and help with the issue tracker", .link="https://github.com/paxcut", .mainContributor=true }, + Contributor { .name="Mary", .description="Porting ImHex to macOS originally", .link="https://github.com/marysaka", .mainContributor=false }, + Contributor { .name="Roblabla", .description="Adding the MSI Windows installer", .link="https://github.com/roblabla", .mainContributor=false }, + Contributor { .name="jam1garner", .description="Adding support for Rust plugins", .link="https://github.com/jam1garner", .mainContributor=false }, + Contributor { .name="All other amazing contributors", .description="Being part of the community, opening issues, PRs and donating", .link="https://github.com/WerWolv/ImHex/graphs/contributors", .mainContributor=false } }; constexpr static std::array Testers = { - Contributor { "Nemoumbra", "Breaking my code literal seconds after I push it", "https://github.com/Nemoumbra", true }, - Contributor { "Berylskid", "", "https://github.com/Berylskid", false }, - Contributor { "Jan Polak", "", "https://github.com/polak-jan", false }, - Contributor { "Ken-Kaneki", "", "https://github.com/loneicewolf", false }, - Contributor { "Everybody who has reported issues", "Helping me find bugs and improve the software", "https://github.com/WerWolv/ImHex/issues", false } + Contributor { .name="Nemoumbra", .description="Breaking my code literal seconds after I push it", .link="https://github.com/Nemoumbra", .mainContributor=true }, + Contributor { .name="Berylskid", .description="", .link="https://github.com/Berylskid", .mainContributor=false }, + Contributor { .name="Jan Polak", .description="", .link="https://github.com/polak-jan", .mainContributor=false }, + Contributor { .name="Ken-Kaneki", .description="", .link="https://github.com/loneicewolf", .mainContributor=false }, + Contributor { .name="Everybody who has reported issues", .description="Helping me find bugs and improve the software", .link="https://github.com/WerWolv/ImHex/issues", .mainContributor=false } }; @@ -330,52 +330,52 @@ namespace hex::plugin::builtin { }; constexpr static std::array ImGuiLibraries = { - ExternalResource { "ImGui", "ocornut", "https://github.com/ocornut/imgui" }, - ExternalResource { "ImPlot", "epezent", "https://github.com/epezent/implot" }, - ExternalResource { "ImPlot3D", "brenocq", "https://github.com/brenocq/implot3d" }, - ExternalResource { "imnodes", "Nelarius", "https://github.com/Nelarius/imnodes" }, - ExternalResource { "ImGuiColorTextEdit", "BalazsJako", "https://github.com/BalazsJako/ImGuiColorTextEdit" }, + ExternalResource { .name="ImGui", .author="ocornut", .link="https://github.com/ocornut/imgui" }, + ExternalResource { .name="ImPlot", .author="epezent", .link="https://github.com/epezent/implot" }, + ExternalResource { .name="ImPlot3D", .author="brenocq", .link="https://github.com/brenocq/implot3d" }, + ExternalResource { .name="imnodes", .author="Nelarius", .link="https://github.com/Nelarius/imnodes" }, + ExternalResource { .name="ImGuiColorTextEdit", .author="BalazsJako", .link="https://github.com/BalazsJako/ImGuiColorTextEdit" }, }; constexpr static std::array ExternalLibraries = { - ExternalResource { "PatternLanguage", "WerWolv", "https://github.com/WerWolv/PatternLanguage" }, - ExternalResource { "libwolv", "WerWolv", "https://github.com/WerWolv/libwolv" }, - ExternalResource { "libromfs", "WerWolv", "https://github.com/WerWolv/libromfs" }, + ExternalResource { .name="PatternLanguage", .author="WerWolv", .link="https://github.com/WerWolv/PatternLanguage" }, + ExternalResource { .name="libwolv", .author="WerWolv", .link="https://github.com/WerWolv/libwolv" }, + ExternalResource { .name="libromfs", .author="WerWolv", .link="https://github.com/WerWolv/libromfs" }, }; constexpr static std::array ThirdPartyLibraries = { - ExternalResource { "json", "nlohmann", "https://github.com/nlohmann/json" }, - ExternalResource { "fmt", "fmtlib", "https://github.com/fmtlib/fmt" }, - ExternalResource { "nativefiledialog-extended", "btzy", "https://github.com/btzy/nativefiledialog-extended" }, - ExternalResource { "xdgpp", "danyspin97", "https://sr.ht/~danyspin97/xdgpp" }, - ExternalResource { "capstone", "aquynh", "https://github.com/aquynh/capstone" }, - ExternalResource { "microtar", "rxi", "https://github.com/rxi/microtar" }, - ExternalResource { "yara", "VirusTotal", "https://github.com/VirusTotal/yara" }, - ExternalResource { "edlib", "Martinsos", "https://github.com/Martinsos/edlib" }, - ExternalResource { "HashLibPlus", "ron4fun", "https://github.com/ron4fun/HashLibPlus" }, - ExternalResource { "miniaudio", "mackron", "https://github.com/mackron/miniaudio" }, - ExternalResource { "freetype", "freetype", "https://gitlab.freedesktop.org/freetype/freetype" }, - ExternalResource { "mbedTLS", "ARMmbed", "https://github.com/ARMmbed/mbedtls" }, - ExternalResource { "curl", "curl", "https://github.com/curl/curl" }, - ExternalResource { "file", "file", "https://github.com/file/file" }, - ExternalResource { "glfw", "glfw", "https://github.com/glfw/glfw" }, - ExternalResource { "llvm", "LLVM Maintainers", "https://github.com/llvm/llvm-project" }, - ExternalResource { "Boost.Regex", "John Maddock", "https://github.com/boostorg/regex" }, - ExternalResource { "md4c", "mity", "https://github.com/mity/md4c" }, - ExternalResource { "lunasvg", "sammycage", "https://github.com/sammycage/lunasvg" }, - ExternalResource { "zlib", "madler", "https://github.com/madler/zlib" }, - ExternalResource { "bzip2", "federicomenaquintero", "https://gitlab.com/federicomenaquintero/bzip2" }, - ExternalResource { "liblzma", "tukaani", "https://github.com/tukaani-project/xz" }, - ExternalResource { "zstd", "Facebook", "https://github.com/facebook/zstd" }, - ExternalResource { "libssh2", "libssh2 Maintainers", "https://github.com/libssh2/libssh2" }, + ExternalResource { .name="json", .author="nlohmann", .link="https://github.com/nlohmann/json" }, + ExternalResource { .name="fmt", .author="fmtlib", .link="https://github.com/fmtlib/fmt" }, + ExternalResource { .name="nativefiledialog-extended", .author="btzy", .link="https://github.com/btzy/nativefiledialog-extended" }, + ExternalResource { .name="xdgpp", .author="danyspin97", .link="https://sr.ht/~danyspin97/xdgpp" }, + ExternalResource { .name="capstone", .author="aquynh", .link="https://github.com/aquynh/capstone" }, + ExternalResource { .name="microtar", .author="rxi", .link="https://github.com/rxi/microtar" }, + ExternalResource { .name="yara", .author="VirusTotal", .link="https://github.com/VirusTotal/yara" }, + ExternalResource { .name="edlib", .author="Martinsos", .link="https://github.com/Martinsos/edlib" }, + ExternalResource { .name="HashLibPlus", .author="ron4fun", .link="https://github.com/ron4fun/HashLibPlus" }, + ExternalResource { .name="miniaudio", .author="mackron", .link="https://github.com/mackron/miniaudio" }, + ExternalResource { .name="freetype", .author="freetype", .link="https://gitlab.freedesktop.org/freetype/freetype" }, + ExternalResource { .name="mbedTLS", .author="ARMmbed", .link="https://github.com/ARMmbed/mbedtls" }, + ExternalResource { .name="curl", .author="curl", .link="https://github.com/curl/curl" }, + ExternalResource { .name="file", .author="file", .link="https://github.com/file/file" }, + ExternalResource { .name="glfw", .author="glfw", .link="https://github.com/glfw/glfw" }, + ExternalResource { .name="llvm", .author="LLVM Maintainers", .link="https://github.com/llvm/llvm-project" }, + ExternalResource { .name="Boost.Regex", .author="John Maddock", .link="https://github.com/boostorg/regex" }, + ExternalResource { .name="md4c", .author="mity", .link="https://github.com/mity/md4c" }, + ExternalResource { .name="lunasvg", .author="sammycage", .link="https://github.com/sammycage/lunasvg" }, + ExternalResource { .name="zlib", .author="madler", .link="https://github.com/madler/zlib" }, + ExternalResource { .name="bzip2", .author="federicomenaquintero", .link="https://gitlab.com/federicomenaquintero/bzip2" }, + ExternalResource { .name="liblzma", .author="tukaani", .link="https://github.com/tukaani-project/xz" }, + ExternalResource { .name="zstd", .author="Facebook", .link="https://github.com/facebook/zstd" }, + ExternalResource { .name="libssh2", .author="libssh2 Maintainers", .link="https://github.com/libssh2/libssh2" }, }; constexpr static std::array ThirdPartyResources { - ExternalResource { "VSCode Icons", "Microsoft", "https://github.com/microsoft/vscode-codicons" }, - ExternalResource { "Blender Icons", "Blender Maintainers", "https://github.com/blender/blender" }, - ExternalResource { "Tabler Icons", "codecalm", "https://github.com/tabler/tabler-icons" }, - ExternalResource { "JetBrains Mono", "JetBrains", "https://github.com/JetBrains/JetBrainsMono" }, - ExternalResource { "Unifont", "GNU", "https://unifoundry.com/unifont" }, + ExternalResource { .name="VSCode Icons", .author="Microsoft", .link="https://github.com/microsoft/vscode-codicons" }, + ExternalResource { .name="Blender Icons", .author="Blender Maintainers", .link="https://github.com/blender/blender" }, + ExternalResource { .name="Tabler Icons", .author="codecalm", .link="https://github.com/tabler/tabler-icons" }, + ExternalResource { .name="JetBrains Mono", .author="JetBrains", .link="https://github.com/JetBrains/JetBrainsMono" }, + ExternalResource { .name="Unifont", .author="GNU", .link="https://unifoundry.com/unifont" }, }; constexpr static auto drawTable = [](const char *category, const auto &libraries) { @@ -810,14 +810,14 @@ namespace hex::plugin::builtin { }; constexpr std::array Tabs = { - Tab { "ImHex", &ViewAbout::drawAboutMainPage }, - Tab { "hex.builtin.view.help.about.contributor", &ViewAbout::drawContributorPage }, - Tab { "hex.builtin.view.help.about.libs", &ViewAbout::drawLibraryCreditsPage }, - Tab { "hex.builtin.view.help.about.plugins", &ViewAbout::drawLoadedPlugins }, - Tab { "hex.builtin.view.help.about.paths", &ViewAbout::drawPathsPage }, - Tab { "hex.builtin.view.help.about.release_notes", &ViewAbout::drawReleaseNotesPage }, - Tab { "hex.builtin.view.help.about.commits", &ViewAbout::drawCommitHistoryPage }, - Tab { "hex.builtin.view.help.about.license", &ViewAbout::drawLicensePage }, + Tab { .unlocalizedName="ImHex", .function=&ViewAbout::drawAboutMainPage }, + Tab { .unlocalizedName="hex.builtin.view.help.about.contributor", .function=&ViewAbout::drawContributorPage }, + Tab { .unlocalizedName="hex.builtin.view.help.about.libs", .function=&ViewAbout::drawLibraryCreditsPage }, + Tab { .unlocalizedName="hex.builtin.view.help.about.plugins", .function=&ViewAbout::drawLoadedPlugins }, + Tab { .unlocalizedName="hex.builtin.view.help.about.paths", .function=&ViewAbout::drawPathsPage }, + Tab { .unlocalizedName="hex.builtin.view.help.about.release_notes", .function=&ViewAbout::drawReleaseNotesPage }, + Tab { .unlocalizedName="hex.builtin.view.help.about.commits", .function=&ViewAbout::drawCommitHistoryPage }, + Tab { .unlocalizedName="hex.builtin.view.help.about.license", .function=&ViewAbout::drawLicensePage }, }; // Allow the window to be closed by pressing ESC diff --git a/plugins/builtin/source/content/views/view_bookmarks.cpp b/plugins/builtin/source/content/views/view_bookmarks.cpp index 51bac3980..a31035977 100644 --- a/plugins/builtin/source/content/views/view_bookmarks.cpp +++ b/plugins/builtin/source/content/views/view_bookmarks.cpp @@ -41,12 +41,12 @@ namespace hex::plugin::builtin { *id = bookmarkId; auto bookmark = ImHexApi::Bookmarks::Entry { - region, - name, - std::move(comment), - color, - true, - bookmarkId + .region=region, + .name=name, + .comment=std::move(comment), + .color=color, + .locked=true, + .id=bookmarkId }; m_bookmarks->emplace_back(std::move(bookmark), true, ui::Markdown(bookmark.comment)); @@ -73,7 +73,7 @@ namespace hex::plugin::builtin { if (!bookmark.highlightVisible) continue; - if (Region { address, size }.isWithin(bookmark.entry.region)) { + if (Region { .address=address, .size=size }.isWithin(bookmark.entry.region)) { color = blendColors(color, bookmark.entry.color); } } @@ -91,7 +91,7 @@ namespace hex::plugin::builtin { continue; // Make sure the bookmark overlaps the currently hovered address - if (!Region { address, size }.isWithin(bookmark.region)) + if (!Region { .address=address, .size=size }.isWithin(bookmark.region)) continue; // Draw tooltip @@ -564,7 +564,7 @@ namespace hex::plugin::builtin { m_bookmarks.get(provider).push_back({ { - .region = { region["address"], region["size"] }, + .region = { .address=region["address"], .size=region["size"] }, .name = bookmark["name"], .comment = bookmark["comment"], .color = bookmark["color"], diff --git a/plugins/builtin/source/content/views/view_data_inspector.cpp b/plugins/builtin/source/content/views/view_data_inspector.cpp index 4b41ee87f..108075979 100644 --- a/plugins/builtin/source/content/views/view_data_inspector.cpp +++ b/plugins/builtin/source/content/views/view_data_inspector.cpp @@ -282,11 +282,11 @@ namespace hex::plugin::builtin { ImGui::BeginDisabled(!selection.has_value() || providerSize < requiredSize || selection->getStartAddress() < baseAddress + requiredSize); if (ImGuiExt::DimmedIconButton(ICON_TA_CHEVRON_LEFT_PIPE, ImGui::GetStyleColorVec4(ImGuiCol_Text), buttonSizeSmall)) { - ImHexApi::HexEditor::setSelection(Region { selection->getStartAddress() % requiredSize, requiredSize }); + ImHexApi::HexEditor::setSelection(Region { .address=selection->getStartAddress() % requiredSize, .size=requiredSize }); } ImGui::SameLine(); if (ImGuiExt::DimmedIconButton(ICON_TA_CHEVRON_LEFT, ImGui::GetStyleColorVec4(ImGuiCol_Text), buttonSize)) { - ImHexApi::HexEditor::setSelection(Region { selection->getStartAddress() - requiredSize, requiredSize }); + ImHexApi::HexEditor::setSelection(Region { .address=selection->getStartAddress() - requiredSize, .size=requiredSize }); } ImGui::EndDisabled(); @@ -294,11 +294,11 @@ namespace hex::plugin::builtin { ImGui::BeginDisabled(!selection.has_value() || providerSize < requiredSize || selection->getEndAddress() >= providerEndAddress - requiredSize); if (ImGuiExt::DimmedIconButton(ICON_TA_CHEVRON_RIGHT, ImGui::GetStyleColorVec4(ImGuiCol_Text), buttonSize)) { - ImHexApi::HexEditor::setSelection(Region { selection->getStartAddress() + requiredSize, requiredSize }); + ImHexApi::HexEditor::setSelection(Region { .address=selection->getStartAddress() + requiredSize, .size=requiredSize }); } ImGui::SameLine(); if (ImGuiExt::DimmedIconButton(ICON_TA_CHEVRON_RIGHT_PIPE, ImGui::GetStyleColorVec4(ImGuiCol_Text), buttonSizeSmall)) { - ImHexApi::HexEditor::setSelection(Region { providerEndAddress - selection->getStartAddress() % requiredSize - requiredSize, requiredSize }); + ImHexApi::HexEditor::setSelection(Region { .address=providerEndAddress - selection->getStartAddress() % requiredSize - requiredSize, .size=requiredSize }); } ImGui::EndDisabled(); } @@ -444,7 +444,7 @@ namespace hex::plugin::builtin { if (ImGui::Selectable("##InspectorLine", m_selectedEntryName == entry.unlocalizedName, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap | ImGuiSelectableFlags_AllowDoubleClick)) { m_selectedEntryName = entry.unlocalizedName; if (auto selection = ImHexApi::HexEditor::getSelection(); selection.has_value()) { - ImHexApi::HexEditor::setSelection(Region { selection->getStartAddress(), entry.requiredSize }); + ImHexApi::HexEditor::setSelection(Region { .address=selection->getStartAddress(), .size=entry.requiredSize }); } } diff --git a/plugins/builtin/source/content/views/view_data_processor.cpp b/plugins/builtin/source/content/views/view_data_processor.cpp index df1021d97..54c37a10e 100644 --- a/plugins/builtin/source/content/views/view_data_processor.cpp +++ b/plugins/builtin/source/content/views/view_data_processor.cpp @@ -622,7 +622,7 @@ namespace hex::plugin::builtin { nlohmann::json nodeJson = nlohmann::json::parse(file.readString()); // Add the loaded node to the list of custom nodes - m_customNodes.push_back(CustomNode { Lang(nodeJson.at("name").get()), nodeJson }); + m_customNodes.push_back(CustomNode { .name=Lang(nodeJson.at("name").get()), .data=nodeJson }); } catch (nlohmann::json::exception &e) { log::warn("Failed to load custom node '{}': {}", entry.path().string(), e.what()); } diff --git a/plugins/builtin/source/content/views/view_find.cpp b/plugins/builtin/source/content/views/view_find.cpp index 30ff59138..94b45c3a5 100644 --- a/plugins/builtin/source/content/views/view_find.cpp +++ b/plugins/builtin/source/content/views/view_find.cpp @@ -36,7 +36,7 @@ namespace hex::plugin::builtin { if (m_searchTask.isRunning()) return { }; - if (!m_occurrenceTree->overlapping({ address, address }).empty()) + if (!m_occurrenceTree->overlapping({ .start=address, .end=address }).empty()) return HighlightColor(); else return std::nullopt; @@ -49,7 +49,7 @@ namespace hex::plugin::builtin { if (m_searchTask.isRunning()) return; - auto occurrences = m_occurrenceTree->overlapping({ address, address + size }); + auto occurrences = m_occurrenceTree->overlapping({ .start=address, .end=address + size }); if (occurrences.empty()) return; @@ -131,7 +131,7 @@ namespace hex::plugin::builtin { } m_searchSettings.mode = SearchSettings::Mode::BinaryPattern; - m_searchSettings.region = { selection->getProvider()->getBaseAddress(), selection->getProvider()->getActualSize() }; + m_searchSettings.region = { .address=selection->getProvider()->getBaseAddress(), .size=selection->getProvider()->getActualSize() }; m_searchSettings.binaryPattern = { .input = sequence, .pattern = hex::BinaryPattern(sequence), @@ -303,7 +303,7 @@ namespace hex::plugin::builtin { remainingCharacters = 1; } else if ((byte & 0b1111'0000) == 0b1110'0000) { // 3-byte start (U+800..U+FFFF) - validChar = !(byte == 0xE0 || byte == 0xED); + validChar = byte != 0xE0 && byte != 0xED; // E0 must be followed by >= 0xA0, ED must be <= 0x9F (avoid surrogates) remainingCharacters = 2; } else if ((byte & 0b1111'1000) == 0b1111'0000) { @@ -324,7 +324,7 @@ namespace hex::plugin::builtin { if (!validChar || startAddress + countedCharacters == endAddress) { if (countedCharacters >= settings.minLength) { if (!settings.nullTermination || byte == 0x00) { - results.push_back(Occurrence { Region { startAddress, size_t(countedCharacters) }, endian, decodeType, false, {} }); + results.push_back(Occurrence { Region { .address=startAddress, .size=size_t(countedCharacters) }, endian, decodeType, false, {} }); } } @@ -412,7 +412,7 @@ namespace hex::plugin::builtin { auto address = occurrence.getAddress(); reader.seek(address + 1); - results.push_back(Occurrence{ Region { address, bytes.size() }, endian, decodeType, false, {} }); + results.push_back(Occurrence{ Region { .address=address, .size=bytes.size() }, endian, decodeType, false, {} }); progress = address - searchRegion.getStartAddress(); } @@ -473,7 +473,7 @@ namespace hex::plugin::builtin { if (matchedBytes == settings.pattern.getSize()) { auto occurrenceAddress = it.getAddress() - (patternSize - 1); - results.push_back(Occurrence { Region { occurrenceAddress, patternSize }, std::endian::native, Occurrence::DecodeType::Binary, false, {} }); + results.push_back(Occurrence { Region { .address=occurrenceAddress, .size=patternSize }, std::endian::native, Occurrence::DecodeType::Binary, false, {} }); it.setAddress(occurrenceAddress); matchedBytes = 0; } @@ -499,7 +499,7 @@ namespace hex::plugin::builtin { } if (match) - results.push_back(Occurrence { Region { address, patternSize }, std::endian::native, Occurrence::DecodeType::Binary, false, {} }); + results.push_back(Occurrence { Region { .address=address, .size=patternSize }, std::endian::native, Occurrence::DecodeType::Binary, false, {} }); } } @@ -583,7 +583,7 @@ namespace hex::plugin::builtin { } }(); - results.push_back(Occurrence { Region { address, size }, settings.endian, decodeType, false, {} }); + results.push_back(Occurrence { Region { .address=address, .size=size }, settings.endian, decodeType, false, {} }); } } @@ -631,7 +631,7 @@ namespace hex::plugin::builtin { auto occurrenceAddress = it.getAddress() - (patternSize - 1); results.push_back(Occurrence { - Region { occurrenceAddress, patternSize }, + Region { .address=occurrenceAddress, .size=patternSize }, std::endian::native, Occurrence::DecodeType::ASCII, false, @@ -663,7 +663,7 @@ namespace hex::plugin::builtin { if (match) results.push_back(Occurrence { - Region { address, patternSize }, + Region { .address=address, .size=patternSize }, std::endian::native, Occurrence::DecodeType::ASCII, false, @@ -723,7 +723,7 @@ namespace hex::plugin::builtin { m_lastSelectedOccurrence = nullptr; for (const auto &occurrence : m_foundOccurrences.get(provider)) - m_occurrenceTree->insert({ occurrence.region.getStartAddress(), occurrence.region.getEndAddress() }, occurrence); + m_occurrenceTree->insert({ .start=occurrence.region.getStartAddress(), .end=occurrence.region.getEndAddress() }, occurrence); TaskManager::doLater([this, provider] { EventHighlightingChanged::post(); diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index 7c3d3de0e..45bf1e517 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -67,7 +67,7 @@ namespace hex::plugin::builtin { if (!result.has_value()) { for (const auto &[id, highlighting] : ImHexApi::HexEditor::impl::getForegroundHighlights()) { - if (highlighting.getRegion().overlaps({ address, size })) + if (highlighting.getRegion().overlaps({ .address=address, .size=size })) return highlighting.getColor(); } } @@ -137,7 +137,7 @@ namespace hex::plugin::builtin { if (!result.has_value()) { for (const auto &[id, highlighting] : ImHexApi::HexEditor::impl::getBackgroundHighlights()) { - if (highlighting.getRegion().overlaps({ address, size })) { + if (highlighting.getRegion().overlaps({ .address=address, .size=size })) { result = blendColors(result, highlighting.getColor()); } } @@ -173,7 +173,7 @@ namespace hex::plugin::builtin { } for (const auto &[id, tooltip] : ImHexApi::HexEditor::impl::getTooltips()) { - if (tooltip.getRegion().overlaps({ address, size })) { + if (tooltip.getRegion().overlaps({ .address=address, .size=size })) { ImGui::BeginTooltip(); if (ImGui::BeginTable("##tooltips", 1, ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) { ImGui::TableNextRow(); @@ -991,7 +991,7 @@ namespace hex::plugin::builtin { /* Paste */ ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste" }, ICON_VS_OUTPUT, 1450, CurrentView + CTRLCMD + Keys::V, [this] { - processPasteBehaviour(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { 0, 0 }, ImHexApi::Provider::get()))); + processPasteBehaviour(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { .address=0, .size=0 }, ImHexApi::Provider::get()))); }, ImHexApi::HexEditor::isSelectionValid, this); @@ -1002,7 +1002,7 @@ namespace hex::plugin::builtin { /* Paste... > Paste all */ ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste_as", "hex.builtin.view.hex_editor.menu.edit.paste_all" }, ICON_VS_CLIPPY, 1500, CurrentView + CTRLCMD + SHIFT + Keys::V, [] { - pasteBytes(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { 0, 0 }, ImHexApi::Provider::get())), false, false); + pasteBytes(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { .address=0, .size=0 }, ImHexApi::Provider::get())), false, false); }, ImHexApi::HexEditor::isSelectionValid, this); @@ -1011,7 +1011,7 @@ namespace hex::plugin::builtin { ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste_as", "hex.builtin.view.hex_editor.menu.edit.paste_all_string" }, ICON_VS_SYMBOL_KEY, 1510, Shortcut::None, [] { - pasteBytes(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { 0, 0 }, ImHexApi::Provider::get())), false, true); + pasteBytes(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { .address=0, .size=0 }, ImHexApi::Provider::get())), false, true); }, ImHexApi::HexEditor::isSelectionValid, this); @@ -1020,7 +1020,7 @@ namespace hex::plugin::builtin { ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.select" }, ICON_VS_LIST_SELECTION, 1525, CTRLCMD + SHIFT + Keys::A, [this] { - auto selection = ImHexApi::HexEditor::getSelection().value_or(ImHexApi::HexEditor::ProviderRegion{ { 0, 1 }, nullptr }); + auto selection = ImHexApi::HexEditor::getSelection().value_or(ImHexApi::HexEditor::ProviderRegion{ { .address=0, .size=1 }, nullptr }); this->openPopup(selection.getStartAddress(), selection.getSize()); }, ImHexApi::Provider::isValid, diff --git a/plugins/builtin/source/content/views/view_patches.cpp b/plugins/builtin/source/content/views/view_patches.cpp index 8641a1ea8..f60325a95 100644 --- a/plugins/builtin/source/content/views/view_patches.cpp +++ b/plugins/builtin/source/content/views/view_patches.cpp @@ -71,7 +71,7 @@ namespace hex::plugin::builtin { if (!operation->shouldHighlight()) continue; - if (operation->getRegion().overlaps(Region { offset, 1})) + if (operation->getRegion().overlaps(Region { .address=offset, .size=1})) return ImGuiExt::GetCustomColorU32(ImGuiCustomCol_Patches); } } else { @@ -79,7 +79,7 @@ namespace hex::plugin::builtin { if (!operation->shouldHighlight()) continue; - if (operation->getRegion().overlaps(Region { offset, 1})) + if (operation->getRegion().overlaps(Region { .address=offset, .size=1})) return ImGuiExt::GetCustomColorU32(ImGuiCustomCol_Patches); } } diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index 8aae63355..84f9c4689 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -560,7 +560,7 @@ namespace hex::plugin::builtin { const auto insertPos = [&, this](u64 address, u32 color) { const auto progress = float(address - dataBaseAddress) / float(dataSize); - m_accessHistory[m_accessHistoryIndex] = { progress, color }; + m_accessHistory[m_accessHistoryIndex] = { .progress=progress, .color=color }; m_accessHistoryIndex = (m_accessHistoryIndex + 1) % m_accessHistory.size(); }; @@ -2272,7 +2272,7 @@ namespace hex::plugin::builtin { const auto &runtime = ContentRegistry::PatternLanguage::getRuntime(); - const auto hoveredRegion = Region { address, size }; + const auto hoveredRegion = Region { .address=address, .size=size }; for (const auto &pattern : runtime.getPatternsAtAddress(hoveredRegion.getStartAddress())) { const pl::ptrn::Pattern * checkPattern = pattern; if (auto parent = checkPattern->getParent(); parent != nullptr) diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index 4d781dbb8..4208f1baf 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -255,7 +255,7 @@ namespace hex::plugin::builtin { if (colTile.has_value() && nextSegment != *colTile) { segments.pop_back(); } else { - colTile = { i32(rng() % u32(tileCount.x)), i32(rng() % u32(tileCount.x)) }; + colTile = { .x=i32(rng() % u32(tileCount.x)), .y=i32(rng() % u32(tileCount.x)) }; } } else { overCounter -= 1; diff --git a/plugins/fonts/source/fonts.cpp b/plugins/fonts/source/fonts.cpp index 148a93686..88d810396 100644 --- a/plugins/fonts/source/fonts.cpp +++ b/plugins/fonts/source/fonts.cpp @@ -25,10 +25,10 @@ namespace hex::fonts { } void registerMergeFonts() { - ImHexApi::Fonts::registerMergeFont("Blender Icons", romfs::get("fonts/blendericons.ttf").span(), { -1.0F, -1.0F }, 0.95F); - ImHexApi::Fonts::registerMergeFont("VS Codicons", romfs::get("fonts/codicons.ttf").span(), { +0.0F, -2.5F }, 0.95F); - ImHexApi::Fonts::registerMergeFont("Tabler Icons", romfs::get("fonts/tablericons.ttf").span(), { +2.0F, -1.5F }, 1.10F); - ImHexApi::Fonts::registerMergeFont("Unifont", romfs::get("fonts/unifont.otf").span(), { +0.0F, +0.0F }, 0.75F); + ImHexApi::Fonts::registerMergeFont("Blender Icons", romfs::get("fonts/blendericons.ttf").span(), { .x=-1.0F, .y=-1.0F }, 0.95F); + ImHexApi::Fonts::registerMergeFont("VS Codicons", romfs::get("fonts/codicons.ttf").span(), { .x=+0.0F, .y=-2.5F }, 0.95F); + ImHexApi::Fonts::registerMergeFont("Tabler Icons", romfs::get("fonts/tablericons.ttf").span(), { .x=+2.0F, .y=-1.5F }, 1.10F); + ImHexApi::Fonts::registerMergeFont("Unifont", romfs::get("fonts/unifont.otf").span(), { .x=+0.0F, .y=+0.0F }, 0.75F); } } \ No newline at end of file diff --git a/plugins/ui/source/ui/hex_editor.cpp b/plugins/ui/source/ui/hex_editor.cpp index b269007eb..725ba1271 100644 --- a/plugins/ui/source/ui/hex_editor.cpp +++ b/plugins/ui/source/ui/hex_editor.cpp @@ -555,7 +555,7 @@ namespace hex::ui { if (!this->isSelectionValid()) return; - if (!Region { byteAddress, 1 }.isWithin(region)) + if (!Region { .address=byteAddress, .size=1 }.isWithin(region)) return; // Draw vertical line at the left of first byte and the start of the line @@ -581,7 +581,7 @@ namespace hex::ui { if (!this->isSelectionValid()) return; - if (!Region { byteAddress, 1 }.isWithin(region)) + if (!Region { .address=byteAddress, .size=1 }.isWithin(region)) return; bool cursorVisible = (!ImGui::GetIO().ConfigInputTextCursorBlink) || (m_cursorBlinkTimer <= 0.0F) || std::fmod(m_cursorBlinkTimer, 1.20F) <= 0.80F; @@ -694,7 +694,7 @@ namespace hex::ui { if (m_provider != nullptr && m_provider->isReadable()) { const auto isCurrRegionValid = [this](u64 address) { auto &[currRegion, currRegionValid] = m_currValidRegion; - if (!Region{ address, 1 }.isWithin(currRegion)) { + if (!Region{ .address=address, .size=1 }.isWithin(currRegion)) { m_currValidRegion = m_provider->getRegionValidity(address); } @@ -802,7 +802,7 @@ namespace hex::ui { if (isColumnSeparatorColumn(x + 1, columnCount) && cellColors.size() > x + 1) { auto separatorAddress = x + y * columnCount; auto [nextForegroundColor, nextBackgroundColor] = cellColors[x + 1]; - if ((isSelectionValid() && getSelection().overlaps({ separatorAddress, 1 }) && getSelection().getEndAddress() != separatorAddress) || backgroundColor == nextBackgroundColor) + if ((isSelectionValid() && getSelection().overlaps({ .address=separatorAddress, .size=1 }) && getSelection().getEndAddress() != separatorAddress) || backgroundColor == nextBackgroundColor) adjustedCellSize.x += SeparatorColumWidth + 1; } @@ -846,7 +846,7 @@ namespace hex::ui { ImGuiExt::TextFormatted("{:?>{}}", "", maxCharsPerCell); if (cellHovered) { - Region newHoveredCell = { byteAddress, bytesPerCell }; + Region newHoveredCell = { .address=byteAddress, .size=bytesPerCell }; if (hoveredCell != newHoveredCell) { hoveredCell = newHoveredCell; } @@ -912,7 +912,7 @@ namespace hex::ui { this->drawCell(byteAddress, &bytes[x], 1, cellHovered, CellType::ASCII); if (cellHovered) { - Region newHoveredCell = { byteAddress, bytesPerCell }; + Region newHoveredCell = { .address=byteAddress, .size=bytesPerCell }; if (hoveredCell != newHoveredCell) { hoveredCell = newHoveredCell; } @@ -1007,7 +1007,7 @@ namespace hex::ui { this->handleSelection(address, data.advance, &bytes[address % bytesPerRow], cellHovered); if (cellHovered) { - Region newHoveredCell = { address, data.advance }; + Region newHoveredCell = { .address=address, .size=data.advance }; if (hoveredCell != newHoveredCell) { hoveredCell = newHoveredCell; } diff --git a/plugins/ui/source/ui/text_editor/navigate.cpp b/plugins/ui/source/ui/text_editor/navigate.cpp index 5cde3919d..6e6441e31 100644 --- a/plugins/ui/source/ui/text_editor/navigate.cpp +++ b/plugins/ui/source/ui/text_editor/navigate.cpp @@ -717,8 +717,8 @@ namespace hex::ui { else i = 0; } - if ((i32) (direction * i) >= (i32) ((line.size() - 1) * (1 + direction) / 2)) { - if (lineIndex == (i64) maxLineIndex * (1 + direction) / 2) { + if ((direction * i) >= (i32) ((line.size() - 1) * (1 + direction) / 2)) { + if (lineIndex == (i64) maxLineIndex * (1 + direction) / 2) { if (m_active) { m_active = false; m_changed = true; diff --git a/plugins/ui/source/ui/text_editor/support.cpp b/plugins/ui/source/ui/text_editor/support.cpp index d0465ac7a..dade6a59c 100644 --- a/plugins/ui/source/ui/text_editor/support.cpp +++ b/plugins/ui/source/ui/text_editor/support.cpp @@ -1,7 +1,6 @@ #include #include #include -#include namespace hex::ui { using Coordinates = TextEditor::Coordinates; @@ -324,13 +323,13 @@ namespace hex::ui { // C++ can't overload functions based on return type, so use any type other // than u64 to avoid ambiguity. - std::string Line::operator[](i64 index) const { + std::string Line::operator[](i64 column) const { i64 utf8Length = TextEditor::stringCharacterCount(m_chars); - index = std::clamp(index, (i64) -utf8Length, (i64) utf8Length - 1); - if (index < 0) - index = utf8Length + index; + column = std::clamp(column, (-utf8Length), utf8Length - 1); + if (column < 0) + column = utf8Length + column; i64 utf8Start = 0; - for (i64 utf8Index = 0; utf8Index < index; ++utf8Index) { + for (i64 utf8Index = 0; utf8Index < column; ++utf8Index) { utf8Start += TextEditor::utf8CharLength(m_chars[utf8Start]); } i64 utf8CharLen = TextEditor::utf8CharLength(m_chars[utf8Start]); @@ -468,10 +467,8 @@ namespace hex::ui { bool TextEditor::ActionableBox::trigger() { auto mousePos = ImGui::GetMousePos(); - if (mousePos.x <= m_box.Min.x || mousePos.x >= m_box.Max.x || - mousePos.y < m_box.Min.y || mousePos.y > m_box.Max.y) - return false; - return true; + return mousePos.x > m_box.Min.x && mousePos.x < m_box.Max.x && + mousePos.y >= m_box.Min.y && mousePos.y <= m_box.Max.y; } void TextEditor::ActionableBox::shiftBoxVertically(float lineCount, float lineHeight) { diff --git a/plugins/ui/source/ui/text_editor/utf8.cpp b/plugins/ui/source/ui/text_editor/utf8.cpp index 6888a8084..85895b17a 100644 --- a/plugins/ui/source/ui/text_editor/utf8.cpp +++ b/plugins/ui/source/ui/text_editor/utf8.cpp @@ -235,11 +235,11 @@ namespace hex::ui { if (strIndex < 0 || strIndex > (i32) input.size()) return {0, 0}; std::string str = input.substr(0, strIndex); - auto line = std::count(str.begin(), str.end(), '\n'); + i32 line = std::count(str.begin(), str.end(), '\n'); auto index = str.find_last_of('\n'); str = str.substr(index + 1); - auto col = TextEditor::stringCharacterCount(str); + i32 col = TextEditor::stringCharacterCount(str); - return TextEditor::Coordinates(line, col); + return {line, col}; } } diff --git a/plugins/ui/source/ui/widgets.cpp b/plugins/ui/source/ui/widgets.cpp index f2669353b..42a10d60a 100644 --- a/plugins/ui/source/ui/widgets.cpp +++ b/plugins/ui/source/ui/widgets.cpp @@ -23,12 +23,12 @@ namespace hex::ui { switch (*type) { case RegionType::EntireData: - *region = { provider->getBaseAddress(), provider->getActualSize() }; + *region = { .address=provider->getBaseAddress(), .size=provider->getActualSize() }; break; case RegionType::Selection: *region = ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion { - { 0, 1 }, + { .address=0, .size=1 }, provider } ).getRegion(); break; @@ -59,7 +59,7 @@ namespace hex::ui { ImGuiExt::InputHexadecimal("##end", &end); ImGui::PopItemWidth(); - *region = { start, (end - start) + 1 }; + *region = { .address=start, .size=(end - start) + 1 }; ImGui::EndPopup(); } diff --git a/tests/algorithms/source/crypto.cpp b/tests/algorithms/source/crypto.cpp index 5e50b9aac..e6c48f581 100644 --- a/tests/algorithms/source/crypto.cpp +++ b/tests/algorithms/source/crypto.cpp @@ -20,11 +20,11 @@ TEST_SEQUENCE("EncodeDecode16") { std::array golden_samples = { // source: created by hand - EncodeChek {{}, "" }, - EncodeChek { { 0x2a }, "2A" }, - EncodeChek { { 0x00, 0x2a }, "002A" }, - EncodeChek { { 0x2a, 0x00 }, "2A00" }, - EncodeChek { { 0xde, 0xad, 0xbe, 0xef, 0x42, 0x2a, 0x00, 0xff }, "DEADBEEF422A00FF"}, + EncodeChek {.vec={}, .string="" }, + EncodeChek { .vec={ 0x2a }, .string="2A" }, + EncodeChek { .vec={ 0x00, 0x2a }, .string="002A" }, + EncodeChek { .vec={ 0x2a, 0x00 }, .string="2A00" }, + EncodeChek { .vec={ 0xde, 0xad, 0xbe, 0xef, 0x42, 0x2a, 0x00, 0xff }, .string="DEADBEEF422A00FF"}, }; for (auto &i : golden_samples) { @@ -69,12 +69,12 @@ TEST_SEQUENCE("EncodeDecode64") { std::array golden_samples = { // source: linux command base64 (from GNU coreutils) - EncodeChek {{}, "" }, - EncodeChek { { 0x2a }, "Kg==" }, - EncodeChek { { 0x00, 0x2a }, "ACo=" }, - EncodeChek { { 0x2a, 0x00 }, "KgA=" }, - EncodeChek { { 0x42, 0xff, 0x55 }, "Qv9V" }, - EncodeChek { { 0xde, 0xad, 0xbe, 0xef, 0x42, 0x2a, 0x00, 0xff }, "3q2+70IqAP8="}, + EncodeChek {.vec={}, .string="" }, + EncodeChek { .vec={ 0x2a }, .string="Kg==" }, + EncodeChek { .vec={ 0x00, 0x2a }, .string="ACo=" }, + EncodeChek { .vec={ 0x2a, 0x00 }, .string="KgA=" }, + EncodeChek { .vec={ 0x42, 0xff, 0x55 }, .string="Qv9V" }, + EncodeChek { .vec={ 0xde, 0xad, 0xbe, 0xef, 0x42, 0x2a, 0x00, 0xff }, .string="3q2+70IqAP8="}, }; for (auto &i : golden_samples) { @@ -199,7 +199,7 @@ int checkCrcAgainstRandomData(Func func, int width) { std::uniform_int_distribution distribData; for (int i = 0; i < 500; i++) { - CrcCheck c { "", width, distribPoly(gen), distribPoly(gen), 0, false, false, 0, {} }; + CrcCheck c { .name="", .width=width, .poly=distribPoly(gen), .init=distribPoly(gen), .xorOut=0, .refIn=false, .refOut=false, .result=0, .data={} }; c.data.resize(distribLen(gen)); std::generate(std::begin(c.data), std::end(c.data), [&] { return distribData(gen); }); @@ -239,26 +239,26 @@ int checkCrcAgainstRandomData(Func func, int width) { TEST_SEQUENCE("CRC32") { std::array golden_samples = { // source: A Painless Guide to CRC Error Detection Algorithms [https://zlib.net/crc_v3.txt] - CrcCheck {"CRC-32-CRC32-check", 32, 0x4C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, true, true, 0xCBF43926, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck {.name="CRC-32-CRC32-check", .width=32, .poly=0x4C11DB7, .init=0xFFFFFFFF, .xorOut=0xFFFFFFFF, .refIn=true, .refOut=true, .result=0xCBF43926, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, // source: Sunshine's Homepage - Online CRC Calculator Javascript [http://www.sunshine2k.de/coding/javascript/crc/crc_js.html] - CrcCheck { "CRC-32-1-check", 32, 0x4C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, true, false, 0x649C2FD3, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-32-2-check", 32, 0x4C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, false, true, 0x1898913F, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-32-3-check", 32, 0x4C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, false, false, 0xFC891918, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-32-4-check", 32, 0x4C11DB7, 0x55422a00, 0xaa004422, false, false, 0x41A1D8EE, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-32-5-check", 32, 0x4C11DB7, 0x55422a00, 0xaa004422, false, false, 0xFF426E22, {} }, + CrcCheck { .name="CRC-32-1-check", .width=32, .poly=0x4C11DB7, .init=0xFFFFFFFF, .xorOut=0xFFFFFFFF, .refIn=true, .refOut=false, .result=0x649C2FD3, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-32-2-check", .width=32, .poly=0x4C11DB7, .init=0xFFFFFFFF, .xorOut=0xFFFFFFFF, .refIn=false, .refOut=true, .result=0x1898913F, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-32-3-check", .width=32, .poly=0x4C11DB7, .init=0xFFFFFFFF, .xorOut=0xFFFFFFFF, .refIn=false, .refOut=false, .result=0xFC891918, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-32-4-check", .width=32, .poly=0x4C11DB7, .init=0x55422a00, .xorOut=0xaa004422, .refIn=false, .refOut=false, .result=0x41A1D8EE, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-32-5-check", .width=32, .poly=0x4C11DB7, .init=0x55422a00, .xorOut=0xaa004422, .refIn=false, .refOut=false, .result=0xFF426E22, .data={} }, // source: generated by Boost CRC from random data and random parameters - CrcCheck { "CRC-32-RANDOM-170", 32, 0x000000005c0dd7fd, 0x000000001c8be2e1, 0x00000000efdedd60, false, true, 0x000000004e9b67a8, { 181, 235, 196, 140, 43, 8, 101, 39, 17, 128, 187, 117, 118, 75, 41, 240, 228, 60, 93, 101, 228, 235, 36, 117, 208, 54, 218, 57, 24, 84, 54, 173, 13, 66, 42, 232, 206, 49, 210, 165, 146, 145, 234, 88, 76, 130, 154, 231, 247, 66, 73, 150, 163, 104, 42, 77, 214, 16, 53, 120, 210, 74, 215, 54, 88, 171, 137, 133, 26, 29, 134, 0, 103, 240, 146, 220, 169, 64, 155, 162, 23, 73, 73, 87, 224, 106, 121, 58, 66, 146, 158, 101, 196, 62, 153, 143, 86, 87, 147, 4, 36, 248, 41, 6, 213, 233, 27, 24, 42, 207, 24, 167, 72, 216, 24, 27, 59, 205, 184, 0, 101, 102, 34, 32, 248, 213, 53, 244, 83, 60, 8, 249, 115, 214, 144, 109, 245, 119, 137, 225, 156, 247, 250, 230, 147, 201, 1, 14, 111, 148, 214, 90, 80, 156, 31, 85, 186, 165, 218, 127, 66, 9, 191, 215, 17, 253, 32, 162, 28, 223, 61, 7, 115, 177, 58 } }, - CrcCheck { "CRC-32-RANDOM-171", 32, 0x00000000380bb4f5, 0x00000000c6c652b3, 0x000000003a5ee7d1, false, false, 0x000000002f5a76b0, { 59, 215, 138, 110, 177, 211, 25, 172, 77, 145, 155, 166, 99, 202, 132, 92, 179, 249, 223, 254, 103, 9, 16, 218, 42 } }, - CrcCheck { "CRC-32-RANDOM-172", 32, 0x000000000dc7ba53, 0x00000000acfa5319, 0x00000000ee250595, true, true, 0x00000000b3e56ef4, { 218, 89, 16, 112, 197, 97, 69, 29, 33, 173, 8, 121, 78, 23, 131, 152, 82, 174, 94, 206, 33, 228, 35, 205, 83, 71, 219, 99, 13, 48, 105, 180, 187, 246, 101, 249, 91, 67, 207, 177, 61, 108, 144, 73, 209, 201, 166, 115, 2, 110, 70, 67, 25, 31, 0, 20, 83, 9, 152, 169, 125, 74, 246, 183, 186, 70, 199, 106, 38, 127, 230, 44, 43, 64, 119, 14, 97, 127, 127, 166, 98, 157, 71, 109, 3, 15, 197, 223 } }, - CrcCheck { "CRC-32-RANDOM-173", 32, 0x00000000fd5a3b2e, 0x00000000580018a2, 0x000000002dbfb987, true, true, 0x0000000040c086a9, { 0, 90, 253, 254, 61, 67, 185, 88, 110, 58, 243, 86, 43, 183, 21, 161, 192, 81, 10, 83, 147, 21, 235, 250, 195, 201, 199, 36, 254, 107, 191, 212, 27, 30, 173, 247, 174, 219, 240, 39, 0, 72, 146, 155, 72, 250, 252, 51, 250, 195, 161, 241, 75, 244, 13, 85, 233, 204, 70, 89, 110, 193, 25, 199, 179, 92, 169, 179, 75, 124, 142, 31, 36, 167, 16, 166, 119, 148, 68, 74, 8, 5, 60, 164, 217, 168, 231, 99, 214, 171, 239, 23, 36, 219, 176, 111, 210, 96, 111, 57, 231, 160, 5, 119, 76, 19, 197, 197, 3, 11, 121, 140, 182, 150, 30, 90, 160, 30, 114, 114, 214, 57, 118, 70, 219, 201, 223, 143, 0, 126, 14, 223, 175, 212, 208, 135, 104, 173, 169, 189, 5, 228, 232, 170, 191, 137, 45, 98, 43, 153, 180, 186, 46, 53, 167, 166, 99, 154, 188, 234, 37, 137, 37, 132, 251, 122, 143, 230, 151, 227, 41, 111, 6, 168, 135, 0, 239, 141, 125, 5, 199, 48, 161, 53, 186, 91, 56, 41, 227, 49, 28, 132, 88, 2, 22, 33, 21, 155, 209, 82, 116, 17, 142, 55, 87, 156, 134, 165, 153, 38, 125, 40, 80, 229, 233, 28, 23, 197 } }, - CrcCheck { "CRC-32-RANDOM-174", 32, 0x000000006eae3222, 0x0000000097093735, 0x000000000460e363, false, false, 0x0000000096bf93cd, { 98, 234, 52, 152, 123 } }, - CrcCheck { "CRC-32-RANDOM-175", 32, 0x000000002ac3bed5, 0x00000000c2a0964a, 0x0000000019ee4b3b, true, true, 0x00000000b7f1e6b7, { 108, 151, 223, 46, 204, 105, 253, 2, 101, 184, 48, 186, 204, 86, 230, 246, 222, 137, 136, 207, 197, 195, 33, 165, 239, 55, 92, 9, 54, 29, 189, 126, 123, 106, 19, 1, 176, 52, 87, 178, 246, 110, 75, 220, 204, 8, 11, 22 } }, - CrcCheck { "CRC-32-RANDOM-176", 32, 0x000000006dc26b9c, 0x00000000096e9400, 0x000000005e4839bf, false, true, 0x0000000063d4b648, { 88, 185, 144, 84, 86, 77, 217, 85, 61, 80, 21, 84, 81, 120, 14, 247, 106, 56, 193, 3, 185, 118, 131, 196, 51, 249, 79, 252, 145, 43, 243, 120, 56, 184, 242, 226, 80, 73, 102, 179, 20, 7, 208, 70, 242, 20, 208, 180, 21, 128, 175, 195, 248, 174, 45, 187, 142, 76, 2, 6, 58, 56, 155, 28, 37, 35, 134, 50, 34, 174, 204, 170, 163, 94, 68, 161, 124, 23, 224, 38, 137, 255, 92, 228, 77, 53, 42, 145, 147, 12, 246, 23, 205, 143, 241, 201, 227, 79, 215, 65, 55, 247, 219, 209, 30, 19, 11, 211, 145, 150, 45, 200, 90, 69, 55, 234, 7, 11, 6, 113, 158, 229, 56, 131, 220, 14, 236, 127, 249, 191, 182, 108, 23, 197, 148, 247, 115, 85, 0, 86, 63, 210, 153, 112, 235, 146, 53, 249, 216, 42, 169, 18, 54, 245, 60, 232, 224, 9, 187, 125, 27, 180, 171, 138, 138, 13, 45, 125, 220, 158, 164, 21, 109, 23, 8, 2, 41, 178, 245, 226, 211, 202, 134, 4, 133, 192, 125 } }, - CrcCheck { "CRC-32-RANDOM-177", 32, 0x00000000de2c5518, 0x000000003e12e6ec, 0x00000000474d1134, true, false, 0x00000000623e70f4, { 239, 114, 198, 23, 88, 133, 118, 9, 184, 162, 78, 142, 128, 165, 196, 6, 148, 0, 56, 249, 4, 126, 152, 67, 17, 48, 153, 151, 46, 183, 92, 242, 155, 233, 216, 166, 22, 107, 139, 93, 3, 239, 154, 20, 15, 69, 41, 126, 65, 76, 229, 133, 161, 181, 201, 134, 213, 158, 174, 17, 32, 45, 223, 74, 56, 194, 228, 37, 71, 128, 160, 202, 219, 173, 55, 223, 104, 90, 176, 152, 113, 160, 224, 36, 111, 170, 64, 28, 29, 239, 23, 135, 254, 240, 117, 147, 125, 138, 86, 206, 28, 48, 169, 107, 193, 186, 197, 219, 180, 83, 108, 250, 172, 21, 18, 121, 154, 77, 36, 48, 88, 167, 42, 3, 91, 172, 235, 166, 85, 93, 42, 254, 47, 37, 193, 104, 32, 171, 172, 225, 194, 80, 120, 61, 198, 108, 105, 21, 188, 51, 101, 49, 88, 97, 51, 168, 251, 4, 226, 114, 202, 53, 7, 171, 41, 72, 138, 161, 227, 182, 223, 92, 96, 196, 203, 255, 72, 190, 6, 106, 69, 172, 41, 131, 241, 34, 147, 155, 27, 67, 109, 39, 202, 82, 184, 160, 167, 163, 66, 222, 172, 65, 24, 46, 181, 217, 1, 249, 206, 171, 27, 87, 88, 40, 191, 153, 121, 206, 89, 48, 7, 86, 82, 68, 129, 224, 181, 108, 144, 1, 14, 204, 79, 183, 129, 116, 124, 175, 158, 98, 197 }}, - CrcCheck { "CRC-32-RANDOM-178", 32, 0x00000000983395ff, 0x00000000b8a8a4fe, 0x00000000c0996c7c, true, true, 0x0000000003def4ee, { 81, 82, 118, 44, 112, 193, 97, 94, 233, 4, 105, 223, 158, 176, 91, 215, 162, 197, 79, 59, 191, 152, 87, 68, 79, 122, 35, 78, 180, 40, 151, 82, 199, 227 } }, - CrcCheck { "CRC-32-RANDOM-179", 32, 0x0000000096345585, 0x0000000098436ef2, 0x000000000373eba2, true, false, 0x000000001a7ca97a, { 22, 29, 92, 40, 254, 225, 67, 92, 243, 28, 191, 168, 25, 228, 67, 240, 230, 20, 1, 165, 223, 154, 244, 100, 127, 254, 103, 233, 105, 139, 3, 232, 31, 57, 84, 99, 144, 1, 105, 240, 103, 118, 146, 128, 216, 43, 115, 59, 233, 56, 3, 9, 139, 64, 229, 52, 116, 210, 173, 55, 190, 126, 168, 10, 4, 72, 62, 134, 152, 151, 143, 153, 217, 50, 134, 15, 251, 158, 241, 253, 161, 36, 44, 60, 75, 74, 253, 170, 39, 43, 255, 183, 194, 176, 95, 255, 21, 122, 83, 200, 201, 249, 175, 245, 166, 128, 54, 253, 234, 106, 122, 177, 169, 162, 71, 99, 135, 204, 72, 24, 22, 170, 97, 11, 5, 165, 88, 173, 43, 138, 143, 5, 68, 12, 178, 125, 66, 132, 28, 215, 49, 47, 146, 193, 0, 193, 65, 103, 53, 81, 58, 99, 38, 224, 34, 124, 44, 165, 95, 129, 192, 160, 110, 76, 131, 157, 49, 76, 100, 83, 220, 101, 253, 108, 11, 21, 88, 178, 114, 163, 58, 200, 57, 232, 252, 216, 217, 154, 122, 251, 200, 216, 238, 165, 94, 97, 76, 112, 39, 243, 77, 81, 189, 10, 48, 10, 65, 180, 252, 15, 132, 86, 68, 199, 185, 4, 19, 19, 61, 249, 133, 80, 45, 206, 49, 16, 107, 176 } }, + CrcCheck { .name="CRC-32-RANDOM-170", .width=32, .poly=0x000000005c0dd7fd, .init=0x000000001c8be2e1, .xorOut=0x00000000efdedd60, .refIn=false, .refOut=true, .result=0x000000004e9b67a8, .data={ 181, 235, 196, 140, 43, 8, 101, 39, 17, 128, 187, 117, 118, 75, 41, 240, 228, 60, 93, 101, 228, 235, 36, 117, 208, 54, 218, 57, 24, 84, 54, 173, 13, 66, 42, 232, 206, 49, 210, 165, 146, 145, 234, 88, 76, 130, 154, 231, 247, 66, 73, 150, 163, 104, 42, 77, 214, 16, 53, 120, 210, 74, 215, 54, 88, 171, 137, 133, 26, 29, 134, 0, 103, 240, 146, 220, 169, 64, 155, 162, 23, 73, 73, 87, 224, 106, 121, 58, 66, 146, 158, 101, 196, 62, 153, 143, 86, 87, 147, 4, 36, 248, 41, 6, 213, 233, 27, 24, 42, 207, 24, 167, 72, 216, 24, 27, 59, 205, 184, 0, 101, 102, 34, 32, 248, 213, 53, 244, 83, 60, 8, 249, 115, 214, 144, 109, 245, 119, 137, 225, 156, 247, 250, 230, 147, 201, 1, 14, 111, 148, 214, 90, 80, 156, 31, 85, 186, 165, 218, 127, 66, 9, 191, 215, 17, 253, 32, 162, 28, 223, 61, 7, 115, 177, 58 } }, + CrcCheck { .name="CRC-32-RANDOM-171", .width=32, .poly=0x00000000380bb4f5, .init=0x00000000c6c652b3, .xorOut=0x000000003a5ee7d1, .refIn=false, .refOut=false, .result=0x000000002f5a76b0, .data={ 59, 215, 138, 110, 177, 211, 25, 172, 77, 145, 155, 166, 99, 202, 132, 92, 179, 249, 223, 254, 103, 9, 16, 218, 42 } }, + CrcCheck { .name="CRC-32-RANDOM-172", .width=32, .poly=0x000000000dc7ba53, .init=0x00000000acfa5319, .xorOut=0x00000000ee250595, .refIn=true, .refOut=true, .result=0x00000000b3e56ef4, .data={ 218, 89, 16, 112, 197, 97, 69, 29, 33, 173, 8, 121, 78, 23, 131, 152, 82, 174, 94, 206, 33, 228, 35, 205, 83, 71, 219, 99, 13, 48, 105, 180, 187, 246, 101, 249, 91, 67, 207, 177, 61, 108, 144, 73, 209, 201, 166, 115, 2, 110, 70, 67, 25, 31, 0, 20, 83, 9, 152, 169, 125, 74, 246, 183, 186, 70, 199, 106, 38, 127, 230, 44, 43, 64, 119, 14, 97, 127, 127, 166, 98, 157, 71, 109, 3, 15, 197, 223 } }, + CrcCheck { .name="CRC-32-RANDOM-173", .width=32, .poly=0x00000000fd5a3b2e, .init=0x00000000580018a2, .xorOut=0x000000002dbfb987, .refIn=true, .refOut=true, .result=0x0000000040c086a9, .data={ 0, 90, 253, 254, 61, 67, 185, 88, 110, 58, 243, 86, 43, 183, 21, 161, 192, 81, 10, 83, 147, 21, 235, 250, 195, 201, 199, 36, 254, 107, 191, 212, 27, 30, 173, 247, 174, 219, 240, 39, 0, 72, 146, 155, 72, 250, 252, 51, 250, 195, 161, 241, 75, 244, 13, 85, 233, 204, 70, 89, 110, 193, 25, 199, 179, 92, 169, 179, 75, 124, 142, 31, 36, 167, 16, 166, 119, 148, 68, 74, 8, 5, 60, 164, 217, 168, 231, 99, 214, 171, 239, 23, 36, 219, 176, 111, 210, 96, 111, 57, 231, 160, 5, 119, 76, 19, 197, 197, 3, 11, 121, 140, 182, 150, 30, 90, 160, 30, 114, 114, 214, 57, 118, 70, 219, 201, 223, 143, 0, 126, 14, 223, 175, 212, 208, 135, 104, 173, 169, 189, 5, 228, 232, 170, 191, 137, 45, 98, 43, 153, 180, 186, 46, 53, 167, 166, 99, 154, 188, 234, 37, 137, 37, 132, 251, 122, 143, 230, 151, 227, 41, 111, 6, 168, 135, 0, 239, 141, 125, 5, 199, 48, 161, 53, 186, 91, 56, 41, 227, 49, 28, 132, 88, 2, 22, 33, 21, 155, 209, 82, 116, 17, 142, 55, 87, 156, 134, 165, 153, 38, 125, 40, 80, 229, 233, 28, 23, 197 } }, + CrcCheck { .name="CRC-32-RANDOM-174", .width=32, .poly=0x000000006eae3222, .init=0x0000000097093735, .xorOut=0x000000000460e363, .refIn=false, .refOut=false, .result=0x0000000096bf93cd, .data={ 98, 234, 52, 152, 123 } }, + CrcCheck { .name="CRC-32-RANDOM-175", .width=32, .poly=0x000000002ac3bed5, .init=0x00000000c2a0964a, .xorOut=0x0000000019ee4b3b, .refIn=true, .refOut=true, .result=0x00000000b7f1e6b7, .data={ 108, 151, 223, 46, 204, 105, 253, 2, 101, 184, 48, 186, 204, 86, 230, 246, 222, 137, 136, 207, 197, 195, 33, 165, 239, 55, 92, 9, 54, 29, 189, 126, 123, 106, 19, 1, 176, 52, 87, 178, 246, 110, 75, 220, 204, 8, 11, 22 } }, + CrcCheck { .name="CRC-32-RANDOM-176", .width=32, .poly=0x000000006dc26b9c, .init=0x00000000096e9400, .xorOut=0x000000005e4839bf, .refIn=false, .refOut=true, .result=0x0000000063d4b648, .data={ 88, 185, 144, 84, 86, 77, 217, 85, 61, 80, 21, 84, 81, 120, 14, 247, 106, 56, 193, 3, 185, 118, 131, 196, 51, 249, 79, 252, 145, 43, 243, 120, 56, 184, 242, 226, 80, 73, 102, 179, 20, 7, 208, 70, 242, 20, 208, 180, 21, 128, 175, 195, 248, 174, 45, 187, 142, 76, 2, 6, 58, 56, 155, 28, 37, 35, 134, 50, 34, 174, 204, 170, 163, 94, 68, 161, 124, 23, 224, 38, 137, 255, 92, 228, 77, 53, 42, 145, 147, 12, 246, 23, 205, 143, 241, 201, 227, 79, 215, 65, 55, 247, 219, 209, 30, 19, 11, 211, 145, 150, 45, 200, 90, 69, 55, 234, 7, 11, 6, 113, 158, 229, 56, 131, 220, 14, 236, 127, 249, 191, 182, 108, 23, 197, 148, 247, 115, 85, 0, 86, 63, 210, 153, 112, 235, 146, 53, 249, 216, 42, 169, 18, 54, 245, 60, 232, 224, 9, 187, 125, 27, 180, 171, 138, 138, 13, 45, 125, 220, 158, 164, 21, 109, 23, 8, 2, 41, 178, 245, 226, 211, 202, 134, 4, 133, 192, 125 } }, + CrcCheck { .name="CRC-32-RANDOM-177", .width=32, .poly=0x00000000de2c5518, .init=0x000000003e12e6ec, .xorOut=0x00000000474d1134, .refIn=true, .refOut=false, .result=0x00000000623e70f4, .data={ 239, 114, 198, 23, 88, 133, 118, 9, 184, 162, 78, 142, 128, 165, 196, 6, 148, 0, 56, 249, 4, 126, 152, 67, 17, 48, 153, 151, 46, 183, 92, 242, 155, 233, 216, 166, 22, 107, 139, 93, 3, 239, 154, 20, 15, 69, 41, 126, 65, 76, 229, 133, 161, 181, 201, 134, 213, 158, 174, 17, 32, 45, 223, 74, 56, 194, 228, 37, 71, 128, 160, 202, 219, 173, 55, 223, 104, 90, 176, 152, 113, 160, 224, 36, 111, 170, 64, 28, 29, 239, 23, 135, 254, 240, 117, 147, 125, 138, 86, 206, 28, 48, 169, 107, 193, 186, 197, 219, 180, 83, 108, 250, 172, 21, 18, 121, 154, 77, 36, 48, 88, 167, 42, 3, 91, 172, 235, 166, 85, 93, 42, 254, 47, 37, 193, 104, 32, 171, 172, 225, 194, 80, 120, 61, 198, 108, 105, 21, 188, 51, 101, 49, 88, 97, 51, 168, 251, 4, 226, 114, 202, 53, 7, 171, 41, 72, 138, 161, 227, 182, 223, 92, 96, 196, 203, 255, 72, 190, 6, 106, 69, 172, 41, 131, 241, 34, 147, 155, 27, 67, 109, 39, 202, 82, 184, 160, 167, 163, 66, 222, 172, 65, 24, 46, 181, 217, 1, 249, 206, 171, 27, 87, 88, 40, 191, 153, 121, 206, 89, 48, 7, 86, 82, 68, 129, 224, 181, 108, 144, 1, 14, 204, 79, 183, 129, 116, 124, 175, 158, 98, 197 }}, + CrcCheck { .name="CRC-32-RANDOM-178", .width=32, .poly=0x00000000983395ff, .init=0x00000000b8a8a4fe, .xorOut=0x00000000c0996c7c, .refIn=true, .refOut=true, .result=0x0000000003def4ee, .data={ 81, 82, 118, 44, 112, 193, 97, 94, 233, 4, 105, 223, 158, 176, 91, 215, 162, 197, 79, 59, 191, 152, 87, 68, 79, 122, 35, 78, 180, 40, 151, 82, 199, 227 } }, + CrcCheck { .name="CRC-32-RANDOM-179", .width=32, .poly=0x0000000096345585, .init=0x0000000098436ef2, .xorOut=0x000000000373eba2, .refIn=true, .refOut=false, .result=0x000000001a7ca97a, .data={ 22, 29, 92, 40, 254, 225, 67, 92, 243, 28, 191, 168, 25, 228, 67, 240, 230, 20, 1, 165, 223, 154, 244, 100, 127, 254, 103, 233, 105, 139, 3, 232, 31, 57, 84, 99, 144, 1, 105, 240, 103, 118, 146, 128, 216, 43, 115, 59, 233, 56, 3, 9, 139, 64, 229, 52, 116, 210, 173, 55, 190, 126, 168, 10, 4, 72, 62, 134, 152, 151, 143, 153, 217, 50, 134, 15, 251, 158, 241, 253, 161, 36, 44, 60, 75, 74, 253, 170, 39, 43, 255, 183, 194, 176, 95, 255, 21, 122, 83, 200, 201, 249, 175, 245, 166, 128, 54, 253, 234, 106, 122, 177, 169, 162, 71, 99, 135, 204, 72, 24, 22, 170, 97, 11, 5, 165, 88, 173, 43, 138, 143, 5, 68, 12, 178, 125, 66, 132, 28, 215, 49, 47, 146, 193, 0, 193, 65, 103, 53, 81, 58, 99, 38, 224, 34, 124, 44, 165, 95, 129, 192, 160, 110, 76, 131, 157, 49, 76, 100, 83, 220, 101, 253, 108, 11, 21, 88, 178, 114, 163, 58, 200, 57, 232, 252, 216, 217, 154, 122, 251, 200, 216, 238, 165, 94, 97, 76, 112, 39, 243, 77, 81, 189, 10, 48, 10, 65, 180, 252, 15, 132, 86, 68, 199, 185, 4, 19, 19, 61, 249, 133, 80, 45, 206, 49, 16, 107, 176 } }, }; TEST_ASSERT(!checkCrcAgainstGondenSamples(hex::crypt::crc32, golden_samples)); @@ -275,24 +275,24 @@ TEST_SEQUENCE("CRC32Random") { TEST_SEQUENCE("CRC16") { std::array golden_samples = { // source: A Painless Guide to CRC Error Detection Algorithms [https://zlib.net/crc_v3.txt] - CrcCheck {"CRC-16-CRC16-check", 16, 0x8005, 0x0000, 0x0000, true, true, 0xBB3D, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck {.name="CRC-16-CRC16-check", .width=16, .poly=0x8005, .init=0x0000, .xorOut=0x0000, .refIn=true, .refOut=true, .result=0xBB3D, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, // source: Sunshine's Homepage - Online CRC Calculator Javascript [http://www.sunshine2k.de/coding/javascript/crc/crc_js.html] - CrcCheck { "CRC-16-1-check", 16, 0x8005, 0x0000, 0x0000, true, false, 0xBCDD, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-16-2-check", 16, 0x8005, 0x0000, 0x0000, false, true, 0x177F, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-16-3-check", 16, 0x8005, 0x0000, 0x0000, false, false, 0xFEE8, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-16-3-check", 16, 0x8005, 0x5042, 0xfc2a, false, false, 0xDD50, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-16-1-check", .width=16, .poly=0x8005, .init=0x0000, .xorOut=0x0000, .refIn=true, .refOut=false, .result=0xBCDD, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-16-2-check", .width=16, .poly=0x8005, .init=0x0000, .xorOut=0x0000, .refIn=false, .refOut=true, .result=0x177F, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-16-3-check", .width=16, .poly=0x8005, .init=0x0000, .xorOut=0x0000, .refIn=false, .refOut=false, .result=0xFEE8, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-16-3-check", .width=16, .poly=0x8005, .init=0x5042, .xorOut=0xfc2a, .refIn=false, .refOut=false, .result=0xDD50, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, // source: generated by Boost CRC from random data and random parameters - CrcCheck { "CRC-16-RANDOM-10", 16, 0x000000000000afbb, 0x00000000000091ea, 0x0000000000000ea8, true, true, 0x0000000000000670, { 239, 127, 45, 34, 24, 9, 68, 49, 206, 206, 71, 116, 233, 144, 237, 184, 241, 86, 244, 237, 163, 167, 42, 194, 69, 147, 236, 136, 245, 183, 254, 2, 67, 220, 111, 241, 168, 255, 36, 248, 147, 137, 75, 137, 201, 100, 215, 161, 36, 13, 54, 235, 34, 187, 75, 82, 227, 97, 240, 137, 173, 165, 246, 129, 30, 174, 42, 21, 185, 94, 43, 218, 126, 90, 197, 205, 15, 21, 115, 50, 103, 38, 178, 124, 27, 24, 208, 157, 41, 53, 204, 158, 198, 238, 133, 61, 164, 203, 159, 6, 94, 213, 225, 145, 61, 245, 86, 157, 126, 41, 130, 195, 130, 11, 48, 29, 193, 187, 127, 135, 83, 44, 232, 66, 169, 147, 106, 11, 118, 124, 189, 114, 131, 148, 106, 45, 250, 134, 11, 189, 179, 74, 92, 43, 8, 116, 18, 241, 53, 218, 160, 169, 65, 112, 161, 63, 208, 61, 223, 18, 254, 51, 87, 101, 180, 244, 149, 78, 135, 54, 222, 122, 244, 184, 44 } }, - CrcCheck { "CRC-16-RANDOM-11", 16, 0x0000000000001b6c, 0x0000000000005bce, 0x000000000000e29c, true, true, 0x000000000000dfa2, { 92, 73, 175, 57, 17, 7, 61, 3, 7, 81, 172, 188, 91, 214, 51, 201, 52, 249, 51, 206, 210, 79, 156, 42, 36, 28, 235, 71, 83, 127, 30, 123, 200, 55, 127, 217, 218, 71, 203, 29, 223, 222, 198, 56, 138, 207, 196, 46, 195, 105, 28, 45, 5, 138, 168, 54, 239, 203, 1, 0, 105, 110, 21, 193, 207 } }, - CrcCheck { "CRC-16-RANDOM-12", 16, 0x000000000000477b, 0x000000000000afa4, 0x0000000000003d01, false, false, 0x0000000000000b96, { 63, 84, 254, 94, 21, 194, 88, 199, 189, 117, 111, 234, 231, 51, 119, 117, 203, 239, 210, 109, 162, 58, 158, 239, 163, 18, 68, 233, 37, 120, 48, 205, 17, 188, 141, 44, 143, 147, 173, 105 } }, - CrcCheck { "CRC-16-RANDOM-13", 16, 0x0000000000004438, 0x0000000000008e25, 0x0000000000006c55, false, false, 0x0000000000004a6d, { 179, 169, 67, 230, 228, 213, 173, 155, 152, 64, 85, 170, 20, 177, 38, 127, 169, 186, 44, 163, 153, 153, 11, 112, 63, 24, 127, 25, 135, 40, 214, 33, 88, 132, 14, 84, 82, 66, 216, 75, 55, 231, 101, 114, 68, 244, 56, 140, 100, 196, 226, 60, 0, 177, 187, 164, 237, 1, 199, 119, 249, 148, 102, 175, 32, 62, 232, 179, 30, 102, 85, 8, 188, 61, 28, 156, 74, 71, 11, 102, 51, 243, 120, 60, 146, 207, 116, 156, 219, 237, 157, 25, 0, 149, 7, 137, 248, 102, 157, 171, 60, 76, 117, 29, 34, 117, 148, 241, 142, 18, 251, 240, 37, 213, 171, 120, 85, 145, 50, 209, 130, 225, 28, 27, 170, 195, 148, 102 } }, - CrcCheck { "CRC-16-RANDOM-14", 16, 0x000000000000f461, 0x0000000000004d96, 0x0000000000003e1d, true, true, 0x0000000000009eef, { 38, 252, 182, 80, 159, 97, 166, 150, 29, 9, 45, 216, 186, 165, 148, 128, 60, 170, 243, 69, 177, 203, 17, 191, 5, 60, 209, 41, 20, 42, 23, 147, 126, 209, 125, 157, 30, 45, 94, 157, 146, 7, 20, 234, 70, 23, 141, 87, 88, 93, 184, 169, 69, 88, 108, 253, 58, 157, 175, 88, 177, 154, 181, 127, 216, 82, 202, 16, 164, 227, 188, 243, 140, 84, 24, 213, 31, 130, 185, 234, 215, 248, 169, 233, 4, 208, 67, 102, 248, 13, 114, 162, 175, 187, 120, 228, 213, 93 } }, - CrcCheck { "CRC-16-RANDOM-15", 16, 0x000000000000bbf3, 0x000000000000e279, 0x000000000000a01c, false, false, 0x000000000000f294, { 251, 1, 172, 207, 75, 242, 148, 19, 255, 106, 41, 114, 213, 142, 229, 239, 156, 23, 225, 4, 181, 190, 130, 111, 160, 59, 145, 253, 181, 114, 17, 118, 65, 201, 206, 61, 137, 118, 87, 156, 205, 110, 6, 63, 153, 254, 163, 225, 66, 88, 232, 189, 126, 92, 228, 204, 0, 243, 78, 239, 62, 193, 27, 197, 106, 96, 215, 1, 143, 116, 114, 112, 6, 150, 209, 152, 254, 66, 54, 94, 123, 109, 220, 31, 156, 118, 201, 119, 232, 181, 49, 140, 82, 192, 65, 167, 94, 196, 10, 162, 138, 163, 9, 240, 203, 230, 23, 117, 118, 217, 35, 59, 80, 150, 105, 253, 127, 105, 53, 54, 134, 90, 78, 161, 95, 123, 164, 235, 209, 143, 12, 199, 20, 167, 53, 246, 87, 5, 76, 164, 90, 230, 19, 34, 24, 30, 133, 190, 136, 129, 68, 208, 98, 110, 170, 174, 135, 152, 155, 76, 215, 26, 189, 63, 72, 14, 57, 186, 173, 44, 212, 212, 66, 120, 155, 51, 62, 116, 210, 218, 49, 125, 23, 134 }}, - CrcCheck { "CRC-16-RANDOM-16", 16, 0x000000000000e5dd, 0x0000000000009239, 0x00000000000006f7, false, false, 0x0000000000005351, { 185, 105, 153, 99, 108, 57, 120, 51, 20, 3, 200, 10, 175, 75, 171, 152, 175, 99, 174, 14, 48, 148, 220, 47, 84, 168, 249, 218, 35, 74, 212, 106, 182, 241, 40, 210, 59, 193, 243, 1, 225, 152, 167, 139, 119, 252, 61, 192, 71, 32, 236, 161, 110, 30, 151, 179, 147, 225, 190, 238, 30, 131, 165, 128, 141, 6, 84, 62, 13, 147, 135, 190, 42, 97, 140, 154, 231, 162, 125, 98, 239, 156, 248, 149, 43, 112, 164, 127, 103, 1, 59, 30, 210, 140, 174, 72, 121, 187, 29, 204, 32, 120, 108, 243, 54, 124, 30, 88, 116, 179, 188, 230, 16, 139, 153, 151, 128, 109, 155, 131, 56, 83, 125, 11, 178, 79, 68, 209, 198, 216, 81, 133, 171, 184, 222, 68, 99, 153, 34, 93, 135, 148, 128, 21, 110, 248, 141, 92, 92, 117, 154, 56, 250, 210, 126, 109, 113, 233, 143, 253, 8, 184, 61, 223, 170, 131, 215, 150, 57, 91, 95, 200, 151, 185, 234, 166, 113, 73, 34, 83, 204, 6 } }, - CrcCheck { "CRC-16-RANDOM-17", 16, 0x000000000000b4a3, 0x000000000000b94e, 0x000000000000744e, true, true, 0x000000000000cd8b, { 55, 240, 81, 130, 195, 14, 15, 70, 94, 190, 211, 82, 239, 29, 140, 56, 29, 155, 47, 100, 41, 110, 50, 185, 94, 203, 192, 11, 78, 245, 44, 158, 244, 176, 132, 85, 193, 94, 32, 74, 6, 224, 248, 2, 61, 8, 227, 112, 10, 58, 81, 76, 56, 252, 147, 99, 226, 82, 203, 87, 9, 216, 201, 189, 195, 142, 216, 248, 73, 157, 62 } }, - CrcCheck { "CRC-16-RANDOM-18", 16, 0x0000000000009c67, 0x0000000000006327, 0x0000000000008e39, false, false, 0x000000000000d9e0, { 37, 181, 10, 26, 177, 9, 181, 162, 61, 13, 117, 143, 203, 86, 77, 104, 107, 0, 187, 12, 243, 73, 117, 131, 36, 34, 68, 180, 221, 2, 10, 104, 42, 247, 230, 199, 208, 83, 55, 235, 33, 104, 10, 91, 250, 88, 16, 24, 191, 252, 94, 152, 208, 179, 216, 41, 101, 64, 217, 76, 33, 231 } }, + CrcCheck { .name="CRC-16-RANDOM-10", .width=16, .poly=0x000000000000afbb, .init=0x00000000000091ea, .xorOut=0x0000000000000ea8, .refIn=true, .refOut=true, .result=0x0000000000000670, .data={ 239, 127, 45, 34, 24, 9, 68, 49, 206, 206, 71, 116, 233, 144, 237, 184, 241, 86, 244, 237, 163, 167, 42, 194, 69, 147, 236, 136, 245, 183, 254, 2, 67, 220, 111, 241, 168, 255, 36, 248, 147, 137, 75, 137, 201, 100, 215, 161, 36, 13, 54, 235, 34, 187, 75, 82, 227, 97, 240, 137, 173, 165, 246, 129, 30, 174, 42, 21, 185, 94, 43, 218, 126, 90, 197, 205, 15, 21, 115, 50, 103, 38, 178, 124, 27, 24, 208, 157, 41, 53, 204, 158, 198, 238, 133, 61, 164, 203, 159, 6, 94, 213, 225, 145, 61, 245, 86, 157, 126, 41, 130, 195, 130, 11, 48, 29, 193, 187, 127, 135, 83, 44, 232, 66, 169, 147, 106, 11, 118, 124, 189, 114, 131, 148, 106, 45, 250, 134, 11, 189, 179, 74, 92, 43, 8, 116, 18, 241, 53, 218, 160, 169, 65, 112, 161, 63, 208, 61, 223, 18, 254, 51, 87, 101, 180, 244, 149, 78, 135, 54, 222, 122, 244, 184, 44 } }, + CrcCheck { .name="CRC-16-RANDOM-11", .width=16, .poly=0x0000000000001b6c, .init=0x0000000000005bce, .xorOut=0x000000000000e29c, .refIn=true, .refOut=true, .result=0x000000000000dfa2, .data={ 92, 73, 175, 57, 17, 7, 61, 3, 7, 81, 172, 188, 91, 214, 51, 201, 52, 249, 51, 206, 210, 79, 156, 42, 36, 28, 235, 71, 83, 127, 30, 123, 200, 55, 127, 217, 218, 71, 203, 29, 223, 222, 198, 56, 138, 207, 196, 46, 195, 105, 28, 45, 5, 138, 168, 54, 239, 203, 1, 0, 105, 110, 21, 193, 207 } }, + CrcCheck { .name="CRC-16-RANDOM-12", .width=16, .poly=0x000000000000477b, .init=0x000000000000afa4, .xorOut=0x0000000000003d01, .refIn=false, .refOut=false, .result=0x0000000000000b96, .data={ 63, 84, 254, 94, 21, 194, 88, 199, 189, 117, 111, 234, 231, 51, 119, 117, 203, 239, 210, 109, 162, 58, 158, 239, 163, 18, 68, 233, 37, 120, 48, 205, 17, 188, 141, 44, 143, 147, 173, 105 } }, + CrcCheck { .name="CRC-16-RANDOM-13", .width=16, .poly=0x0000000000004438, .init=0x0000000000008e25, .xorOut=0x0000000000006c55, .refIn=false, .refOut=false, .result=0x0000000000004a6d, .data={ 179, 169, 67, 230, 228, 213, 173, 155, 152, 64, 85, 170, 20, 177, 38, 127, 169, 186, 44, 163, 153, 153, 11, 112, 63, 24, 127, 25, 135, 40, 214, 33, 88, 132, 14, 84, 82, 66, 216, 75, 55, 231, 101, 114, 68, 244, 56, 140, 100, 196, 226, 60, 0, 177, 187, 164, 237, 1, 199, 119, 249, 148, 102, 175, 32, 62, 232, 179, 30, 102, 85, 8, 188, 61, 28, 156, 74, 71, 11, 102, 51, 243, 120, 60, 146, 207, 116, 156, 219, 237, 157, 25, 0, 149, 7, 137, 248, 102, 157, 171, 60, 76, 117, 29, 34, 117, 148, 241, 142, 18, 251, 240, 37, 213, 171, 120, 85, 145, 50, 209, 130, 225, 28, 27, 170, 195, 148, 102 } }, + CrcCheck { .name="CRC-16-RANDOM-14", .width=16, .poly=0x000000000000f461, .init=0x0000000000004d96, .xorOut=0x0000000000003e1d, .refIn=true, .refOut=true, .result=0x0000000000009eef, .data={ 38, 252, 182, 80, 159, 97, 166, 150, 29, 9, 45, 216, 186, 165, 148, 128, 60, 170, 243, 69, 177, 203, 17, 191, 5, 60, 209, 41, 20, 42, 23, 147, 126, 209, 125, 157, 30, 45, 94, 157, 146, 7, 20, 234, 70, 23, 141, 87, 88, 93, 184, 169, 69, 88, 108, 253, 58, 157, 175, 88, 177, 154, 181, 127, 216, 82, 202, 16, 164, 227, 188, 243, 140, 84, 24, 213, 31, 130, 185, 234, 215, 248, 169, 233, 4, 208, 67, 102, 248, 13, 114, 162, 175, 187, 120, 228, 213, 93 } }, + CrcCheck { .name="CRC-16-RANDOM-15", .width=16, .poly=0x000000000000bbf3, .init=0x000000000000e279, .xorOut=0x000000000000a01c, .refIn=false, .refOut=false, .result=0x000000000000f294, .data={ 251, 1, 172, 207, 75, 242, 148, 19, 255, 106, 41, 114, 213, 142, 229, 239, 156, 23, 225, 4, 181, 190, 130, 111, 160, 59, 145, 253, 181, 114, 17, 118, 65, 201, 206, 61, 137, 118, 87, 156, 205, 110, 6, 63, 153, 254, 163, 225, 66, 88, 232, 189, 126, 92, 228, 204, 0, 243, 78, 239, 62, 193, 27, 197, 106, 96, 215, 1, 143, 116, 114, 112, 6, 150, 209, 152, 254, 66, 54, 94, 123, 109, 220, 31, 156, 118, 201, 119, 232, 181, 49, 140, 82, 192, 65, 167, 94, 196, 10, 162, 138, 163, 9, 240, 203, 230, 23, 117, 118, 217, 35, 59, 80, 150, 105, 253, 127, 105, 53, 54, 134, 90, 78, 161, 95, 123, 164, 235, 209, 143, 12, 199, 20, 167, 53, 246, 87, 5, 76, 164, 90, 230, 19, 34, 24, 30, 133, 190, 136, 129, 68, 208, 98, 110, 170, 174, 135, 152, 155, 76, 215, 26, 189, 63, 72, 14, 57, 186, 173, 44, 212, 212, 66, 120, 155, 51, 62, 116, 210, 218, 49, 125, 23, 134 }}, + CrcCheck { .name="CRC-16-RANDOM-16", .width=16, .poly=0x000000000000e5dd, .init=0x0000000000009239, .xorOut=0x00000000000006f7, .refIn=false, .refOut=false, .result=0x0000000000005351, .data={ 185, 105, 153, 99, 108, 57, 120, 51, 20, 3, 200, 10, 175, 75, 171, 152, 175, 99, 174, 14, 48, 148, 220, 47, 84, 168, 249, 218, 35, 74, 212, 106, 182, 241, 40, 210, 59, 193, 243, 1, 225, 152, 167, 139, 119, 252, 61, 192, 71, 32, 236, 161, 110, 30, 151, 179, 147, 225, 190, 238, 30, 131, 165, 128, 141, 6, 84, 62, 13, 147, 135, 190, 42, 97, 140, 154, 231, 162, 125, 98, 239, 156, 248, 149, 43, 112, 164, 127, 103, 1, 59, 30, 210, 140, 174, 72, 121, 187, 29, 204, 32, 120, 108, 243, 54, 124, 30, 88, 116, 179, 188, 230, 16, 139, 153, 151, 128, 109, 155, 131, 56, 83, 125, 11, 178, 79, 68, 209, 198, 216, 81, 133, 171, 184, 222, 68, 99, 153, 34, 93, 135, 148, 128, 21, 110, 248, 141, 92, 92, 117, 154, 56, 250, 210, 126, 109, 113, 233, 143, 253, 8, 184, 61, 223, 170, 131, 215, 150, 57, 91, 95, 200, 151, 185, 234, 166, 113, 73, 34, 83, 204, 6 } }, + CrcCheck { .name="CRC-16-RANDOM-17", .width=16, .poly=0x000000000000b4a3, .init=0x000000000000b94e, .xorOut=0x000000000000744e, .refIn=true, .refOut=true, .result=0x000000000000cd8b, .data={ 55, 240, 81, 130, 195, 14, 15, 70, 94, 190, 211, 82, 239, 29, 140, 56, 29, 155, 47, 100, 41, 110, 50, 185, 94, 203, 192, 11, 78, 245, 44, 158, 244, 176, 132, 85, 193, 94, 32, 74, 6, 224, 248, 2, 61, 8, 227, 112, 10, 58, 81, 76, 56, 252, 147, 99, 226, 82, 203, 87, 9, 216, 201, 189, 195, 142, 216, 248, 73, 157, 62 } }, + CrcCheck { .name="CRC-16-RANDOM-18", .width=16, .poly=0x0000000000009c67, .init=0x0000000000006327, .xorOut=0x0000000000008e39, .refIn=false, .refOut=false, .result=0x000000000000d9e0, .data={ 37, 181, 10, 26, 177, 9, 181, 162, 61, 13, 117, 143, 203, 86, 77, 104, 107, 0, 187, 12, 243, 73, 117, 131, 36, 34, 68, 180, 221, 2, 10, 104, 42, 247, 230, 199, 208, 83, 55, 235, 33, 104, 10, 91, 250, 88, 16, 24, 191, 252, 94, 152, 208, 179, 216, 41, 101, 64, 217, 76, 33, 231 } }, }; TEST_ASSERT(!checkCrcAgainstGondenSamples(hex::crypt::crc16, golden_samples)); @@ -310,23 +310,23 @@ TEST_SEQUENCE("CRC16Random") { TEST_SEQUENCE("CRC8") { std::array golden_samples = { // source: Sunshine's Homepage - Online CRC Calculator Javascript [http://www.sunshine2k.de/coding/javascript/crc/crc_js.html] - CrcCheck {"CRC-8-0-check", 8, 0xD5, 0xff, 0x00, true, true, 0x7f, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-8-1-check", 8, 0xD5, 0xff, 0x00, true, false, 0xfe, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-8-2-check", 8, 0xD5, 0xff, 0x00, false, true, 0x3e, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-8-3-check", 8, 0xD5, 0xff, 0x00, false, false, 0x7c, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, - CrcCheck { "CRC-8-3-check", 8, 0xD5, 0x42, 0x5a, false, false, 0x4a, { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck {.name="CRC-8-0-check", .width=8, .poly=0xD5, .init=0xff, .xorOut=0x00, .refIn=true, .refOut=true, .result=0x7f, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-8-1-check", .width=8, .poly=0xD5, .init=0xff, .xorOut=0x00, .refIn=true, .refOut=false, .result=0xfe, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-8-2-check", .width=8, .poly=0xD5, .init=0xff, .xorOut=0x00, .refIn=false, .refOut=true, .result=0x3e, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-8-3-check", .width=8, .poly=0xD5, .init=0xff, .xorOut=0x00, .refIn=false, .refOut=false, .result=0x7c, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, + CrcCheck { .name="CRC-8-3-check", .width=8, .poly=0xD5, .init=0x42, .xorOut=0x5a, .refIn=false, .refOut=false, .result=0x4a, .data={ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 } }, // source: generated by Boost CRC from random data and random parameters - CrcCheck { "CRC-8-RANDOM-0", 8, 0x000000000000008b, 0x00000000000000d4, 0x00000000000000c7, true, false, 0x0000000000000093, { 195, 137, 209, 107, 84, 196, 218, 41, 155, 11, 48, 19, 105, 74, 207, 198, 134, 17, 172, 76, 89, 18, 81, 236, 101, 109, 222, 62, 254, 170, 66, 240, 56, 184, 199, 187, 253, 115, 251, 59, 115, 2, 105, 234, 91, 110, 86, 36, 31, 129, 146, 217, 16, 90, 115, 35, 27, 17, 81, 247, 215, 8, 67, 77, 103, 141, 9, 101, 90, 36, 155, 193, 106, 186, 134, 46, 182, 124, 220, 46, 4, 203, 171, 215, 56, 132, 110, 146, 77, 231, 214, 233, 17, 49, 77, 119, 80, 77, 158, 253, 255, 74, 94, 232, 77, 94, 81, 48, 164, 29, 51, 81, 122, 71, 23, 57, 126, 176, 129, 250, 163, 6, 1, 191, 5, 93, 172, 176, 128, 202, 52, 89, 104, 36, 50, 30, 64, 216, 19, 140, 229, 7, 214, 168, 155 } }, - CrcCheck { "CRC-8-RANDOM-1", 8, 0x000000000000005d, 0x0000000000000077, 0x0000000000000005, false, false, 0x000000000000009a, { 40, 210, 96, 74, 179, 97, 240, 65, 23, 50, 222, 233, 252, 131, 110, 135, 141, 161, 239, 91, 108, 132, 166, 169, 82, 187, 251, 92, 125, 57, 64, 207, 238, 108, 243, 72, 50, 229, 127, 224, 235, 179, 59, 107, 36, 48, 15, 165, 24, 196, 221, 5, 116, 57, 5, 124, 1, 64, 141, 134, 82, 159, 200, 171, 19, 10, 196, 70, 80, 39, 2, 188, 230, 165, 138, 178, 38, 44, 26, 225, 212, 32, 44, 139, 39, 125, 231, 94, 224, 89, 47, 125, 6, 46, 254, 49, 101, 225, 23, 44, 89, 16, 76, 50, 23, 115, 188, 185, 76, 100, 122, 1, 57, 239, 100, 180, 63, 158, 205, 6 } }, - CrcCheck { "CRC-8-RANDOM-2", 8, 0x00000000000000ea, 0x00000000000000d9, 0x0000000000000000, false, false, 0x0000000000000092, { 215, 10, 66, 226, 48, 21, 189, 238, 141, 93, 174, 19, 109, 196, 154, 78, 215 } }, - CrcCheck { "CRC-8-RANDOM-3", 8, 0x00000000000000f3, 0x000000000000007b, 0x000000000000007f, true, true, 0x00000000000000de, { 120, 75, 112, 57, 59, 218, 44, 68, 242, 0, 155, 24, 95, 210, 134, 36, 136, 139, 106, 190, 215, 23, 15, 45, 185, 217, 72, 219, 214, 170, 89, 93, 179, 61, 71, 162, 221, 10, 37, 163, 205, 10, 136, 200, 77, 102, 51, 188, 170, 232, 196, 184, 200, 98, 79, 150, 249, 253, 188, 27, 53, 169, 239, 246, 167, 28, 100, 86, 224, 197, 201, 8, 176, 114, 195, 40, 181, 52, 77, 27, 151, 45, 44, 205, 245, 240, 182, 223, 205, 182, 57, 102, 44, 72, 201, 233, 168, 241, 30, 253, 104, 7, 72, 227, 135, 49, 63, 209, 187, 174, 29, 255, 237, 107, 77, 22, 187, 148, 64, 207, 175, 218, 201, 104, 45, 54, 204, 65, 80, 6, 185, 187, 10, 246, 222, 62, 115, 88, 250, 65, 148, 127, 28, 93, 121, 161, 65, 87, 150, 151, 117, 199, 229, 98, 31, 145, 34, 242, 145, 146, 9, 24, 176, 248, 104, 180, 208, 181, 64, 223, 171, 144, 156, 80, 234, 169, 218, 107, 68, 62, 147, 7, 61, 102, 75, 112, 168, 33, 13, 132, 56, 46, 181, 219, 84, 137, 64, 84, 228, 172, 143 } }, - CrcCheck { "CRC-8-RANDOM-4", 8, 0x00000000000000a1, 0x0000000000000035, 0x0000000000000013, true, true, 0x00000000000000e8, { 132, 238, 232, 49, 230, 205, 207, 227, 227, 111, 23, 5, 192, 33, 32, 227, 219, 48, 97, 228, 184, 213, 25, 66, 188, 16, 190, 115, 253, 113, 144, 222, 9, 120, 159, 187, 23, 146, 37, 212, 214, 3, 54, 190, 246, 3, 55, 19, 254, 150, 31, 36, 112, 89, 32, 78, 42, 171, 124, 3, 229, 191, 144, 10, 60, 209, 46, 54, 11, 205, 109, 52, 142, 67, 189, 186, 147, 219, 91, 21, 1, 61, 143, 77, 38, 15, 150, 126, 140, 139, 233, 83, 103, 162, 1, 79, 30, 223, 51, 93, 43, 131, 8, 123, 228, 37 } }, - CrcCheck { "CRC-8-RANDOM-5", 8, 0x0000000000000095, 0x00000000000000d8, 0x0000000000000043, false, false, 0x0000000000000008, { 25, 135, 154, 213, 104, 181, 83, 188, 128, 84, 4, 175, 2, 108, 206, 235, 11, 252, 150, 39, 125, 195, 172, 130, 109, 181, 73, 171, 211, 35, 162, 82, 207, 1, 73, 78, 24, 102, 151, 170, 234, 242, 127, 77, 161, 43, 80, 176, 5, 89, 11, 51, 24, 60, 144, 187, 182, 70, 177, 218, 126, 230, 188, 108, 205, 181, 17, 55, 154, 207, 228, 209, 77, 99, 122, 146, 209, 199, 47, 177, 200, 178, 139, 239, 27, 56, 183, 228, 153, 127, 47, 34, 111, 78, 161, 54, 86, 110, 244, 126, 108, 95, 7, 100, 160, 26, 133, 76, 101, 59, 25, 54, 23, 83, 148, 90, 26, 252, 213, 37, 9, 97, 10, 56, 53, 213, 152, 111, 126, 254, 101, 232, 71, 1, 166, 14, 159, 196, 71, 113, 20, 232, 138, 115, 126, 64, 140, 11, 52, 78, 240, 45, 160, 103, 212, 19, 188, 238, 141, 92, 126, 36, 160, 44, 72, 121, 60, 8, 211, 112, 192, 198, 50, 83, 177, 80, 166, 107, 96, 205, 183, 126, 229, 254, 128, 154, 191, 242, 251, 248, 122, 174, 162, 89, 136, 83, 217, 220, 224, 106, 23, 22, 33, 63, 142, 226, 83, 247, 60, 102, 193, 36, 63, 235, 97, 182, 86, 229, 85, 98, 90, 17, 253, 134, 201, 253, 64, 39, 33, 223, 8, 110, 55, 10, 223, 136, 14, 229, 66, 179, 79, 203, 110, 41, 151, 194, 85, 190, 122, 114, 109, 209, 59, 8 }}, - CrcCheck { "CRC-8-RANDOM-6", 8, 0x0000000000000081, 0x0000000000000083, 0x00000000000000d7, true, true, 0x000000000000006d, { 7, 210, 211, 232, 246, 26, 147, 95, 236, 136, 206, 194, 251, 106, 140, 115, 125, 183, 176, 39, 84, 236, 236, 111, 120, 165, 211, 12, 217, 60, 139, 2, 182, 81, 158, 49, 38, 96, 93, 49, 197, 88, 114, 50, 235, 119, 196, 122, 165, 157, 234, 65, 166, 237, 217, 3, 247, 96, 50, 108, 153, 156, 123, 252, 224, 187, 215, 151, 52, 160, 149, 74, 50, 125, 233, 96, 242, 124, 176, 78, 178, 23, 232, 133, 191, 213, 121, 225, 34, 220, 87, 25, 187, 26, 22, 92, 92, 249, 175, 216, 162, 190, 191, 198, 166, 49, 225, 161, 117, 215, 227, 218, 80, 32, 253, 0, 19, 26, 235, 9, 23, 198, 23, 181, 161, 152, 121, 166, 57, 189, 66, 197, 72, 229, 18, 34, 146, 179, 93, 148, 184, 51, 143, 140, 138, 94, 45, 100, 194, 200, 80, 224, 15, 154, 31, 142, 55, 72, 252, 47, 76, 235, 189, 249, 27, 126, 101, 245, 232, 46, 46, 152, 208, 23, 9, 206, 76, 174, 133, 229, 221, 146, 243, 126, 73, 8, 98, 83 } }, - CrcCheck { "CRC-8-RANDOM-7", 8, 0x00000000000000e5, 0x000000000000001e, 0x00000000000000ca, false, true, 0x00000000000000ac, { 207, 120, 96, 152, 93, 112, 171, 102, 62, 189, 137, 61, 204, 42, 249, 226, 131, 164, 162, 33, 222, 75, 84, 174, 63, 71, 125, 255, 254, 135, 241, 176, 17, 184, 193, 248, 167, 247, 117, 192, 182 } }, - CrcCheck { "CRC-8-RANDOM-8", 8, 0x0000000000000003, 0x0000000000000035, 0x0000000000000033, true, false, 0x00000000000000d9, { 96, 249, 185, 15, 247, 136, 115, 115, 87, 117, 90, 120, 18, 197, 112, 61, 70, 87, 22, 98, 103, 241, 49, 87, 120, 119, 201, 92, 192, 109, 175, 86, 135, 157, 183, 66, 43, 21, 76, 201 } }, - CrcCheck { "CRC-8-RANDOM-9", 8, 0x000000000000002c, 0x0000000000000094, 0x0000000000000001, false, false, 0x0000000000000095, { 52, 156, 20, 14, 1, 178, 132, 57, 220, 251, 1, 215, 195, 236, 197, 102, 193, 157, 140, 196, 132, 204, 155, 140, 185, 73, 13, 252, 175, 141, 171, 139, 221, 14, 156, 253, 107, 24, 153, 166, 217, 181, 203, 39, 172, 114, 160, 88, 197, 221, 51, 241, 70, 152, 181, 31, 88, 165, 30, 123, 231, 163, 75, 107, 55, 95, 2, 13, 70, 128, 165, 27, 224, 105, 51, 97, 76, 160, 100, 245, 174, 32, 109, 251, 43, 55, 139, 88, 89, 122, 194, 92, 245, 188, 236, 38, 211, 19, 252, 17, 209, 60, 133, 227, 36, 69, 213, 161, 162, 187, 161, 202, 3, 71, 32, 29, 131, 167, 43, 99, 175, 141, 70, 62, 3, 56, 100, 107, 165, 123, 239, 252, 219, 111, 11, 31, 216, 22, 111, 27, 7, 44, 168, 68, 216, 58, 207, 231, 94, 58, 178, 210, 149 } }, + CrcCheck { .name="CRC-8-RANDOM-0", .width=8, .poly=0x000000000000008b, .init=0x00000000000000d4, .xorOut=0x00000000000000c7, .refIn=true, .refOut=false, .result=0x0000000000000093, .data={ 195, 137, 209, 107, 84, 196, 218, 41, 155, 11, 48, 19, 105, 74, 207, 198, 134, 17, 172, 76, 89, 18, 81, 236, 101, 109, 222, 62, 254, 170, 66, 240, 56, 184, 199, 187, 253, 115, 251, 59, 115, 2, 105, 234, 91, 110, 86, 36, 31, 129, 146, 217, 16, 90, 115, 35, 27, 17, 81, 247, 215, 8, 67, 77, 103, 141, 9, 101, 90, 36, 155, 193, 106, 186, 134, 46, 182, 124, 220, 46, 4, 203, 171, 215, 56, 132, 110, 146, 77, 231, 214, 233, 17, 49, 77, 119, 80, 77, 158, 253, 255, 74, 94, 232, 77, 94, 81, 48, 164, 29, 51, 81, 122, 71, 23, 57, 126, 176, 129, 250, 163, 6, 1, 191, 5, 93, 172, 176, 128, 202, 52, 89, 104, 36, 50, 30, 64, 216, 19, 140, 229, 7, 214, 168, 155 } }, + CrcCheck { .name="CRC-8-RANDOM-1", .width=8, .poly=0x000000000000005d, .init=0x0000000000000077, .xorOut=0x0000000000000005, .refIn=false, .refOut=false, .result=0x000000000000009a, .data={ 40, 210, 96, 74, 179, 97, 240, 65, 23, 50, 222, 233, 252, 131, 110, 135, 141, 161, 239, 91, 108, 132, 166, 169, 82, 187, 251, 92, 125, 57, 64, 207, 238, 108, 243, 72, 50, 229, 127, 224, 235, 179, 59, 107, 36, 48, 15, 165, 24, 196, 221, 5, 116, 57, 5, 124, 1, 64, 141, 134, 82, 159, 200, 171, 19, 10, 196, 70, 80, 39, 2, 188, 230, 165, 138, 178, 38, 44, 26, 225, 212, 32, 44, 139, 39, 125, 231, 94, 224, 89, 47, 125, 6, 46, 254, 49, 101, 225, 23, 44, 89, 16, 76, 50, 23, 115, 188, 185, 76, 100, 122, 1, 57, 239, 100, 180, 63, 158, 205, 6 } }, + CrcCheck { .name="CRC-8-RANDOM-2", .width=8, .poly=0x00000000000000ea, .init=0x00000000000000d9, .xorOut=0x0000000000000000, .refIn=false, .refOut=false, .result=0x0000000000000092, .data={ 215, 10, 66, 226, 48, 21, 189, 238, 141, 93, 174, 19, 109, 196, 154, 78, 215 } }, + CrcCheck { .name="CRC-8-RANDOM-3", .width=8, .poly=0x00000000000000f3, .init=0x000000000000007b, .xorOut=0x000000000000007f, .refIn=true, .refOut=true, .result=0x00000000000000de, .data={ 120, 75, 112, 57, 59, 218, 44, 68, 242, 0, 155, 24, 95, 210, 134, 36, 136, 139, 106, 190, 215, 23, 15, 45, 185, 217, 72, 219, 214, 170, 89, 93, 179, 61, 71, 162, 221, 10, 37, 163, 205, 10, 136, 200, 77, 102, 51, 188, 170, 232, 196, 184, 200, 98, 79, 150, 249, 253, 188, 27, 53, 169, 239, 246, 167, 28, 100, 86, 224, 197, 201, 8, 176, 114, 195, 40, 181, 52, 77, 27, 151, 45, 44, 205, 245, 240, 182, 223, 205, 182, 57, 102, 44, 72, 201, 233, 168, 241, 30, 253, 104, 7, 72, 227, 135, 49, 63, 209, 187, 174, 29, 255, 237, 107, 77, 22, 187, 148, 64, 207, 175, 218, 201, 104, 45, 54, 204, 65, 80, 6, 185, 187, 10, 246, 222, 62, 115, 88, 250, 65, 148, 127, 28, 93, 121, 161, 65, 87, 150, 151, 117, 199, 229, 98, 31, 145, 34, 242, 145, 146, 9, 24, 176, 248, 104, 180, 208, 181, 64, 223, 171, 144, 156, 80, 234, 169, 218, 107, 68, 62, 147, 7, 61, 102, 75, 112, 168, 33, 13, 132, 56, 46, 181, 219, 84, 137, 64, 84, 228, 172, 143 } }, + CrcCheck { .name="CRC-8-RANDOM-4", .width=8, .poly=0x00000000000000a1, .init=0x0000000000000035, .xorOut=0x0000000000000013, .refIn=true, .refOut=true, .result=0x00000000000000e8, .data={ 132, 238, 232, 49, 230, 205, 207, 227, 227, 111, 23, 5, 192, 33, 32, 227, 219, 48, 97, 228, 184, 213, 25, 66, 188, 16, 190, 115, 253, 113, 144, 222, 9, 120, 159, 187, 23, 146, 37, 212, 214, 3, 54, 190, 246, 3, 55, 19, 254, 150, 31, 36, 112, 89, 32, 78, 42, 171, 124, 3, 229, 191, 144, 10, 60, 209, 46, 54, 11, 205, 109, 52, 142, 67, 189, 186, 147, 219, 91, 21, 1, 61, 143, 77, 38, 15, 150, 126, 140, 139, 233, 83, 103, 162, 1, 79, 30, 223, 51, 93, 43, 131, 8, 123, 228, 37 } }, + CrcCheck { .name="CRC-8-RANDOM-5", .width=8, .poly=0x0000000000000095, .init=0x00000000000000d8, .xorOut=0x0000000000000043, .refIn=false, .refOut=false, .result=0x0000000000000008, .data={ 25, 135, 154, 213, 104, 181, 83, 188, 128, 84, 4, 175, 2, 108, 206, 235, 11, 252, 150, 39, 125, 195, 172, 130, 109, 181, 73, 171, 211, 35, 162, 82, 207, 1, 73, 78, 24, 102, 151, 170, 234, 242, 127, 77, 161, 43, 80, 176, 5, 89, 11, 51, 24, 60, 144, 187, 182, 70, 177, 218, 126, 230, 188, 108, 205, 181, 17, 55, 154, 207, 228, 209, 77, 99, 122, 146, 209, 199, 47, 177, 200, 178, 139, 239, 27, 56, 183, 228, 153, 127, 47, 34, 111, 78, 161, 54, 86, 110, 244, 126, 108, 95, 7, 100, 160, 26, 133, 76, 101, 59, 25, 54, 23, 83, 148, 90, 26, 252, 213, 37, 9, 97, 10, 56, 53, 213, 152, 111, 126, 254, 101, 232, 71, 1, 166, 14, 159, 196, 71, 113, 20, 232, 138, 115, 126, 64, 140, 11, 52, 78, 240, 45, 160, 103, 212, 19, 188, 238, 141, 92, 126, 36, 160, 44, 72, 121, 60, 8, 211, 112, 192, 198, 50, 83, 177, 80, 166, 107, 96, 205, 183, 126, 229, 254, 128, 154, 191, 242, 251, 248, 122, 174, 162, 89, 136, 83, 217, 220, 224, 106, 23, 22, 33, 63, 142, 226, 83, 247, 60, 102, 193, 36, 63, 235, 97, 182, 86, 229, 85, 98, 90, 17, 253, 134, 201, 253, 64, 39, 33, 223, 8, 110, 55, 10, 223, 136, 14, 229, 66, 179, 79, 203, 110, 41, 151, 194, 85, 190, 122, 114, 109, 209, 59, 8 }}, + CrcCheck { .name="CRC-8-RANDOM-6", .width=8, .poly=0x0000000000000081, .init=0x0000000000000083, .xorOut=0x00000000000000d7, .refIn=true, .refOut=true, .result=0x000000000000006d, .data={ 7, 210, 211, 232, 246, 26, 147, 95, 236, 136, 206, 194, 251, 106, 140, 115, 125, 183, 176, 39, 84, 236, 236, 111, 120, 165, 211, 12, 217, 60, 139, 2, 182, 81, 158, 49, 38, 96, 93, 49, 197, 88, 114, 50, 235, 119, 196, 122, 165, 157, 234, 65, 166, 237, 217, 3, 247, 96, 50, 108, 153, 156, 123, 252, 224, 187, 215, 151, 52, 160, 149, 74, 50, 125, 233, 96, 242, 124, 176, 78, 178, 23, 232, 133, 191, 213, 121, 225, 34, 220, 87, 25, 187, 26, 22, 92, 92, 249, 175, 216, 162, 190, 191, 198, 166, 49, 225, 161, 117, 215, 227, 218, 80, 32, 253, 0, 19, 26, 235, 9, 23, 198, 23, 181, 161, 152, 121, 166, 57, 189, 66, 197, 72, 229, 18, 34, 146, 179, 93, 148, 184, 51, 143, 140, 138, 94, 45, 100, 194, 200, 80, 224, 15, 154, 31, 142, 55, 72, 252, 47, 76, 235, 189, 249, 27, 126, 101, 245, 232, 46, 46, 152, 208, 23, 9, 206, 76, 174, 133, 229, 221, 146, 243, 126, 73, 8, 98, 83 } }, + CrcCheck { .name="CRC-8-RANDOM-7", .width=8, .poly=0x00000000000000e5, .init=0x000000000000001e, .xorOut=0x00000000000000ca, .refIn=false, .refOut=true, .result=0x00000000000000ac, .data={ 207, 120, 96, 152, 93, 112, 171, 102, 62, 189, 137, 61, 204, 42, 249, 226, 131, 164, 162, 33, 222, 75, 84, 174, 63, 71, 125, 255, 254, 135, 241, 176, 17, 184, 193, 248, 167, 247, 117, 192, 182 } }, + CrcCheck { .name="CRC-8-RANDOM-8", .width=8, .poly=0x0000000000000003, .init=0x0000000000000035, .xorOut=0x0000000000000033, .refIn=true, .refOut=false, .result=0x00000000000000d9, .data={ 96, 249, 185, 15, 247, 136, 115, 115, 87, 117, 90, 120, 18, 197, 112, 61, 70, 87, 22, 98, 103, 241, 49, 87, 120, 119, 201, 92, 192, 109, 175, 86, 135, 157, 183, 66, 43, 21, 76, 201 } }, + CrcCheck { .name="CRC-8-RANDOM-9", .width=8, .poly=0x000000000000002c, .init=0x0000000000000094, .xorOut=0x0000000000000001, .refIn=false, .refOut=false, .result=0x0000000000000095, .data={ 52, 156, 20, 14, 1, 178, 132, 57, 220, 251, 1, 215, 195, 236, 197, 102, 193, 157, 140, 196, 132, 204, 155, 140, 185, 73, 13, 252, 175, 141, 171, 139, 221, 14, 156, 253, 107, 24, 153, 166, 217, 181, 203, 39, 172, 114, 160, 88, 197, 221, 51, 241, 70, 152, 181, 31, 88, 165, 30, 123, 231, 163, 75, 107, 55, 95, 2, 13, 70, 128, 165, 27, 224, 105, 51, 97, 76, 160, 100, 245, 174, 32, 109, 251, 43, 55, 139, 88, 89, 122, 194, 92, 245, 188, 236, 38, 211, 19, 252, 17, 209, 60, 133, 227, 36, 69, 213, 161, 162, 187, 161, 202, 3, 71, 32, 29, 131, 167, 43, 99, 175, 141, 70, 62, 3, 56, 100, 107, 165, 123, 239, 252, 219, 111, 11, 31, 216, 22, 111, 27, 7, 44, 168, 68, 216, 58, 207, 231, 94, 58, 178, 210, 149 } }, }; TEST_ASSERT(!checkCrcAgainstGondenSamples(hex::crypt::crc8, golden_samples)); @@ -378,20 +378,20 @@ int checkHashVectorAgainstGondenSamples(Ret (*func)(const std::vector &), Ra TEST_SEQUENCE("md5") { std::array golden_samples = { // source: RFC 1321: The MD5 Message-Digest Algorithm [https://datatracker.ietf.org/doc/html/rfc1321#appendix-A.5] - HashCheck {"", - "d41d8cd98f00b204e9800998ecf8427e"}, - HashCheck { "a", - "0cc175b9c0f1b6a831c399e269772661"}, - HashCheck { "abc", - "900150983cd24fb0d6963f7d28e17f72"}, - HashCheck { "message digest", - "f96b697d7cb7938d525a2f31aaf161d0"}, - HashCheck { "abcdefghijklmnopqrstuvwxyz", - "c3fcd3d76192e4007dfb496cca67e13b"}, - HashCheck { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - "d174ab98d277d9f5a5611c2c9f419d9f"}, - HashCheck { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - "57edf4a22be3c955ac49da2e2107b67a"}, + HashCheck {.data="", + .result="d41d8cd98f00b204e9800998ecf8427e"}, + HashCheck { .data="a", + .result="0cc175b9c0f1b6a831c399e269772661"}, + HashCheck { .data="abc", + .result="900150983cd24fb0d6963f7d28e17f72"}, + HashCheck { .data="message digest", + .result="f96b697d7cb7938d525a2f31aaf161d0"}, + HashCheck { .data="abcdefghijklmnopqrstuvwxyz", + .result="c3fcd3d76192e4007dfb496cca67e13b"}, + HashCheck { .data="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + .result="d174ab98d277d9f5a5611c2c9f419d9f"}, + HashCheck { .data="12345678901234567890123456789012345678901234567890123456789012345678901234567890", + .result="57edf4a22be3c955ac49da2e2107b67a"}, }; TEST_ASSERT(!checkHashProviderAgainstGondenSamples(hex::crypt::md5, golden_samples)); @@ -404,10 +404,10 @@ TEST_SEQUENCE("md5") { TEST_SEQUENCE("sha1") { std::array golden_samples = { // source: RFC 3174: US Secure Hash Algorithm 1 (SHA1) [https://datatracker.ietf.org/doc/html/rfc3174#section-7.3] - HashCheck {"abc", - "A9993E364706816ABA3E25717850C26C9CD0D89D"}, - HashCheck { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "84983E441C3BD26EBAAE4AA1F95129E5E54670F1"}, + HashCheck {.data="abc", + .result="A9993E364706816ABA3E25717850C26C9CD0D89D"}, + HashCheck { .data="abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + .result="84983E441C3BD26EBAAE4AA1F95129E5E54670F1"}, }; TEST_ASSERT(!checkHashProviderAgainstGondenSamples(hex::crypt::sha1, golden_samples)); @@ -419,10 +419,10 @@ TEST_SEQUENCE("sha1") { TEST_SEQUENCE("sha224") { std::array golden_samples = { // source: RFC 3874: A 224-bit One-way Hash Function: SHA-224 [https://datatracker.ietf.org/doc/html/rfc3874#section-3] - HashCheck {"abc", - "23097D223405D8228642A477BDA255B32AADBCE4BDA0B3F7E36C9DA7"}, - HashCheck { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "75388B16512776CC5DBA5DA1FD890150B0C6455CB4F58B1952522525"}, + HashCheck {.data="abc", + .result="23097D223405D8228642A477BDA255B32AADBCE4BDA0B3F7E36C9DA7"}, + HashCheck { .data="abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + .result="75388B16512776CC5DBA5DA1FD890150B0C6455CB4F58B1952522525"}, }; TEST_ASSERT(!checkHashProviderAgainstGondenSamples(hex::crypt::sha224, golden_samples)); @@ -434,10 +434,10 @@ TEST_SEQUENCE("sha224") { TEST_SEQUENCE("sha256") { std::array golden_samples = { // source: RFC 4634: US Secure Hash Algorithms (SHA and HMAC-SHA) [https://datatracker.ietf.org/doc/html/rfc4634#section-8.4] - HashCheck {"abc", - "BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD"}, - HashCheck { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1"}, + HashCheck {.data="abc", + .result="BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD"}, + HashCheck { .data="abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + .result="248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1"}, }; TEST_ASSERT(!checkHashProviderAgainstGondenSamples(hex::crypt::sha256, golden_samples)); @@ -449,10 +449,10 @@ TEST_SEQUENCE("sha256") { TEST_SEQUENCE("sha384") { std::array golden_samples = { // source: RFC 4634: US Secure Hash Algorithms (SHA and HMAC-SHA) [https://datatracker.ietf.org/doc/html/rfc4634#section-8.4] - HashCheck {"abc", - "CB00753F45A35E8BB5A03D699AC65007272C32AB0EDED1631A8B605A43FF5BED8086072BA1E7CC2358BAECA134C825A7"}, - HashCheck { "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", - "09330C33F71147E83D192FC782CD1B4753111B173B3B05D22FA08086E3B0F712FCC7C71A557E2DB966C3E9FA91746039"}, + HashCheck {.data="abc", + .result="CB00753F45A35E8BB5A03D699AC65007272C32AB0EDED1631A8B605A43FF5BED8086072BA1E7CC2358BAECA134C825A7"}, + HashCheck { .data="abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", + .result="09330C33F71147E83D192FC782CD1B4753111B173B3B05D22FA08086E3B0F712FCC7C71A557E2DB966C3E9FA91746039"}, }; TEST_ASSERT(!checkHashProviderAgainstGondenSamples(hex::crypt::sha384, golden_samples)); @@ -464,10 +464,10 @@ TEST_SEQUENCE("sha384") { TEST_SEQUENCE("sha512") { std::array golden_samples = { // source: RFC 4634: US Secure Hash Algorithms (SHA and HMAC-SHA) [https://datatracker.ietf.org/doc/html/rfc4634#section-8.4] - HashCheck {"abc", - "DDAF35A193617ABACC417349AE20413112E6FA4E89A97EA20A9EEEE64B55D39A2192992A274FC1A836BA3C23A3FEEBBD454D4423643CE80E2A9AC94FA54CA49F"}, - HashCheck { "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", - "8E959B75DAE313DA8CF4F72814FC143F8F7779C6EB9F7FA17299AEADB6889018501D289E4900F7E4331B99DEC4B5433AC7D329EEB6DD26545E96E55B874BE909"}, + HashCheck {.data="abc", + .result="DDAF35A193617ABACC417349AE20413112E6FA4E89A97EA20A9EEEE64B55D39A2192992A274FC1A836BA3C23A3FEEBBD454D4423643CE80E2A9AC94FA54CA49F"}, + HashCheck { .data="abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", + .result="8E959B75DAE313DA8CF4F72814FC143F8F7779C6EB9F7FA17299AEADB6889018501D289E4900F7E4331B99DEC4B5433AC7D329EEB6DD26545E96E55B874BE909"}, }; TEST_ASSERT(!checkHashProviderAgainstGondenSamples(hex::crypt::sha512, golden_samples));