aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/streams/lz/lz.cpp
diff options
context:
space:
mode:
authorRuslan Kovalev <ruslan.a.kovalev@gmail.com>2022-02-10 16:46:45 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:45 +0300
commit9123176b341b6f2658cff5132482b8237c1416c8 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/streams/lz/lz.cpp
parent59e19371de37995fcb36beb16cd6ec030af960bc (diff)
downloadydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/streams/lz/lz.cpp')
-rw-r--r--library/cpp/streams/lz/lz.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp
index 484fd3cf7c..b65bb3ed96 100644
--- a/library/cpp/streams/lz/lz.cpp
+++ b/library/cpp/streams/lz/lz.cpp
@@ -460,78 +460,78 @@ DEF_COMPRESSOR(TLzfCompress, TFastLZ)
DEF_DECOMPRESSOR(TLzfDecompress, TFastLZ)
/*
- * LZ4
- */
-class TLZ4 {
+ * LZ4
+ */
+class TLZ4 {
public:
static const char signature[];
-
+
static inline size_t Hint(size_t len) noexcept {
return Max<size_t>((size_t)(len * 1.06), 100);
}
-
+
inline size_t Compress(const char* data, size_t len, char* ptr, size_t dstMaxSize) {
return LZ4_compress_default(data, ptr, len, dstMaxSize);
}
-
+
inline size_t Decompress(const char* data, size_t len, char* ptr, size_t max) {
int res = LZ4_decompress_safe(data, ptr, len, max);
if (res < 0)
ythrow TDecompressorError();
return res;
}
-
+
inline void InitFromStream(IInputStream*) const noexcept {
}
-
+
static inline bool SaveIncompressibleChunks() noexcept {
return false;
}
-};
-
-const char TLZ4::signature[] = "LZ.4";
-
-DEF_COMPRESSOR(TLz4Compress, TLZ4)
-DEF_DECOMPRESSOR(TLz4Decompress, TLZ4)
-
-/*
- * Snappy
- */
-class TSnappy {
+};
+
+const char TLZ4::signature[] = "LZ.4";
+
+DEF_COMPRESSOR(TLz4Compress, TLZ4)
+DEF_DECOMPRESSOR(TLz4Decompress, TLZ4)
+
+/*
+ * Snappy
+ */
+class TSnappy {
public:
static const char signature[];
-
+
static inline size_t Hint(size_t len) noexcept {
return Max<size_t>(snappy::MaxCompressedLength(len), 100);
}
-
+
inline size_t Compress(const char* data, size_t len, char* ptr, size_t /*dstMaxSize*/) {
size_t reslen = 0;
snappy::RawCompress(data, len, ptr, &reslen);
return reslen;
}
-
+
inline size_t Decompress(const char* data, size_t len, char* ptr, size_t) {
size_t srclen = 0;
if (!snappy::GetUncompressedLength(data, len, &srclen) || !snappy::RawUncompress(data, len, ptr))
ythrow TDecompressorError();
return srclen;
}
-
+
inline void InitFromStream(IInputStream*) const noexcept {
}
-
+
static inline bool SaveIncompressibleChunks() noexcept {
return false;
}
-};
-
-const char TSnappy::signature[] = "Snap";
-
-DEF_COMPRESSOR(TSnappyCompress, TSnappy)
-DEF_DECOMPRESSOR(TSnappyDecompress, TSnappy)
-
-/*
+};
+
+const char TSnappy::signature[] = "Snap";
+
+DEF_COMPRESSOR(TSnappyCompress, TSnappy)
+DEF_DECOMPRESSOR(TSnappyDecompress, TSnappy)
+
+/*
* QuickLZ
*/
class TQuickLZBase {