From abd2edda78437fc928f315b4f3d759a815fd388e Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 15 Jan 2016 14:29:51 +0100 Subject: [PATCH] Revert "Bug 1232450 - use UniquePtr instead of nsAutoArrayPtr in xulrunner/; r=Yoric" This reverts commit bf65fa24b6611dbd99fa71c3cf1d01bddba96a06. --- xulrunner/tools/redit/redit.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xulrunner/tools/redit/redit.cpp b/xulrunner/tools/redit/redit.cpp index 8a96358b22e..5fdb7f7b5dc 100644 --- a/xulrunner/tools/redit/redit.cpp +++ b/xulrunner/tools/redit/redit.cpp @@ -15,7 +15,7 @@ // Mozilla headers (alphabetical) #include "mozilla/FileUtils.h" // ScopedClose -#include "mozilla/UniquePtrExtensions.h" +#include "nsAutoPtr.h" // nsAutoArrayPtr /* Icon files are made up of: @@ -120,12 +120,12 @@ wmain(int argc, wchar_t** argv) // Load all the data from the icon file long filesize = _filelength(file); - auto data = MakeUniqueFallible(filesize); + nsAutoArrayPtr data(new BYTE[filesize]); if(!data) { fprintf(stderr, "Failed to allocate memory for icon file.\n"); return 1; } - _read(file, data.get(), filesize); + _read(file, data, filesize); IconHeader* header = reinterpret_cast(data.get()); @@ -139,18 +139,18 @@ wmain(int argc, wchar_t** argv) // Allocate the group resource entry long groupSize = sizeof(IconHeader) + header->ImageCount * sizeof(IconResEntry); - auto group = MakeUniqueFallible(groupSize); + nsAutoArrayPtr group(new BYTE[groupSize]); if(!group) { fprintf(stderr, "Failed to allocate memory for new images.\n"); return 1; } - memcpy(group.get(), data.get(), sizeof(IconHeader)); + memcpy(group, data, sizeof(IconHeader)); IconDirEntry* sourceIcon = - reinterpret_cast(data.get() + reinterpret_cast(data + sizeof(IconHeader)); IconResEntry* targetIcon = - reinterpret_cast(group.get() + reinterpret_cast(group + sizeof(IconHeader)); for (int id = 1; id <= header->ImageCount; id++) {