Small fix

This commit is contained in:
Nikolay Degterinsky 2021-08-25 15:35:53 +03:00
parent f722132f23
commit 99a26b3a9a

View File

@ -68,7 +68,6 @@ void Lz4DeflatingWriteBuffer::nextImpl()
out_capacity = out->buffer().end() - out->position(); out_capacity = out->buffer().end() - out->position();
/// write frame header and check for errors /// write frame header and check for errors
size_t header_size = LZ4F_compressBegin(ctx, out_data, out_capacity, &kPrefs); size_t header_size = LZ4F_compressBegin(ctx, out_data, out_capacity, &kPrefs);
if (LZ4F_isError(header_size)) if (LZ4F_isError(header_size))
@ -145,12 +144,14 @@ void Lz4DeflatingWriteBuffer::finishImpl()
{ {
next(); next();
out_data = reinterpret_cast<void *>(out->position()); if (out_capacity < LZ4F_compressBound(0, &kPrefs))
out_capacity = out->buffer().end() - out->position(); {
out->next();
out_capacity = out->buffer().end() - out->position();
}
out_data = reinterpret_cast<void *>(out->position());
// LOG_FATAL(&Poco::Logger::root(), "Already leaving?");
// if (out_capacity < LZ4F_compressBound(0, &kPrefs))
// LOG_FATAL(&Poco::Logger::root(), "Ebal konya?");
/// compression end /// compression end
size_t end_size = LZ4F_compressEnd(ctx, out_data, out_capacity, nullptr); size_t end_size = LZ4F_compressEnd(ctx, out_data, out_capacity, nullptr);