diff options
Diffstat (limited to 'llvm/lib/Support/Compression.cpp')
-rw-r--r-- | llvm/lib/Support/Compression.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/llvm/lib/Support/Compression.cpp b/llvm/lib/Support/Compression.cpp index 05bd7b5..2217740 100644 --- a/llvm/lib/Support/Compression.cpp +++ b/llvm/lib/Support/Compression.cpp @@ -29,16 +29,6 @@ static Error createError(StringRef Err) { return make_error<StringError>(Err, inconvertibleErrorCode()); } -static int encodeZlibCompressionLevel(zlib::CompressionLevel Level) { - switch (Level) { - case zlib::NoCompression: return 0; - case zlib::BestSpeedCompression: return 1; - case zlib::DefaultCompression: return Z_DEFAULT_COMPRESSION; - case zlib::BestSizeCompression: return 9; - } - llvm_unreachable("Invalid zlib::CompressionLevel!"); -} - static StringRef convertZlibCodeToString(int Code) { switch (Code) { case Z_MEM_ERROR: @@ -58,14 +48,12 @@ static StringRef convertZlibCodeToString(int Code) { bool zlib::isAvailable() { return true; } Error zlib::compress(StringRef InputBuffer, - SmallVectorImpl<char> &CompressedBuffer, - CompressionLevel Level) { + SmallVectorImpl<char> &CompressedBuffer, int Level) { unsigned long CompressedSize = ::compressBound(InputBuffer.size()); CompressedBuffer.reserve(CompressedSize); - int CLevel = encodeZlibCompressionLevel(Level); - int Res = ::compress2((Bytef *)CompressedBuffer.data(), &CompressedSize, - (const Bytef *)InputBuffer.data(), InputBuffer.size(), - CLevel); + int Res = + ::compress2((Bytef *)CompressedBuffer.data(), &CompressedSize, + (const Bytef *)InputBuffer.data(), InputBuffer.size(), Level); // Tell MemorySanitizer that zlib output buffer is fully initialized. // This avoids a false report when running LLVM with uninstrumented ZLib. __msan_unpoison(CompressedBuffer.data(), CompressedSize); @@ -118,4 +106,3 @@ uint32_t zlib::crc32(StringRef Buffer) { llvm_unreachable("zlib::crc32 is unavailable"); } #endif - |