diff --git a/db/db_bench.cc b/db/db_bench.cc index 8e5d07a59..d34dbb34b 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -45,6 +45,7 @@ int main() { #include "port/port.h" #include "port/stack_trace.h" #include "util/crc32c.h" +#include "util/compression.h" #include "util/histogram.h" #include "util/mutexlock.h" #include "util/random.h" @@ -1213,27 +1214,27 @@ class Benchmark { text[len] = '\0'; switch (FLAGS_compression_type_e) { case kSnappyCompression: - result = port::Snappy_Compress(Options().compression_opts, text, - strlen(text), &compressed); + result = Snappy_Compress(Options().compression_opts, text, + strlen(text), &compressed); name = "Snappy"; break; case kZlibCompression: - result = port::Zlib_Compress(Options().compression_opts, text, - strlen(text), &compressed); + result = Zlib_Compress(Options().compression_opts, text, strlen(text), + &compressed); name = "Zlib"; break; case kBZip2Compression: - result = port::BZip2_Compress(Options().compression_opts, text, - strlen(text), &compressed); + result = BZip2_Compress(Options().compression_opts, text, + strlen(text), &compressed); name = "BZip2"; break; case kLZ4Compression: - result = port::LZ4_Compress(Options().compression_opts, text, - strlen(text), &compressed); + result = LZ4_Compress(Options().compression_opts, text, strlen(text), + &compressed); name = "LZ4"; break; case kLZ4HCCompression: - result = port::LZ4HC_Compress(Options().compression_opts, text, + result = LZ4HC_Compress(Options().compression_opts, text, strlen(text), &compressed); name = "LZ4HC"; break; @@ -1774,24 +1775,24 @@ class Benchmark { while (ok && bytes < int64_t(1) << 30) { switch (FLAGS_compression_type_e) { case rocksdb::kSnappyCompression: - ok = port::Snappy_Compress(Options().compression_opts, input.data(), - input.size(), &compressed); + ok = Snappy_Compress(Options().compression_opts, input.data(), + input.size(), &compressed); break; case rocksdb::kZlibCompression: - ok = port::Zlib_Compress(Options().compression_opts, input.data(), - input.size(), &compressed); + ok = Zlib_Compress(Options().compression_opts, input.data(), + input.size(), &compressed); break; case rocksdb::kBZip2Compression: - ok = port::BZip2_Compress(Options().compression_opts, input.data(), - input.size(), &compressed); + ok = BZip2_Compress(Options().compression_opts, input.data(), + input.size(), &compressed); break; case rocksdb::kLZ4Compression: - ok = port::LZ4_Compress(Options().compression_opts, input.data(), - input.size(), &compressed); + ok = LZ4_Compress(Options().compression_opts, input.data(), + input.size(), &compressed); break; case rocksdb::kLZ4HCCompression: - ok = port::LZ4HC_Compress(Options().compression_opts, input.data(), - input.size(), &compressed); + ok = LZ4HC_Compress(Options().compression_opts, input.data(), + input.size(), &compressed); break; default: ok = false; @@ -1820,24 +1821,24 @@ class Benchmark { bool ok; switch (FLAGS_compression_type_e) { case rocksdb::kSnappyCompression: - ok = port::Snappy_Compress(Options().compression_opts, input.data(), - input.size(), &compressed); + ok = Snappy_Compress(Options().compression_opts, input.data(), + input.size(), &compressed); break; case rocksdb::kZlibCompression: - ok = port::Zlib_Compress(Options().compression_opts, input.data(), - input.size(), &compressed); + ok = Zlib_Compress(Options().compression_opts, input.data(), input.size(), + &compressed); break; case rocksdb::kBZip2Compression: - ok = port::BZip2_Compress(Options().compression_opts, input.data(), - input.size(), &compressed); + ok = BZip2_Compress(Options().compression_opts, input.data(), + input.size(), &compressed); break; case rocksdb::kLZ4Compression: - ok = port::LZ4_Compress(Options().compression_opts, input.data(), - input.size(), &compressed); + ok = LZ4_Compress(Options().compression_opts, input.data(), input.size(), + &compressed); break; case rocksdb::kLZ4HCCompression: - ok = port::LZ4HC_Compress(Options().compression_opts, input.data(), - input.size(), &compressed); + ok = LZ4HC_Compress(Options().compression_opts, input.data(), + input.size(), &compressed); break; default: ok = false; @@ -1851,27 +1852,27 @@ class Benchmark { case rocksdb::kSnappyCompression: // allocate here to make comparison fair uncompressed = new char[input.size()]; - ok = port::Snappy_Uncompress(compressed.data(), compressed.size(), - uncompressed); + ok = Snappy_Uncompress(compressed.data(), compressed.size(), + uncompressed); break; case rocksdb::kZlibCompression: - uncompressed = port::Zlib_Uncompress( - compressed.data(), compressed.size(), &decompress_size); + uncompressed = Zlib_Uncompress(compressed.data(), compressed.size(), + &decompress_size); ok = uncompressed != nullptr; break; case rocksdb::kBZip2Compression: - uncompressed = port::BZip2_Uncompress( - compressed.data(), compressed.size(), &decompress_size); + uncompressed = BZip2_Uncompress(compressed.data(), compressed.size(), + &decompress_size); ok = uncompressed != nullptr; break; case rocksdb::kLZ4Compression: - uncompressed = port::LZ4_Uncompress( - compressed.data(), compressed.size(), &decompress_size); + uncompressed = LZ4_Uncompress(compressed.data(), compressed.size(), + &decompress_size); ok = uncompressed != nullptr; break; case rocksdb::kLZ4HCCompression: - uncompressed = port::LZ4_Uncompress( - compressed.data(), compressed.size(), &decompress_size); + uncompressed = LZ4_Uncompress(compressed.data(), compressed.size(), + &decompress_size); ok = uncompressed != nullptr; break; default: diff --git a/db/db_test.cc b/db/db_test.cc index 455d6cb7e..9fa2a40b5 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -42,6 +42,7 @@ #include "util/hash_linklist_rep.h" #include "utilities/merge_operators.h" #include "util/logging.h" +#include "util/compression.h" #include "util/mutexlock.h" #include "util/rate_limiter.h" #include "util/statistics.h" @@ -58,31 +59,31 @@ namespace rocksdb { static bool SnappyCompressionSupported(const CompressionOptions& options) { std::string out; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - return port::Snappy_Compress(options, in.data(), in.size(), &out); + return Snappy_Compress(options, in.data(), in.size(), &out); } static bool ZlibCompressionSupported(const CompressionOptions& options) { std::string out; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - return port::Zlib_Compress(options, in.data(), in.size(), &out); + return Zlib_Compress(options, in.data(), in.size(), &out); } static bool BZip2CompressionSupported(const CompressionOptions& options) { std::string out; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - return port::BZip2_Compress(options, in.data(), in.size(), &out); + return BZip2_Compress(options, in.data(), in.size(), &out); } static bool LZ4CompressionSupported(const CompressionOptions &options) { std::string out; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - return port::LZ4_Compress(options, in.data(), in.size(), &out); + return LZ4_Compress(options, in.data(), in.size(), &out); } static bool LZ4HCCompressionSupported(const CompressionOptions &options) { std::string out; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - return port::LZ4HC_Compress(options, in.data(), in.size(), &out); + return LZ4HC_Compress(options, in.data(), in.size(), &out); } static std::string RandomString(Random* rnd, int len) { diff --git a/table/table_test.cc b/table/table_test.cc index 3d603bf31..8810a2254 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -40,6 +40,7 @@ #include "table/plain_table_factory.h" #include "table/get_context.h" +#include "util/compression.h" #include "util/random.h" #include "util/statistics.h" #include "util/testharness.h" @@ -533,9 +534,8 @@ static bool SnappyCompressionSupported() { #ifdef SNAPPY std::string out; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - return port::Snappy_Compress(Options().compression_opts, - in.data(), in.size(), - &out); + return Snappy_Compress(Options().compression_opts, in.data(), in.size(), + &out); #else return false; #endif @@ -545,9 +545,7 @@ static bool ZlibCompressionSupported() { #ifdef ZLIB std::string out; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - return port::Zlib_Compress(Options().compression_opts, - in.data(), in.size(), - &out); + return Zlib_Compress(Options().compression_opts, in.data(), in.size(), &out); #else return false; #endif @@ -557,9 +555,7 @@ static bool BZip2CompressionSupported() { #ifdef BZIP2 std::string out; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - return port::BZip2_Compress(Options().compression_opts, - in.data(), in.size(), - &out); + return BZip2_Compress(Options().compression_opts, in.data(), in.size(), &out); #else return false; #endif @@ -569,8 +565,7 @@ static bool LZ4CompressionSupported() { #ifdef LZ4 std::string out; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - return port::LZ4_Compress(Options().compression_opts, in.data(), in.size(), - &out); + return LZ4_Compress(Options().compression_opts, in.data(), in.size(), &out); #else return false; #endif @@ -580,8 +575,7 @@ static bool LZ4HCCompressionSupported() { #ifdef LZ4 std::string out; Slice in = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - return port::LZ4HC_Compress(Options().compression_opts, in.data(), in.size(), - &out); + return LZ4HC_Compress(Options().compression_opts, in.data(), in.size(), &out); #else return false; #endif