Bug 1473217 - Part 2: dom: Fix clang-tidy's misc-unused-raii warnings. r?baku draft
authorChris Peterson <cpeterson@mozilla.com>
Tue, 03 Jul 2018 22:09:54 -0700
changeset 814214 3295686df39694fb234318c684a335621d164294
parent 814213 264a521b1efe5f3e308e2db1da3ac4dcb40f6c4b
child 814215 e41c2dadaffe25dcc17036cb176adfaf51b75935
child 814344 0b0ca6dbde1a6c72c80b83a580b67768d2e36b14
push id115133
push usercpeterson@mozilla.com
push dateWed, 04 Jul 2018 19:23:36 +0000
reviewersbaku
bugs1473217
milestone63.0a1
Bug 1473217 - Part 2: dom: Fix clang-tidy's misc-unused-raii warnings. r?baku nsPrintfCString creates a formatted string, but doesn't print it. ExtractOriginData is called for its constructor's scope and origin out parameters. This ExtractOriginData object doesn't really need a name because it is unused after we have scope and origin, but this change makes clang-tidy happy and makes the code clear that ExtractOriginData is an object and not a funcion being called. MozReview-Commit-ID: nxUBwzL4Uq
dom/indexedDB/ActorsParent.cpp
dom/storage/StorageDBUpdater.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -25722,19 +25722,20 @@ NormalTransactionOp::SendSuccessResult()
     MOZ_ASSERT(maximalSizeFromPref > kMaxIDBMsgOverhead);
     const size_t kMaxMessageSize = maximalSizeFromPref - kMaxIDBMsgOverhead;
 
     RequestResponse response;
     size_t responseSize = kMaxMessageSize;
     GetResponse(response, &responseSize);
 
     if (responseSize >= kMaxMessageSize) {
-      nsPrintfCString("The serialized value is too large"
-                      " (size=%zu bytes, max=%zu bytes).",
-                      responseSize, kMaxMessageSize);
+      nsPrintfCString warning("The serialized value is too large"
+                              " (size=%zu bytes, max=%zu bytes).",
+                              responseSize, kMaxMessageSize);
+      NS_WARNING(warning.get());
       return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
     }
 
     MOZ_ASSERT(response.type() != RequestResponse::T__None);
 
     if (response.type() == RequestResponse::Tnsresult) {
       MOZ_ASSERT(NS_FAILED(response.get_nsresult()));
 
--- a/dom/storage/StorageDBUpdater.cpp
+++ b/dom/storage/StorageDBUpdater.cpp
@@ -173,17 +173,17 @@ GetOriginParticular::OnFunctionCall(
 {
   nsresult rv;
 
   nsAutoCString scope;
   rv = aFunctionArguments->GetUTF8String(0, scope);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString suffix, origin;
-  ExtractOriginData(scope, suffix, origin);
+  ExtractOriginData extractor(scope, suffix, origin);
 
   nsCOMPtr<nsIWritableVariant> outVar(new nsVariant());
 
   switch (mParticular) {
   case EParticular::ORIGIN_ATTRIBUTES_SUFFIX:
     rv = outVar->SetAsAUTF8String(suffix);
     break;
   case EParticular::ORIGIN_KEY: