From f4ccd110750a3f3fe6a107d5c74c649c2a0dc407 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/Compression.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/Support/Compression.cpp') diff --git a/lib/Support/Compression.cpp b/lib/Support/Compression.cpp index b5ddb7002c..5e5336144a 100644 --- a/lib/Support/Compression.cpp +++ b/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