Internal changes

PiperOrigin-RevId: 597991348
This commit is contained in:
Snappy Team 2024-01-13 00:33:31 +00:00 committed by Danila Kutenin
parent 54d07d53a2
commit f0b0c9b8ce
1 changed files with 4 additions and 5 deletions

View File

@ -74,6 +74,7 @@
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <memory>
#include <string>
#include <utility>
#include <vector>
@ -1655,14 +1656,13 @@ size_t Compress(Source* reader, Sink* writer) {
uint16_t* table = wmem.GetHashTable(num_to_read, &table_size);
// Compress input_fragment and append to dest
const int max_output = MaxCompressedLength(num_to_read);
// Need a scratch buffer for the output, in case the byte sink doesn't
// have room for us directly.
int max_output = MaxCompressedLength(num_to_read);
// Since we encode kBlockSize regions followed by a region
// which is <= kBlockSize in length, a previously allocated
// scratch_output[] region is big enough for this iteration.
// Need a scratch buffer for the output, in case the byte sink doesn't
// have room for us directly.
char* dest = writer->GetAppendBuffer(max_output, wmem.GetScratchOutput());
char* end = internal::CompressFragment(fragment, fragment_size, dest, table,
table_size);
@ -1674,7 +1674,6 @@ size_t Compress(Source* reader, Sink* writer) {
}
Report(token, "snappy_compress", written, uncompressed_size);
return written;
}