Bug 1618753 Remove nsAutoPtr usage from modules. r=KrisWright

Differential Revision: https://phabricator.services.mozilla.com/D64704

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eric Rahm 2020-02-28 21:44:12 +00:00
Родитель 487e572e35
Коммит 0c17906777
3 изменённых файлов: 7 добавлений и 12 удалений

Просмотреть файл

@ -234,7 +234,7 @@ nsresult nsZipHandle::Init(nsZipArchive* zip, const char* entry,
RefPtr<nsZipHandle> handle = new nsZipHandle();
if (!handle) return NS_ERROR_OUT_OF_MEMORY;
handle->mBuf = new nsZipItemPtr<uint8_t>(zip, entry);
handle->mBuf = MakeUnique<nsZipItemPtr<uint8_t>>(zip, entry);
if (!handle->mBuf) return NS_ERROR_OUT_OF_MEMORY;
if (!handle->mBuf->Buffer()) return NS_ERROR_UNEXPECTED;

Просмотреть файл

@ -14,7 +14,6 @@
#include "zlib.h"
#include "zipstruct.h"
#include "nsAutoPtr.h"
#include "nsIFile.h"
#include "nsISupportsImpl.h" // For mozilla::ThreadSafeAutoRefCnt
#include "mozilla/ArenaAllocator.h"
@ -403,7 +402,7 @@ class nsZipHandle final {
PRFileMap* mMap; /* nspr datastructure for mmap */
mozilla::AutoFDClose mNSPRFileDesc;
nsAutoPtr<nsZipItemPtr<uint8_t> > mBuf;
UniquePtr<nsZipItemPtr<uint8_t> > mBuf;
mozilla::ThreadSafeAutoRefCnt mRefCnt; /* ref count */
NS_DECL_OWNINGTHREAD

Просмотреть файл

@ -45,7 +45,6 @@
#include "mozilla/Variant.h"
#include "mozilla/Vector.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsAutoPtr.h"
#include "nsCategoryManagerUtils.h"
#include "nsClassHashtable.h"
#include "nsCOMArray.h"
@ -4301,16 +4300,14 @@ static nsresult pref_ReadPrefFromJar(nsZipArchive* aJarReader,
static nsresult pref_ReadDefaultPrefs(const RefPtr<nsZipArchive> jarReader,
const char* path) {
nsZipFind* findPtr;
nsAutoPtr<nsZipFind> find;
UniquePtr<nsZipFind> find;
nsTArray<nsCString> prefEntries;
const char* entryName;
uint16_t entryNameLen;
nsresult rv = jarReader->FindInit(path, &findPtr);
nsresult rv = jarReader->FindInit(path, getter_Transfers(find));
NS_ENSURE_SUCCESS(rv, rv);
find = findPtr;
while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) {
prefEntries.AppendElement(Substring(entryName, entryNameLen));
}
@ -4473,8 +4470,7 @@ nsresult Preferences::InitInitialObjects(bool aIsStartup) {
// preferences from omni.jar, whether or not `$app == $gre`.
nsresult rv = NS_ERROR_FAILURE;
nsZipFind* findPtr;
nsAutoPtr<nsZipFind> find;
UniquePtr<nsZipFind> find;
nsTArray<nsCString> prefEntries;
const char* entryName;
uint16_t entryNameLen;
@ -4570,9 +4566,9 @@ nsresult Preferences::InitInitialObjects(bool aIsStartup) {
}
if (appJarReader) {
rv = appJarReader->FindInit("defaults/preferences/*.js$", &findPtr);
rv = appJarReader->FindInit("defaults/preferences/*.js$",
getter_Transfers(find));
NS_ENSURE_SUCCESS(rv, rv);
find = findPtr;
prefEntries.Clear();
while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) {
prefEntries.AppendElement(Substring(entryName, entryNameLen));