diff options
| author | 2017-01-24 08:32:59 +0000 | |
|---|---|---|
| committer | 2017-01-24 08:32:59 +0000 | |
| commit | 53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch) | |
| tree | 7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/lib/Support/Compression.cpp | |
| parent | In preparation of compiling our kernels with -ffreestanding, explicitly map (diff) | |
| download | wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip | |
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/lib/Support/Compression.cpp')
| -rw-r--r-- | gnu/llvm/lib/Support/Compression.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/gnu/llvm/lib/Support/Compression.cpp b/gnu/llvm/lib/Support/Compression.cpp index b54613e92b8..5d556462e89 100644 --- a/gnu/llvm/lib/Support/Compression.cpp +++ b/gnu/llvm/lib/Support/Compression.cpp @@ -62,16 +62,23 @@ zlib::Status zlib::compress(StringRef InputBuffer, return Res; } +zlib::Status zlib::uncompress(StringRef InputBuffer, char *UncompressedBuffer, + size_t &UncompressedSize) { + Status Res = encodeZlibReturnValue( + ::uncompress((Bytef *)UncompressedBuffer, (uLongf *)&UncompressedSize, + (const Bytef *)InputBuffer.data(), InputBuffer.size())); + // Tell MemorySanitizer that zlib output buffer is fully initialized. + // This avoids a false report when running LLVM with uninstrumented ZLib. + __msan_unpoison(UncompressedBuffer, UncompressedSize); + return Res; +} + zlib::Status zlib::uncompress(StringRef InputBuffer, SmallVectorImpl<char> &UncompressedBuffer, size_t UncompressedSize) { UncompressedBuffer.resize(UncompressedSize); - Status Res = encodeZlibReturnValue(::uncompress( - (Bytef *)UncompressedBuffer.data(), (uLongf *)&UncompressedSize, - (const Bytef *)InputBuffer.data(), InputBuffer.size())); - // Tell MemorySanitizer that zlib output buffer is fully initialized. - // This avoids a false report when running LLVM with uninstrumented ZLib. - __msan_unpoison(UncompressedBuffer.data(), UncompressedSize); + Status Res = + uncompress(InputBuffer, UncompressedBuffer.data(), UncompressedSize); UncompressedBuffer.resize(UncompressedSize); return Res; } @@ -87,6 +94,10 @@ zlib::Status zlib::compress(StringRef InputBuffer, CompressionLevel Level) { return zlib::StatusUnsupported; } +zlib::Status zlib::uncompress(StringRef InputBuffer, char *UncompressedBuffer, + size_t &UncompressedSize) { + return zlib::StatusUnsupported; +} zlib::Status zlib::uncompress(StringRef InputBuffer, SmallVectorImpl<char> &UncompressedBuffer, size_t UncompressedSize) { |
