From a83a32ff784b1993f20573e683f0fea3b7607462 Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Sat, 23 Nov 2024 16:50:20 +0100 Subject: [PATCH] refactor(block_manager): make `map_logical_blocks` const --- include/dwarfs/writer/internal/block_manager.h | 2 +- src/writer/internal/block_manager.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/dwarfs/writer/internal/block_manager.h b/include/dwarfs/writer/internal/block_manager.h index d6a62d6ab..e37fa94f0 100644 --- a/include/dwarfs/writer/internal/block_manager.h +++ b/include/dwarfs/writer/internal/block_manager.h @@ -37,7 +37,7 @@ class block_manager { size_t get_logical_block() const; void set_written_block(size_t logical_block, size_t written_block, fragment_category::value_type category); - void map_logical_blocks(std::vector& vec); + void map_logical_blocks(std::vector& vec) const; std::vector get_written_block_categories() const; diff --git a/src/writer/internal/block_manager.cpp b/src/writer/internal/block_manager.cpp index 3e48d3200..c275709e3 100644 --- a/src/writer/internal/block_manager.cpp +++ b/src/writer/internal/block_manager.cpp @@ -45,12 +45,12 @@ void block_manager::set_written_block(size_t logical_block, block_map_[logical_block] = std::make_pair(written_block, category); } -void block_manager::map_logical_blocks(std::vector& vec) { +void block_manager::map_logical_blocks(std::vector& vec) const { std::lock_guard lock{mx_}; for (auto& c : vec) { size_t block = c.get_block(); assert(block < num_blocks_); - c.block() = block_map_[block].value().first; + c.block() = block_map_.at(block).value().first; } }