From 98cc7fd2c1d397623960baf69ae3cec04a87a23e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 13 Aug 2015 11:28:32 +0200 Subject: Deprecate SPtrArray and convert everyone to unique_ptr More standardization --- apt-pkg/contrib/fileutl.cc | 7 ++++--- apt-pkg/contrib/sptr.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 4cc8112af..a6af27b00 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -52,6 +52,7 @@ #include #include +#include #ifdef HAVE_ZLIB #include @@ -159,7 +160,7 @@ bool CopyFile(FileFd &From,FileFd &To) return false; // Buffered copy between fds - SPtrArray Buf = new unsigned char[64000]; + std::unique_ptr Buf(new unsigned char[64000]); unsigned long long Size = From.Size(); while (Size != 0) { @@ -167,8 +168,8 @@ bool CopyFile(FileFd &From,FileFd &To) if (Size > 64000) ToRead = 64000; - if (From.Read(Buf,ToRead) == false || - To.Write(Buf,ToRead) == false) + if (From.Read(Buf.get(),ToRead) == false || + To.Write(Buf.get(),ToRead) == false) return false; Size -= ToRead; diff --git a/apt-pkg/contrib/sptr.h b/apt-pkg/contrib/sptr.h index 5cf118b84..92f4cdec8 100644 --- a/apt-pkg/contrib/sptr.h +++ b/apt-pkg/contrib/sptr.h @@ -43,7 +43,7 @@ class APT_DEPRECATED SPtr }; template -class SPtrArray +class APT_DEPRECATED SPtrArray { public: T *Ptr; -- cgit v1.2.3