Bug 1319408 - Use auto type specifier where aplicable for variable declarations to improve code readability and maintainability in embedding/. draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Tue, 22 Nov 2016 14:55:44 +0200
changeset 442387 a366a657a5c58c9aa6845209561c4ee40e9c6172
parent 442068 0534254e9a40b4bade2577c631fe4cfa0b5db41d
child 442388 5988b50680935c9193c347aff787d1c48c396976
push id36698
push userbmo:bpostelnicu@mozilla.com
push dateTue, 22 Nov 2016 13:14:55 +0000
bugs1319408
milestone53.0a1
Bug 1319408 - Use auto type specifier where aplicable for variable declarations to improve code readability and maintainability in embedding/. MozReview-Commit-ID: GJSRXaQCDXS
embedding/components/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
--- 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);
     }