aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/snappy/snappy.h
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.ru>2022-02-10 16:45:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:08 +0300
commit4e839db24a3bbc9f1c610c43d6faaaa99824dcca (patch)
tree506dac10f5df94fab310584ee51b24fc5a081c22 /contrib/libs/snappy/snappy.h
parent2d37894b1b037cf24231090eda8589bbb44fb6fc (diff)
downloadydb-4e839db24a3bbc9f1c610c43d6faaaa99824dcca.tar.gz
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/snappy/snappy.h')
-rw-r--r--contrib/libs/snappy/snappy.h164
1 files changed, 82 insertions, 82 deletions
diff --git a/contrib/libs/snappy/snappy.h b/contrib/libs/snappy/snappy.h
index 9a3bc3fa64..f8eaa1c60d 100644
--- a/contrib/libs/snappy/snappy.h
+++ b/contrib/libs/snappy/snappy.h
@@ -36,14 +36,14 @@
// using BMDiff and then compressing the output of BMDiff with
// Snappy.
-#ifndef THIRD_PARTY_SNAPPY_SNAPPY_H__
-#define THIRD_PARTY_SNAPPY_SNAPPY_H__
+#ifndef THIRD_PARTY_SNAPPY_SNAPPY_H__
+#define THIRD_PARTY_SNAPPY_SNAPPY_H__
-#include <cstddef>
-#include <string>
-
-#include <util/generic/fwd.h>
+#include <cstddef>
+#include <string>
+#include <util/generic/fwd.h>
+
#include "snappy-stubs-public.h"
namespace snappy {
@@ -58,27 +58,27 @@ namespace snappy {
// number of bytes written.
size_t Compress(Source* source, Sink* sink);
- // 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.
- // be truncated.
- //
- // Also note that this leaves "*source" in a state that is unsuitable for
- // further operations, such as RawUncompress(). You will need to rewind
- // or recreate the source yourself before attempting any further calls.
+ // 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.
+ // be truncated.
+ //
+ // Also note that this leaves "*source" in a state that is unsuitable for
+ // further operations, such as RawUncompress(). You will need to rewind
+ // or recreate the source yourself before attempting any further calls.
bool GetUncompressedLength(Source* source, uint32* result);
// ------------------------------------------------------------------------
// Higher-level string based routines (should be sufficient for most users)
// ------------------------------------------------------------------------
- // Sets "*compressed" to the compressed version of "input[0,input_length-1]".
- // Original contents of *compressed are lost.
+ // Sets "*compressed" to the compressed version of "input[0,input_length-1]".
+ // Original contents of *compressed are lost.
//
- // REQUIRES: "input[]" is not an alias of "*compressed".
- size_t Compress(const char* input, size_t input_length,
- std::string* compressed);
- size_t Compress(const char* input, size_t input_length,
- TString* compressed);
+ // REQUIRES: "input[]" is not an alias of "*compressed".
+ size_t Compress(const char* input, size_t input_length,
+ std::string* compressed);
+ size_t Compress(const char* input, size_t input_length,
+ TString* compressed);
// Decompresses "compressed[0,compressed_length-1]" to "*uncompressed".
// Original contents of "*uncompressed" are lost.
@@ -87,23 +87,23 @@ namespace snappy {
//
// returns false if the message is corrupted and could not be decompressed
bool Uncompress(const char* compressed, size_t compressed_length,
- std::string* uncompressed);
- bool Uncompress(const char* compressed, size_t compressed_length,
- TString* uncompressed);
-
- // Decompresses "compressed" to "*uncompressed".
- //
- // returns false if the message is corrupted and could not be decompressed
- bool Uncompress(Source* compressed, Sink* uncompressed);
-
- // This routine uncompresses as much of the "compressed" as possible
- // into sink. It returns the number of valid bytes added to sink
- // (extra invalid bytes may have been added due to errors; the caller
- // should ignore those). The emitted data typically has length
- // GetUncompressedLength(), but may be shorter if an error is
- // encountered.
- size_t UncompressAsMuchAsPossible(Source* compressed, Sink* uncompressed);
-
+ std::string* uncompressed);
+ bool Uncompress(const char* compressed, size_t compressed_length,
+ TString* uncompressed);
+
+ // Decompresses "compressed" to "*uncompressed".
+ //
+ // returns false if the message is corrupted and could not be decompressed
+ bool Uncompress(Source* compressed, Sink* uncompressed);
+
+ // This routine uncompresses as much of the "compressed" as possible
+ // into sink. It returns the number of valid bytes added to sink
+ // (extra invalid bytes may have been added due to errors; the caller
+ // should ignore those). The emitted data typically has length
+ // GetUncompressedLength(), but may be shorter if an error is
+ // encountered.
+ size_t UncompressAsMuchAsPossible(Source* compressed, Sink* uncompressed);
+
// ------------------------------------------------------------------------
// Lower-level character array based routines. May be useful for
// efficiency reasons in certain circumstances.
@@ -143,28 +143,28 @@ namespace snappy {
// returns false if the message is corrupted and could not be decrypted
bool RawUncompress(Source* compressed, char* uncompressed);
- // Given data in "compressed[0..compressed_length-1]" generated by
- // calling the Snappy::Compress routine, this routine
- // stores the uncompressed data to the iovec "iov". The number of physical
- // buffers in "iov" is given by iov_cnt and their cumulative size
- // must be at least GetUncompressedLength(compressed). The individual buffers
- // in "iov" must not overlap with each other.
- //
- // returns false if the message is corrupted and could not be decrypted
- bool RawUncompressToIOVec(const char* compressed, size_t compressed_length,
- const struct iovec* iov, size_t iov_cnt);
-
- // Given data from the byte source 'compressed' generated by calling
- // the Snappy::Compress routine, this routine stores the uncompressed
- // data to the iovec "iov". The number of physical
- // buffers in "iov" is given by iov_cnt and their cumulative size
- // must be at least GetUncompressedLength(compressed). The individual buffers
- // in "iov" must not overlap with each other.
- //
- // returns false if the message is corrupted and could not be decrypted
- bool RawUncompressToIOVec(Source* compressed, const struct iovec* iov,
- size_t iov_cnt);
-
+ // Given data in "compressed[0..compressed_length-1]" generated by
+ // calling the Snappy::Compress routine, this routine
+ // stores the uncompressed data to the iovec "iov". The number of physical
+ // buffers in "iov" is given by iov_cnt and their cumulative size
+ // must be at least GetUncompressedLength(compressed). The individual buffers
+ // in "iov" must not overlap with each other.
+ //
+ // returns false if the message is corrupted and could not be decrypted
+ bool RawUncompressToIOVec(const char* compressed, size_t compressed_length,
+ const struct iovec* iov, size_t iov_cnt);
+
+ // Given data from the byte source 'compressed' generated by calling
+ // the Snappy::Compress routine, this routine stores the uncompressed
+ // data to the iovec "iov". The number of physical
+ // buffers in "iov" is given by iov_cnt and their cumulative size
+ // must be at least GetUncompressedLength(compressed). The individual buffers
+ // in "iov" must not overlap with each other.
+ //
+ // returns false if the message is corrupted and could not be decrypted
+ bool RawUncompressToIOVec(Source* compressed, const struct iovec* iov,
+ size_t iov_cnt);
+
// Returns the maximal size of the compressed representation of
// input data that is "source_bytes" bytes in length;
size_t MaxCompressedLength(size_t source_bytes);
@@ -183,31 +183,31 @@ namespace snappy {
bool IsValidCompressedBuffer(const char* compressed,
size_t compressed_length);
- // Returns true iff the contents of "compressed" can be uncompressed
- // successfully. Does not return the uncompressed data. Takes
- // time proportional to *compressed length, but is usually at least
- // a factor of four faster than actual decompression.
- // On success, consumes all of *compressed. On failure, consumes an
- // unspecified prefix of *compressed.
- bool IsValidCompressed(Source* compressed);
-
- // The size of a compression block. Note that many parts of the compression
- // code assumes that kBlockSize <= 65536; in particular, the hash table
- // can only store 16-bit offsets, and EmitCopy() also assumes the offset
- // is 65535 bytes or less. Note also that if you change this, it will
- // affect the framing format (see framing_format.txt).
+ // Returns true iff the contents of "compressed" can be uncompressed
+ // successfully. Does not return the uncompressed data. Takes
+ // time proportional to *compressed length, but is usually at least
+ // a factor of four faster than actual decompression.
+ // On success, consumes all of *compressed. On failure, consumes an
+ // unspecified prefix of *compressed.
+ bool IsValidCompressed(Source* compressed);
+
+ // The size of a compression block. Note that many parts of the compression
+ // code assumes that kBlockSize <= 65536; in particular, the hash table
+ // can only store 16-bit offsets, and EmitCopy() also assumes the offset
+ // is 65535 bytes or less. Note also that if you change this, it will
+ // affect the framing format (see framing_format.txt).
//
- // Note that there might be older data around that is compressed with larger
- // block sizes, so the decompression code should not rely on the
- // non-existence of long backreferences.
- static constexpr int kBlockLog = 16;
- static constexpr size_t kBlockSize = 1 << kBlockLog;
+ // Note that there might be older data around that is compressed with larger
+ // block sizes, so the decompression code should not rely on the
+ // non-existence of long backreferences.
+ static constexpr int kBlockLog = 16;
+ static constexpr size_t kBlockSize = 1 << kBlockLog;
- static constexpr int kMinHashTableBits = 8;
- static constexpr size_t kMinHashTableSize = 1 << kMinHashTableBits;
+ static constexpr int kMinHashTableBits = 8;
+ static constexpr size_t kMinHashTableSize = 1 << kMinHashTableBits;
- static constexpr int kMaxHashTableBits = 14;
- static constexpr size_t kMaxHashTableSize = 1 << kMaxHashTableBits;
+ static constexpr int kMaxHashTableBits = 14;
+ static constexpr size_t kMaxHashTableSize = 1 << kMaxHashTableBits;
} // end namespace snappy
-#endif // THIRD_PARTY_SNAPPY_SNAPPY_H__
+#endif // THIRD_PARTY_SNAPPY_SNAPPY_H__