From c6426f2d97857417a5a3a510ffdc0a696156628b Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Sat, 5 Jul 2014 11:34:00 +0200 Subject: [PATCH] Bug 991227 - Replace std::auto_ptr with nsAuto(Array)Ptr in LayerScope. r=dglastonbury std::auto_ptr causes clang 3.5 build warnings because we shouldn't use std::auto_ptr in C++ 11 anymore. auto_ptr is deprecated in clang 3.5. Therefore I replaced all the std::auto_ptrs in LayerScope.cpp. Note: nsAuto(Array)Ptr should use "new" operator in C++, instead of moz_malloc() because the destructor of nsAuto(Array)Ptr will call delete(delete []). --- gfx/layers/LayerScope.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gfx/layers/LayerScope.cpp b/gfx/layers/LayerScope.cpp index f3ed68389992..1f318101bcce 100644 --- a/gfx/layers/LayerScope.cpp +++ b/gfx/layers/LayerScope.cpp @@ -489,7 +489,7 @@ public: return false; // then the image data - if (mCompresseddata.get() && !WriteToStream(mCompresseddata.get(), mDatasize)) + if (mCompresseddata.get() && !WriteToStream(mCompresseddata, mDatasize)) return false; // then pad out to 4 bytes @@ -518,12 +518,12 @@ private: mPacket.stride = aImage->Stride(); mPacket.dataSize = aImage->GetSize().height * aImage->Stride(); - mCompresseddata = std::auto_ptr( - (char*)moz_malloc(LZ4::maxCompressedSize(mPacket.dataSize))); + mCompresseddata = + new char[LZ4::maxCompressedSize(mPacket.dataSize)]; if (mCompresseddata.get()) { int ndatasize = LZ4::compress((char*)aImage->GetData(), mPacket.dataSize, - mCompresseddata.get()); + mCompresseddata); if (ndatasize > 0) { mDatasize = ndatasize; @@ -550,7 +550,7 @@ protected: // Packet data DebugGLData::TexturePacket mPacket; - std::auto_ptr mCompresseddata; + nsAutoArrayPtr mCompresseddata; uint32_t mDatasize; }; @@ -651,7 +651,7 @@ public: nsresult rv = NS_OK; while ((d = mList.popFirst()) != nullptr) { - std::auto_ptr cleaner(d); + nsAutoPtr cleaner(d); if (!d->Write()) { rv = NS_ERROR_FAILURE; break;