From 56440fd8203f581b9aded68db3631ea11a72ccf2 Mon Sep 17 00:00:00 2001 From: Ahmed Charles Date: Thu, 6 Mar 2014 05:51:42 +0000 Subject: Replace OwningPtr with std::unique_ptr. This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083 --- llvm/lib/Support/Compression.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'llvm/lib/Support/Compression.cpp') diff --git a/llvm/lib/Support/Compression.cpp b/llvm/lib/Support/Compression.cpp index b5ddb7002ca..5e5336144ab 100644 --- a/llvm/lib/Support/Compression.cpp +++ b/llvm/lib/Support/Compression.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/Compression.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringRef.h" #include "llvm/Config/config.h" #include "llvm/Support/Compiler.h" @@ -48,10 +47,10 @@ static zlib::Status encodeZlibReturnValue(int ReturnValue) { bool zlib::isAvailable() { return true; } zlib::Status zlib::compress(StringRef InputBuffer, - OwningPtr &CompressedBuffer, + std::unique_ptr &CompressedBuffer, CompressionLevel Level) { unsigned long CompressedSize = ::compressBound(InputBuffer.size()); - OwningArrayPtr TmpBuffer(new char[CompressedSize]); + std::unique_ptr TmpBuffer(new char[CompressedSize]); int CLevel = encodeZlibCompressionLevel(Level); Status Res = encodeZlibReturnValue(::compress2( (Bytef *)TmpBuffer.get(), &CompressedSize, @@ -66,9 +65,9 @@ zlib::Status zlib::compress(StringRef InputBuffer, } zlib::Status zlib::uncompress(StringRef InputBuffer, - OwningPtr &UncompressedBuffer, + std::unique_ptr &UncompressedBuffer, size_t UncompressedSize) { - OwningArrayPtr TmpBuffer(new char[UncompressedSize]); + std::unique_ptr TmpBuffer(new char[UncompressedSize]); Status Res = encodeZlibReturnValue( ::uncompress((Bytef *)TmpBuffer.get(), (uLongf *)&UncompressedSize, (const Bytef *)InputBuffer.data(), InputBuffer.size())); @@ -88,12 +87,12 @@ uint32_t zlib::crc32(StringRef Buffer) { #else bool zlib::isAvailable() { return false; } zlib::Status zlib::compress(StringRef InputBuffer, - OwningPtr &CompressedBuffer, + std::unique_ptr &CompressedBuffer, CompressionLevel Level) { return zlib::StatusUnsupported; } zlib::Status zlib::uncompress(StringRef InputBuffer, - OwningPtr &UncompressedBuffer, + std::unique_ptr &UncompressedBuffer, size_t UncompressedSize) { return zlib::StatusUnsupported; } -- cgit v1.2.3