From 40e24d12f581c2f20743e277fd18cd09a4cfc747 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 30 Jan 2026 09:47:03 +0100 Subject: [PATCH 01/12] remove file mapping member in order to free file handles earlier --- keyvi/include/keyvi/dictionary/fsa/automata.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/automata.h b/keyvi/include/keyvi/dictionary/fsa/automata.h index 12feca7cd..dfe8afd48 100644 --- a/keyvi/include/keyvi/dictionary/fsa/automata.h +++ b/keyvi/include/keyvi/dictionary/fsa/automata.h @@ -91,20 +91,20 @@ class Automata final { explicit Automata(const dictionary_properties_t& dictionary_properties, loading_strategy_types loading_strategy, const bool load_value_store) : dictionary_properties_(dictionary_properties) { - file_mapping_ = boost::interprocess::file_mapping(dictionary_properties_->GetFileName().c_str(), - boost::interprocess::read_only); + boost::interprocess::file_mapping file_mapping = boost::interprocess::file_mapping( + dictionary_properties_->GetFileName().c_str(), boost::interprocess::read_only); const boost::interprocess::map_options_t map_options = internal::MemoryMapFlags::FSAGetMemoryMapOptions(loading_strategy); TRACE("labels start offset: %d", dictionary_properties_->GetPersistenceOffset()); - labels_region_ = boost::interprocess::mapped_region(file_mapping_, boost::interprocess::read_only, + labels_region_ = boost::interprocess::mapped_region(file_mapping, boost::interprocess::read_only, dictionary_properties_->GetPersistenceOffset(), dictionary_properties_->GetSparseArraySize(), 0, map_options); TRACE("transitions start offset: %d", dictionary_properties_->GetTransitionsOffset()); transitions_region_ = boost::interprocess::mapped_region( - file_mapping_, boost::interprocess::read_only, dictionary_properties_->GetTransitionsOffset(), + file_mapping, boost::interprocess::read_only, dictionary_properties_->GetTransitionsOffset(), dictionary_properties_->GetTransitionsSize(), 0, map_options); const auto advise = internal::MemoryMapFlags::FSAGetMemoryMapAdvices(loading_strategy); @@ -117,7 +117,7 @@ class Automata final { if (load_value_store) { value_store_reader_.reset( - internal::ValueStoreFactory::MakeReader(dictionary_properties_->GetValueStoreType(), &file_mapping_, + internal::ValueStoreFactory::MakeReader(dictionary_properties_->GetValueStoreType(), &file_mapping, dictionary_properties_->GetValueStoreProperties(), loading_strategy)); } } @@ -415,7 +415,6 @@ class Automata final { private: dictionary_properties_t dictionary_properties_; std::unique_ptr value_store_reader_; - boost::interprocess::file_mapping file_mapping_; boost::interprocess::mapped_region labels_region_; boost::interprocess::mapped_region transitions_region_; unsigned char* labels_; From 9b05d2a1ead3ff24af01c47ea6d0c37fac29ff8f Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 30 Jan 2026 10:26:19 +0100 Subject: [PATCH 02/12] fix clang tidy warning --- keyvi/include/keyvi/dictionary/fsa/automata.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/automata.h b/keyvi/include/keyvi/dictionary/fsa/automata.h index dfe8afd48..c17b540c8 100644 --- a/keyvi/include/keyvi/dictionary/fsa/automata.h +++ b/keyvi/include/keyvi/dictionary/fsa/automata.h @@ -98,13 +98,15 @@ class Automata final { internal::MemoryMapFlags::FSAGetMemoryMapOptions(loading_strategy); TRACE("labels start offset: %d", dictionary_properties_->GetPersistenceOffset()); - labels_region_ = boost::interprocess::mapped_region(file_mapping, boost::interprocess::read_only, - dictionary_properties_->GetPersistenceOffset(), - dictionary_properties_->GetSparseArraySize(), 0, map_options); + labels_region_ = boost::interprocess::mapped_region( + file_mapping, boost::interprocess::read_only, + static_cast(dictionary_properties_->GetPersistenceOffset()), + dictionary_properties_->GetSparseArraySize(), 0, map_options); TRACE("transitions start offset: %d", dictionary_properties_->GetTransitionsOffset()); transitions_region_ = boost::interprocess::mapped_region( - file_mapping, boost::interprocess::read_only, dictionary_properties_->GetTransitionsOffset(), + file_mapping, boost::interprocess::read_only, + static_cast(dictionary_properties_->GetTransitionsOffset()), dictionary_properties_->GetTransitionsSize(), 0, map_options); const auto advise = internal::MemoryMapFlags::FSAGetMemoryMapAdvices(loading_strategy); From 16fe92af16f8fc281a78c3cb6f0c3f620d966616 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 30 Jan 2026 10:35:53 +0100 Subject: [PATCH 03/12] ignore private headers from boost in clang-tidy --- keyvi/.clang-tidy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/keyvi/.clang-tidy b/keyvi/.clang-tidy index 994895618..68688bdf2 100644 --- a/keyvi/.clang-tidy +++ b/keyvi/.clang-tidy @@ -16,3 +16,11 @@ Checks: "*, " HeaderFilterRegex: '' FormatStyle: none +CheckOptions: + - key: misc-include-cleaner.IgnoreHeaders + # The following files are ignored when clang-tidy analyzes header + # inclusions: + # - boost detail + value: ' + boost/.*/detail/.*\.hpp; + ' From f29f8b87b8785cf4c57c135408456a7cabbe4ac9 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 30 Jan 2026 10:36:08 +0100 Subject: [PATCH 04/12] fix nullptr --- keyvi/include/keyvi/dictionary/fsa/automata.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/automata.h b/keyvi/include/keyvi/dictionary/fsa/automata.h index c17b540c8..e85a7df76 100644 --- a/keyvi/include/keyvi/dictionary/fsa/automata.h +++ b/keyvi/include/keyvi/dictionary/fsa/automata.h @@ -101,13 +101,13 @@ class Automata final { labels_region_ = boost::interprocess::mapped_region( file_mapping, boost::interprocess::read_only, static_cast(dictionary_properties_->GetPersistenceOffset()), - dictionary_properties_->GetSparseArraySize(), 0, map_options); + dictionary_properties_->GetSparseArraySize(), nullptr, map_options); TRACE("transitions start offset: %d", dictionary_properties_->GetTransitionsOffset()); transitions_region_ = boost::interprocess::mapped_region( file_mapping, boost::interprocess::read_only, static_cast(dictionary_properties_->GetTransitionsOffset()), - dictionary_properties_->GetTransitionsSize(), 0, map_options); + dictionary_properties_->GetTransitionsSize(), nullptr, map_options); const auto advise = internal::MemoryMapFlags::FSAGetMemoryMapAdvices(loading_strategy); From fba66fbbea1571cbfd6b6b6de59b3e5fb2791643 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Sun, 1 Feb 2026 22:33:40 +0100 Subject: [PATCH 05/12] simplify memory map manager --- .../fsa/internal/memory_map_manager.h | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h index 4cff025e9..11686ef6f 100644 --- a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h +++ b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h @@ -61,10 +61,6 @@ class MemoryMapManager final { : chunk_size_(chunk_size), directory_(directory), filename_pattern_(filename_pattern) {} ~MemoryMapManager() { - for (auto& m : mappings_) { - delete m.mapping_; - delete m.region_; - } } /* Using GetAdress to read multiple bytes is unsafe as it might be a buffer overflow @@ -195,7 +191,7 @@ class MemoryMapManager final { size_t bytes_in_chunk = std::min(chunk_size_, remaining); TRACE("write chunk %d, with size: %ld, remaining: %ld", chunk, bytes_in_chunk, remaining); - const char* ptr = reinterpret_cast(mappings_[chunk].region_->get_address()); + const char* ptr = reinterpret_cast(mappings_[chunk].get_address()); stream.write(ptr, bytes_in_chunk); remaining -= bytes_in_chunk; @@ -212,9 +208,7 @@ class MemoryMapManager final { void Persist() { persisted_ = true; for (auto& m : mappings_) { - m.region_->flush(); - delete m.region_; - delete m.mapping_; + m.flush(); } // truncate last file according to the written buffers @@ -236,13 +230,8 @@ class MemoryMapManager final { size_t GetNumberOfChunks() const { return number_of_chunks_; } private: - struct mapping { - boost::interprocess::file_mapping* mapping_; - boost::interprocess::mapped_region* region_; - }; - size_t chunk_size_; - std::vector mappings_; + std::vector mappings_; boost::filesystem::path directory_; boost::filesystem::path filename_pattern_; size_t tail_ = 0; @@ -262,13 +251,11 @@ class MemoryMapManager final { CreateMapping(); } - return mappings_[chunk_number].region_->get_address(); + return mappings_[chunk_number].get_address(); } void CreateMapping() { TRACE("create new mapping %d", number_of_chunks_ + 1); - mapping new_mapping; - boost::filesystem::path filename = GetFilenameForChunk(number_of_chunks_); std::ofstream chunk(filename.string().c_str(), @@ -287,16 +274,14 @@ class MemoryMapManager final { throw memory_map_manager_exception("failed to create chunk (setting size)"); } - new_mapping.mapping_ = - new boost::interprocess::file_mapping(filename.string().c_str(), boost::interprocess::read_write); + boost::interprocess::file_mapping mapping(filename.string().c_str(), boost::interprocess::read_write); - new_mapping.region_ = - new boost::interprocess::mapped_region(*new_mapping.mapping_, boost::interprocess::read_write); + boost::interprocess::mapped_region mapped_region(boost::interprocess::mapped_region(mapping, boost::interprocess::read_write)); // prevent pre-fetching pages by the OS which does not make sense as values usually fit into few pages - new_mapping.region_->advise(boost::interprocess::mapped_region::advice_types::advice_random); + mapped_region.advise(boost::interprocess::mapped_region::advice_types::advice_random); - mappings_.push_back(new_mapping); + mappings_.push_back(std::move(mapped_region)); ++number_of_chunks_; } }; From 6a0c773c8fa317324d4fd89119bf2ae905809b7b Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Sun, 1 Feb 2026 22:36:13 +0100 Subject: [PATCH 06/12] clang-format --- .../keyvi/dictionary/fsa/internal/memory_map_manager.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h index 11686ef6f..81a64599a 100644 --- a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h +++ b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h @@ -60,8 +60,7 @@ class MemoryMapManager final { const boost::filesystem::path filename_pattern) : chunk_size_(chunk_size), directory_(directory), filename_pattern_(filename_pattern) {} - ~MemoryMapManager() { - } + ~MemoryMapManager() {} /* Using GetAdress to read multiple bytes is unsafe as it might be a buffer overflow * @@ -276,7 +275,8 @@ class MemoryMapManager final { boost::interprocess::file_mapping mapping(filename.string().c_str(), boost::interprocess::read_write); - boost::interprocess::mapped_region mapped_region(boost::interprocess::mapped_region(mapping, boost::interprocess::read_write)); + boost::interprocess::mapped_region mapped_region( + boost::interprocess::mapped_region(mapping, boost::interprocess::read_write)); // prevent pre-fetching pages by the OS which does not make sense as values usually fit into few pages mapped_region.advise(boost::interprocess::mapped_region::advice_types::advice_random); From c8d8dbaf76d7eeebce6bfeeb692d2f886df6dff2 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Sun, 1 Feb 2026 22:38:09 +0100 Subject: [PATCH 07/12] fix include --- keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h index 81a64599a..792e976a5 100644 --- a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h +++ b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include From fd3e92da9fe4929000208e2b7225e203c0ab26d4 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Sun, 1 Feb 2026 22:43:15 +0100 Subject: [PATCH 08/12] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../keyvi/dictionary/fsa/internal/memory_map_manager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h index 792e976a5..a694cacec 100644 --- a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h +++ b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h @@ -60,7 +60,7 @@ class MemoryMapManager final { MemoryMapManager(const size_t chunk_size, const boost::filesystem::path directory, const boost::filesystem::path filename_pattern) : chunk_size_(chunk_size), directory_(directory), filename_pattern_(filename_pattern) {} - + ~MemoryMapManager() = default; ~MemoryMapManager() {} /* Using GetAdress to read multiple bytes is unsafe as it might be a buffer overflow @@ -274,7 +274,7 @@ class MemoryMapManager final { throw memory_map_manager_exception("failed to create chunk (setting size)"); } - boost::interprocess::file_mapping mapping(filename.string().c_str(), boost::interprocess::read_write); + boost::interprocess::file_mapping const mapping(filename.string().c_str(), boost::interprocess::read_write); boost::interprocess::mapped_region mapped_region( boost::interprocess::mapped_region(mapping, boost::interprocess::read_write)); From b9bcbe8f4438437c80adffadefe49d7e1e248001 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Sun, 1 Feb 2026 22:55:04 +0100 Subject: [PATCH 09/12] fix casts --- .../fsa/internal/memory_map_manager.h | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h index a694cacec..385faebc0 100644 --- a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h +++ b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h @@ -61,7 +61,6 @@ class MemoryMapManager final { const boost::filesystem::path filename_pattern) : chunk_size_(chunk_size), directory_(directory), filename_pattern_(filename_pattern) {} ~MemoryMapManager() = default; - ~MemoryMapManager() {} /* Using GetAdress to read multiple bytes is unsafe as it might be a buffer overflow * @@ -78,7 +77,7 @@ class MemoryMapManager final { void* chunk_address = GetChunk(chunk_number); - return (reinterpret_cast(chunk_address) + chunk_offset); + return static_cast(chunk_address) + chunk_offset; } /* Get a buffer as copy. @@ -93,12 +92,12 @@ class MemoryMapManager final { size_t second_chunk_size = buffer_length - first_chunk_size; void* chunk_address = GetChunk(chunk_number); - std::memcpy(buffer, reinterpret_cast(chunk_address) + chunk_offset, first_chunk_size); + std::memcpy(buffer, static_cast(chunk_address) + chunk_offset, first_chunk_size); if (second_chunk_size > 0) { void* chunk_address_part2 = GetChunk(chunk_number + 1); - std::memcpy(reinterpret_cast(buffer) + first_chunk_size, - reinterpret_cast(chunk_address_part2), second_chunk_size); + std::memcpy(static_cast(buffer) + first_chunk_size, static_cast(chunk_address_part2), + second_chunk_size); } } @@ -125,8 +124,8 @@ class MemoryMapManager final { size_t copy_size = std::min(remaining, chunk_size_ - chunk_offset); TRACE("copy size: %ld", copy_size); - std::memcpy(reinterpret_cast(chunk_address) + chunk_offset, - reinterpret_cast(buffer) + buffer_offset, copy_size); + std::memcpy(static_cast(chunk_address) + chunk_offset, static_cast(buffer) + buffer_offset, + copy_size); remaining -= copy_size; tail_ += copy_size; @@ -150,7 +149,7 @@ class MemoryMapManager final { void* chunk_address = GetChunk(chunk_number); size_t first_chunk_size = std::min(buffer_length, chunk_size_ - chunk_offset); - if (std::memcmp(reinterpret_cast(chunk_address) + chunk_offset, buffer, first_chunk_size) != 0) { + if (std::memcmp(static_cast(chunk_address) + chunk_offset, buffer, first_chunk_size) != 0) { return false; } @@ -161,9 +160,8 @@ class MemoryMapManager final { // handle overflow void* chunk_address_part2 = GetChunk(chunk_number + 1); - return (std::memcmp(reinterpret_cast(chunk_address_part2), - reinterpret_cast(buffer) + first_chunk_size, - buffer_length - first_chunk_size) == 0); + return (std::memcmp(static_cast(chunk_address_part2), + static_cast(buffer) + first_chunk_size, buffer_length - first_chunk_size) == 0); } void Write(std::ostream& stream, const size_t end) const { @@ -191,7 +189,7 @@ class MemoryMapManager final { size_t bytes_in_chunk = std::min(chunk_size_, remaining); TRACE("write chunk %d, with size: %ld, remaining: %ld", chunk, bytes_in_chunk, remaining); - const char* ptr = reinterpret_cast(mappings_[chunk].get_address()); + const char* ptr = static_cast(mappings_[chunk].get_address()); stream.write(ptr, bytes_in_chunk); remaining -= bytes_in_chunk; From 20390be5c7fe6564ead1bb663212b41a2870df7f Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Sun, 1 Feb 2026 23:12:12 +0100 Subject: [PATCH 10/12] fix include and add NOLINT's --- .../keyvi/dictionary/fsa/internal/memory_map_manager.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h index 385faebc0..d51ae0cdb 100644 --- a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h +++ b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h @@ -26,6 +26,7 @@ #define KEYVI_DICTIONARY_FSA_INTERNAL_MEMORY_MAP_MANAGER_H_ #include +#include #include #include #include @@ -77,7 +78,7 @@ class MemoryMapManager final { void* chunk_address = GetChunk(chunk_number); - return static_cast(chunk_address) + chunk_offset; + return static_cast(chunk_address) + chunk_offset; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } /* Get a buffer as copy. @@ -92,12 +93,13 @@ class MemoryMapManager final { size_t second_chunk_size = buffer_length - first_chunk_size; void* chunk_address = GetChunk(chunk_number); - std::memcpy(buffer, static_cast(chunk_address) + chunk_offset, first_chunk_size); + std::memcpy(buffer, static_cast(chunk_address) + chunk_offset, + first_chunk_size); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) if (second_chunk_size > 0) { void* chunk_address_part2 = GetChunk(chunk_number + 1); std::memcpy(static_cast(buffer) + first_chunk_size, static_cast(chunk_address_part2), - second_chunk_size); + second_chunk_size); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } } @@ -125,7 +127,7 @@ class MemoryMapManager final { TRACE("copy size: %ld", copy_size); std::memcpy(static_cast(chunk_address) + chunk_offset, static_cast(buffer) + buffer_offset, - copy_size); + copy_size); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) remaining -= copy_size; tail_ += copy_size; From 5c2795bbef433b0af07b192544196546a46bd982 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Sun, 1 Feb 2026 23:23:36 +0100 Subject: [PATCH 11/12] fix some NOLINT's --- .../dictionary/fsa/internal/memory_map_manager.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h index d51ae0cdb..20cfd0e51 100644 --- a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h +++ b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h @@ -93,13 +93,15 @@ class MemoryMapManager final { size_t second_chunk_size = buffer_length - first_chunk_size; void* chunk_address = GetChunk(chunk_number); - std::memcpy(buffer, static_cast(chunk_address) + chunk_offset, - first_chunk_size); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + std::memcpy(buffer, static_cast(chunk_address) + chunk_offset, first_chunk_size); if (second_chunk_size > 0) { void* chunk_address_part2 = GetChunk(chunk_number + 1); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) std::memcpy(static_cast(buffer) + first_chunk_size, static_cast(chunk_address_part2), - second_chunk_size); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + second_chunk_size); } } @@ -126,8 +128,9 @@ class MemoryMapManager final { size_t copy_size = std::min(remaining, chunk_size_ - chunk_offset); TRACE("copy size: %ld", copy_size); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) std::memcpy(static_cast(chunk_address) + chunk_offset, static_cast(buffer) + buffer_offset, - copy_size); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + copy_size); remaining -= copy_size; tail_ += copy_size; @@ -151,6 +154,7 @@ class MemoryMapManager final { void* chunk_address = GetChunk(chunk_number); size_t first_chunk_size = std::min(buffer_length, chunk_size_ - chunk_offset); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) if (std::memcmp(static_cast(chunk_address) + chunk_offset, buffer, first_chunk_size) != 0) { return false; } @@ -162,6 +166,8 @@ class MemoryMapManager final { // handle overflow void* chunk_address_part2 = GetChunk(chunk_number + 1); + + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) return (std::memcmp(static_cast(chunk_address_part2), static_cast(buffer) + first_chunk_size, buffer_length - first_chunk_size) == 0); } From f6b960330fe124f4eecc04cbc22b9dfa17a2756e Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Mon, 2 Feb 2026 08:04:46 +0100 Subject: [PATCH 12/12] fix NOLINT --- .../keyvi/dictionary/fsa/internal/memory_map_manager.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h index 20cfd0e51..8e915608d 100644 --- a/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h +++ b/keyvi/include/keyvi/dictionary/fsa/internal/memory_map_manager.h @@ -78,7 +78,8 @@ class MemoryMapManager final { void* chunk_address = GetChunk(chunk_number); - return static_cast(chunk_address) + chunk_offset; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + return static_cast(chunk_address) + chunk_offset; } /* Get a buffer as copy. @@ -167,8 +168,8 @@ class MemoryMapManager final { // handle overflow void* chunk_address_part2 = GetChunk(chunk_number + 1); - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) return (std::memcmp(static_cast(chunk_address_part2), + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) static_cast(buffer) + first_chunk_size, buffer_length - first_chunk_size) == 0); }