17 #include "llvm/Config/config.h"
21 #if LLVM_ENABLE_ZLIB == 1 && HAVE_ZLIB_H
27 #if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
45 return "zlib error: Z_MEM_ERROR";
47 return "zlib error: Z_BUF_ERROR";
49 return "zlib error: Z_STREAM_ERROR";
51 return "zlib error: Z_DATA_ERROR";
63 unsigned long CompressedSize = ::compressBound(InputBuffer.
size());
64 CompressedBuffer.
resize(CompressedSize);
66 int Res = ::compress2((Bytef *)CompressedBuffer.
data(), &CompressedSize,
67 (
const Bytef *)InputBuffer.
data(), InputBuffer.
size(),
72 CompressedBuffer.
resize(CompressedSize);
77 size_t &UncompressedSize) {
79 ::uncompress((Bytef *)UncompressedBuffer, (uLongf *)&UncompressedSize,
80 (
const Bytef *)InputBuffer.
data(), InputBuffer.
size());
89 size_t UncompressedSize) {
90 UncompressedBuffer.
resize(UncompressedSize);
92 uncompress(InputBuffer, UncompressedBuffer.
data(), UncompressedSize);
93 UncompressedBuffer.
resize(UncompressedSize);
109 size_t &UncompressedSize) {
114 size_t UncompressedSize) {
static Error createError(StringRef Err)
static int encodeZlibCompressionLevel(zlib::CompressionLevel Level)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
static StringRef convertZlibCodeToString(int Code)
static ErrorSuccess success()
Create a success value.
Error compress(StringRef InputBuffer, SmallVectorImpl< char > &CompressedBuffer, CompressionLevel Level=DefaultCompression)
#define __msan_unpoison(p, size)
uint32_t crc32(StringRef Buffer)
llvm_unreachable("Unknown RegBank!")
pointer data()
Return a pointer to the vector's buffer, even if empty().
Lightweight error class with error context and mandatory checking.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
StringRef - Represent a constant reference to a string, i.e.
Error uncompress(StringRef InputBuffer, char *UncompressedBuffer, size_t &UncompressedSize)
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...