diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2024-06-06 11:57:34 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2024-06-06 12:16:43 +0300 |
commit | d5b96872cfaceb0505854152a207bd2955934ebc (patch) | |
tree | 51c0d0049d3a7b8929171556fcb207a91dfa0616 | |
parent | 9485d328ded6636362fd0a58ff0bd80ea5d4b5f3 (diff) | |
download | ydb-d5b96872cfaceb0505854152a207bd2955934ebc.tar.gz |
Update contrib/libs/snappy to 1.2.1
e500fcea53f4cdede78b5b5ad54f32cc23a3d32b
-rw-r--r-- | contrib/libs/snappy/snappy-stubs-public.h | 4 | ||||
-rw-r--r-- | contrib/libs/snappy/snappy.cc | 32 | ||||
-rw-r--r-- | contrib/libs/snappy/snappy.h | 24 | ||||
-rw-r--r-- | contrib/libs/snappy/ya.make | 4 |
4 files changed, 50 insertions, 14 deletions
diff --git a/contrib/libs/snappy/snappy-stubs-public.h b/contrib/libs/snappy/snappy-stubs-public.h index 13a00c67dd..bc2a26a56c 100644 --- a/contrib/libs/snappy/snappy-stubs-public.h +++ b/contrib/libs/snappy/snappy-stubs-public.h @@ -43,8 +43,8 @@ #endif // HAVE_SYS_UIO_H #define SNAPPY_MAJOR 1 -#define SNAPPY_MINOR 1 -#define SNAPPY_PATCHLEVEL 10 +#define SNAPPY_MINOR 2 +#define SNAPPY_PATCHLEVEL 1 #define SNAPPY_VERSION \ ((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL) diff --git a/contrib/libs/snappy/snappy.cc b/contrib/libs/snappy/snappy.cc index 0aaedbfd52..a7b93f0f78 100644 --- a/contrib/libs/snappy/snappy.cc +++ b/contrib/libs/snappy/snappy.cc @@ -1793,6 +1793,10 @@ bool GetUncompressedLength(Source* source, uint32_t* result) { return decompressor.ReadUncompressedLength(result); } +size_t Compress(Source* reader, Sink* writer) { + return Compress(reader, writer, CompressionOptions{}); +} + size_t Compress(Source* reader, Sink* writer, CompressionOptions options) { assert(options.level == 1 || options.level == 2); int token = 0; @@ -2314,6 +2318,12 @@ bool IsValidCompressed(Source* compressed) { } void RawCompress(const char* input, size_t input_length, char* compressed, + size_t* compressed_length) { + RawCompress(input, input_length, compressed, compressed_length, + CompressionOptions{}); +} + +void RawCompress(const char* input, size_t input_length, char* compressed, size_t* compressed_length, CompressionOptions options) { ByteArraySource reader(input, input_length); UncheckedByteArraySink writer(compressed); @@ -2324,6 +2334,12 @@ void RawCompress(const char* input, size_t input_length, char* compressed, } void RawCompressFromIOVec(const struct iovec* iov, size_t uncompressed_length, + char* compressed, size_t* compressed_length) { + RawCompressFromIOVec(iov, uncompressed_length, compressed, compressed_length, + CompressionOptions{}); +} + +void RawCompressFromIOVec(const struct iovec* iov, size_t uncompressed_length, char* compressed, size_t* compressed_length, CompressionOptions options) { SnappyIOVecReader reader(iov, uncompressed_length); @@ -2334,6 +2350,11 @@ void RawCompressFromIOVec(const struct iovec* iov, size_t uncompressed_length, *compressed_length = writer.CurrentDestination() - compressed; } +size_t Compress(const char* input, size_t input_length, + std::string* compressed) { + return Compress(input, input_length, compressed, CompressionOptions{}); +} + size_t Compress(const char* input, size_t input_length, std::string* compressed, CompressionOptions options) { // Pre-grow the buffer to the max length of the compressed output @@ -2347,6 +2368,11 @@ size_t Compress(const char* input, size_t input_length, std::string* compressed, } size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt, + std::string* compressed) { + return CompressFromIOVec(iov, iov_cnt, compressed, CompressionOptions{}); +} + +size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt, std::string* compressed, CompressionOptions options) { // Compute the number of bytes to be compressed. size_t uncompressed_length = 0; @@ -2365,14 +2391,12 @@ size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt, return compressed_length; } -size_t Compress(const char* input, size_t input_length, - TString* compressed, CompressionOptions options) { +size_t Compress(const char* input, size_t input_length, TString* compressed) { // Pre-grow the buffer to the max length of the compressed output compressed->ReserveAndResize(MaxCompressedLength(input_length)); size_t compressed_length; - RawCompress(input, input_length, compressed->begin(), - &compressed_length, options); + RawCompress(input, input_length, compressed->begin(), &compressed_length); compressed->resize(compressed_length); return compressed_length; } diff --git a/contrib/libs/snappy/snappy.h b/contrib/libs/snappy/snappy.h index 0ad7bd6b9b..7dffe0d12c 100644 --- a/contrib/libs/snappy/snappy.h +++ b/contrib/libs/snappy/snappy.h @@ -79,8 +79,10 @@ namespace snappy { // Compress the bytes read from "*reader" and append to "*writer". Return the // number of bytes written. + // First version is to preserve ABI. + size_t Compress(Source* reader, Sink* writer); size_t Compress(Source* reader, Sink* writer, - CompressionOptions options = {}); + CompressionOptions options); // Find the uncompressed length of the given stream, as given by the header. // Note that the true length could deviate from this; the stream could e.g. @@ -99,18 +101,24 @@ namespace snappy { // Original contents of *compressed are lost. // // REQUIRES: "input[]" is not an alias of "*compressed". + // First version is to preserve ABI. size_t Compress(const char* input, size_t input_length, - std::string* compressed, CompressionOptions options = {}); + std::string* compressed); size_t Compress(const char* input, size_t input_length, - TString* compressed, CompressionOptions options = {}); + TString* compressed); + size_t Compress(const char* input, size_t input_length, + std::string* compressed, CompressionOptions options); // Same as `Compress` above but taking an `iovec` array as input. Note that // this function preprocesses the inputs to compute the sum of // `iov[0..iov_cnt-1].iov_len` before reading. To avoid this, use // `RawCompressFromIOVec` below. + // First version is to preserve ABI. + size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt, + std::string* compressed); size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt, std::string* compressed, - CompressionOptions options = {}); + CompressionOptions options); // Decompresses "compressed[0..compressed_length-1]" to "*uncompressed". // Original contents of "*uncompressed" are lost. @@ -156,14 +164,18 @@ namespace snappy { // ... Process(output, output_length) ... // delete [] output; void RawCompress(const char* input, size_t input_length, char* compressed, - size_t* compressed_length, CompressionOptions options = {}); + size_t* compressed_length); + void RawCompress(const char* input, size_t input_length, char* compressed, + size_t* compressed_length, CompressionOptions options); // Same as `RawCompress` above but taking an `iovec` array as input. Note that // `uncompressed_length` is the total number of bytes to be read from the // elements of `iov` (_not_ the number of elements in `iov`). void RawCompressFromIOVec(const struct iovec* iov, size_t uncompressed_length, + char* compressed, size_t* compressed_length); + void RawCompressFromIOVec(const struct iovec* iov, size_t uncompressed_length, char* compressed, size_t* compressed_length, - CompressionOptions options = {}); + CompressionOptions options); // Given data in "compressed[0..compressed_length-1]" generated by // calling the Snappy::Compress routine, this routine diff --git a/contrib/libs/snappy/ya.make b/contrib/libs/snappy/ya.make index a0e906cb66..f2bc4c7f1a 100644 --- a/contrib/libs/snappy/ya.make +++ b/contrib/libs/snappy/ya.make @@ -6,9 +6,9 @@ LICENSE(BSD-3-Clause) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(1.2.0) +VERSION(1.2.1) -ORIGINAL_SOURCE(https://github.com/google/snappy/archive/1.2.0.tar.gz) +ORIGINAL_SOURCE(https://github.com/google/snappy/archive/1.2.1.tar.gz) PEERDIR( library/cpp/sanitizer/include |