Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the algorithm library: it replaces C-style headers with C++ counterparts, swaps C-style casts for static_cast, moves internal symbols from namespace detail into anonymous namespaces with ATFW_UTIL_SYMBOL_LOCAL, adds noexcept on move/swap, rewrites MurmurHash block-reading to handle unaligned input safely with may-alias struct wrappers, and cleans up a few incidental bugs.
Changes:
- Refactor algorithm sources (sha, base64, crc, xxtea, murmur_hash, crypto_*, compression) for consistent style, modern casts, anonymous namespaces, and
.data()accessors instead of&v[0]. - Fix several latent bugs: SHA-512 free/init/start using the wrong
sha384_context, missingcase EN_CIMT_LIBSODIUM_XCHACHA20:in cipher encrypt/decrypt switches, MurmurHash unaligned-load safety on strict-alignment platforms. - Add MurmurHash known-answer reference vector tests and aligned-vs-unaligned input equivalence tests; relax clang-tidy with
-misc-include-cleanerand-readability-use-concise-preprocessor-directives.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .clang-tidy | Disable misc-include-cleaner and readability-use-concise-preprocessor-directives checks. |
| include/algorithm/sha.h | Add noexcept to move ctor/assign and swap. |
| include/algorithm/compression.h | Drop unused <string> include. |
| src/algorithm/base64.cpp | Move helpers to anonymous namespace, modernize casts, add get_writable_string_data shim. |
| src/algorithm/compression.cpp | Wrap output.resize in exception-safe helper, reserve algorithm vector with try/catch. |
| src/algorithm/crc.cpp | Move tables to anonymous namespace, modern casts, drop legacy C headers. |
| src/algorithm/crypto_cipher.cpp | Convert enums to scoped, replace static counter with Meyers singleton, use .data(), fix missing XCHACHA20 case label. |
| src/algorithm/crypto_dh.cpp | Add tls_curve_info ctor for anonymous-namespace constexpr table, use .data(), modernize casts, std::move shared context. |
| src/algorithm/crypto_hmac.cpp | Anonymous namespace + ATFW_UTIL_SYMBOL_LOCAL, get_writable_string_data shim, return {} instead of explicit empty vectors. |
| src/algorithm/murmur_hash.cpp | Replace MSVC/non-MSVC fork with portable rotl + may-alias unaligned reads, restructure block iteration loops. |
| src/algorithm/sha.cpp | Rename inner→internal, anonymous namespace, fix SHA-512 context misuses, add noexcept to move/swap. |
| src/algorithm/xxtea.cpp | Anonymous namespace + symbol-local on helper templates, modern casts, std::abort. |
| test/case/murmur_hash_test.cpp | Add reference-vector and unaligned-input parity tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.