Bug 1319408 - Use auto type specifier where aplicable for variable declarations to improve code readability and maintainability in embedding/.
MozReview-Commit-ID: GJSRXaQCDXS
--- a/embedding/components/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/embedding/components/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -685,17 +685,17 @@ PersistNodeFixup::PersistNodeFixup(WebBr
{
if (aMap) {
uint32_t mapSize;
nsresult rv = aMap->GetNumMappedURIs(&mapSize);
MOZ_ASSERT(NS_SUCCEEDED(rv));
NS_ENSURE_SUCCESS_VOID(rv);
for (uint32_t i = 0; i < mapSize; ++i) {
nsAutoCString urlFrom;
- nsCString* urlTo = new nsCString();
+ auto* urlTo = new nsCString();
rv = aMap->GetURIMapping(i, urlFrom, *urlTo);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (NS_SUCCEEDED(rv)) {
mMap.Put(urlFrom, urlTo);
}
}
}
--- a/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -1668,31 +1668,31 @@ nsresult nsWebBrowserPersist::SaveDocume
}
}
}
// Store the document in a list so when URI persistence is done and the
// filenames of saved URIs are known, the documents can be fixed up and
// saved
- DocData *docData = new DocData;
+ auto *docData = new DocData;
docData->mBaseURI = mCurrentBaseURI;
docData->mCharset = mCurrentCharset;
docData->mDocument = aDocument;
docData->mFile = aFile;
mDocList.AppendElement(docData);
// Walk the DOM gathering a list of externally referenced URIs in the uri map
nsCOMPtr<nsIWebBrowserPersistResourceVisitor> visit =
new OnWalk(this, aFile, localDataPath);
return aDocument->ReadResources(visit);
}
else
{
- DocData *docData = new DocData;
+ auto *docData = new DocData;
docData->mBaseURI = mCurrentBaseURI;
docData->mCharset = mCurrentCharset;
docData->mDocument = aDocument;
docData->mFile = aFile;
mDocList.AppendElement(docData);
// Not walking DOMs, so go directly to serialization.
SerializeNextFile();
@@ -1763,17 +1763,17 @@ nsWebBrowserPersist::FinishSaveDocumentI
}
}
if (!haveDir) {
EndDownload(NS_ERROR_FAILURE);
return;
}
if (mPersistFlags & PERSIST_FLAGS_CLEANUP_ON_FAILURE) {
// Add to list of things to delete later if all goes wrong
- CleanupData *cleanupData = new CleanupData;
+ auto *cleanupData = new CleanupData;
cleanupData->mFile = aDataPath;
cleanupData->mIsDirectory = true;
mCleanupList.AppendElement(cleanupData);
}
}
}
if (mWalkStack.Length() > 0) {
@@ -2303,17 +2303,17 @@ nsWebBrowserPersist::MakeOutputStreamFro
NS_ENSURE_SUCCESS(rv, rv);
*aOutputStream = NS_BufferOutputStream(fileOutputStream,
BUFFERED_OUTPUT_SIZE).take();
if (mPersistFlags & PERSIST_FLAGS_CLEANUP_ON_FAILURE)
{
// Add to cleanup list in event of failure
- CleanupData *cleanupData = new CleanupData;
+ auto *cleanupData = new CleanupData;
if (!cleanupData) {
NS_RELEASE(*aOutputStream);
return NS_ERROR_OUT_OF_MEMORY;
}
cleanupData->mFile = aFile;
cleanupData->mIsDirectory = false;
mCleanupList.AppendElement(cleanupData);
}