From e1acf7b7864d81558e6d59e7db2a10d815ad31ac Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Fri, 24 Apr 2026 16:03:17 +0200 Subject: [PATCH] Fixed cppcheck error --- src/common.h | 2 +- tests/src/hash_tests.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common.h b/src/common.h index 699030f..4954a28 100644 --- a/src/common.h +++ b/src/common.h @@ -172,7 +172,7 @@ struct alignas(uint64_t) hash } } - constexpr hash(const char (&s)[HASH_SIZE * 2 + 1]) : h{} { + explicit constexpr hash(const char (&s)[HASH_SIZE * 2 + 1]) : h{} { for (size_t i = 0; i < HASH_SIZE * 2; ++i) { char c = s[i]; diff --git a/tests/src/hash_tests.cpp b/tests/src/hash_tests.cpp index b2d9e51..6079ee0 100644 --- a/tests/src/hash_tests.cpp +++ b/tests/src/hash_tests.cpp @@ -34,9 +34,9 @@ TEST(hash, constructor) h = {}; ASSERT_EQ(memcmp(h.h, buf, HASH_SIZE), 0); - h = { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" }; + hash h2{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" }; for (uint8_t i = 0; i < HASH_SIZE; ++i) { - ASSERT_EQ(h.h[i], i); + ASSERT_EQ(h2.h[i], i); } }