mirror of
https://github.com/ceph/ceph
synced 2024-12-27 14:03:25 +00:00
Merge pull request #59116 from rzarzynski/wip-constbl-compressor
compressor: switch out of get_current_ptr() for the sake of const-stricter bufferlist Reviewed-by: Bill Scales <bill_scales@uk.ibm.com> Reviewed-by: Igor Fedotov <ifedotov@suse.com>
This commit is contained in:
commit
e933897f22
@ -121,16 +121,12 @@ int LZ4Compressor::decompress(ceph::buffer::list::const_iterator &p,
|
||||
LZ4_streamDecode_t lz4_stream_decode;
|
||||
LZ4_setStreamDecode(&lz4_stream_decode, nullptr, 0);
|
||||
|
||||
ceph::buffer::ptr cur_ptr = p.get_current_ptr();
|
||||
ceph::buffer::ptr *ptr = &cur_ptr;
|
||||
std::optional<ceph::buffer::ptr> data_holder;
|
||||
if (compressed_len != cur_ptr.length()) {
|
||||
data_holder.emplace(compressed_len);
|
||||
p.copy_deep(compressed_len, *data_holder);
|
||||
ptr = &*data_holder;
|
||||
}
|
||||
|
||||
char *c_in = ptr->c_str();
|
||||
ceph::buffer::list indata;
|
||||
// this does a shallow copy
|
||||
p.copy(compressed_len, indata);
|
||||
// if the input isn't fragmented, c_str() costs almost nothing.
|
||||
// otherwise rectifying copy will be taken
|
||||
const char* c_in = indata.c_str();
|
||||
char *c_out = dstptr.c_str();
|
||||
for (unsigned i = 0; i < count; ++i) {
|
||||
int r = LZ4_decompress_safe_continue(
|
||||
|
Loading…
Reference in New Issue
Block a user