17 #include "llvm/Config/config.h" 21 #if LLVM_ENABLE_ZLIB == 1 && HAVE_ZLIB_H 27 #if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ 35 return "zlib error: Z_MEM_ERROR";
37 return "zlib error: Z_BUF_ERROR";
39 return "zlib error: Z_STREAM_ERROR";
41 return "zlib error: Z_DATA_ERROR";
52 unsigned long CompressedSize = ::compressBound(InputBuffer.
size());
53 CompressedBuffer.
reserve(CompressedSize);
55 ::compress2((Bytef *)CompressedBuffer.
data(), &CompressedSize,
56 (
const Bytef *)InputBuffer.
data(), InputBuffer.
size(),
Level);
60 CompressedBuffer.
set_size(CompressedSize);
65 size_t &UncompressedSize) {
67 ::uncompress((Bytef *)UncompressedBuffer, (uLongf *)&UncompressedSize,
68 (
const Bytef *)InputBuffer.
data(), InputBuffer.
size());
77 size_t UncompressedSize) {
78 UncompressedBuffer.
resize(UncompressedSize);
80 uncompress(InputBuffer, UncompressedBuffer.
data(), UncompressedSize);
81 UncompressedBuffer.
resize(UncompressedSize);
96 size_t &UncompressedSize) {
101 size_t UncompressedSize) {
static Error createError(StringRef Err)
This class represents lattice values for constants.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
void reserve(size_type N)
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).
Error compress(StringRef InputBuffer, SmallVectorImpl< char > &CompressedBuffer, int Level=DefaultCompression)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define __msan_unpoison(p, size)
static StringRef convertZlibCodeToString(int Code)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static ErrorSuccess success()
Create a success value.
uint32_t crc32(StringRef Buffer)
pointer data()
Return a pointer to the vector's buffer, even if empty().
void set_size(size_t Size)
Set the array size to N, which the current array must have enough capacity for.
Lightweight error class with error context and mandatory checking.
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...