26
snappy.cc
26
snappy.cc
@@ -1792,6 +1792,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;
|
||||
@@ -2298,6 +2302,12 @@ bool IsValidCompressed(Source* compressed) {
|
||||
return InternalUncompress(compressed, &writer);
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -2308,6 +2318,12 @@ void RawCompress(const char* input, size_t input_length, char* compressed,
|
||||
*compressed_length = (writer.CurrentDestination() - 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) {
|
||||
@@ -2319,6 +2335,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
|
||||
@@ -2331,6 +2352,11 @@ size_t Compress(const char* input, size_t input_length, std::string* compressed,
|
||||
return compressed_length;
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user