mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-03 17:56:12 -04:00
refactor(incompressible_categorizer): use internal::malloc_buffer
This commit is contained in:
parent
76106509d3
commit
19ff269602
@ -25,7 +25,6 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
@ -39,6 +38,8 @@
|
|||||||
#include <dwarfs/writer/categorizer.h>
|
#include <dwarfs/writer/categorizer.h>
|
||||||
#include <dwarfs/zstd_context_manager.h>
|
#include <dwarfs/zstd_context_manager.h>
|
||||||
|
|
||||||
|
#include <dwarfs/internal/malloc_buffer.h>
|
||||||
|
|
||||||
namespace dwarfs::writer {
|
namespace dwarfs::writer {
|
||||||
|
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
@ -125,10 +126,8 @@ class incompressible_categorizer_job_ : public sequential_categorizer_job {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void add_input(std::span<uint8_t const> data) {
|
void add_input(std::span<uint8_t const> data) {
|
||||||
auto current_size = input_.size();
|
assert(input_.size() + data.size() <= cfg_.block_size);
|
||||||
assert(current_size + data.size() <= cfg_.block_size);
|
input_.append(data.data(), data.size());
|
||||||
input_.resize(current_size + data.size());
|
|
||||||
::memcpy(&input_[current_size], data.data(), data.size());
|
|
||||||
if (input_.size() == cfg_.block_size) {
|
if (input_.size() == cfg_.block_size) {
|
||||||
compress();
|
compress();
|
||||||
}
|
}
|
||||||
@ -187,8 +186,8 @@ class incompressible_categorizer_job_ : public sequential_categorizer_job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG_PROXY_DECL(LoggerPolicy);
|
LOG_PROXY_DECL(LoggerPolicy);
|
||||||
std::vector<uint8_t> input_;
|
dwarfs::internal::malloc_buffer input_;
|
||||||
std::vector<uint8_t> output_;
|
dwarfs::internal::malloc_buffer output_;
|
||||||
size_t total_input_size_{0};
|
size_t total_input_size_{0};
|
||||||
size_t total_output_size_{0};
|
size_t total_output_size_{0};
|
||||||
size_t total_blocks_{0};
|
size_t total_blocks_{0};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user