зеркало из https://github.com/mozilla/gecko-dev.git
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 []).
This commit is contained in:
Родитель
86cc2888f3
Коммит
c6426f2d97
|
@ -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>(
|
||||
(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<char> mCompresseddata;
|
||||
nsAutoArrayPtr<char> mCompresseddata;
|
||||
uint32_t mDatasize;
|
||||
};
|
||||
|
||||
|
@ -651,7 +651,7 @@ public:
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
while ((d = mList.popFirst()) != nullptr) {
|
||||
std::auto_ptr<DebugGLData> cleaner(d);
|
||||
nsAutoPtr<DebugGLData> cleaner(d);
|
||||
if (!d->Write()) {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче