Closed Bug 1208355 Opened 9 years ago Closed 9 years ago

Fix -Wshadow warnings in dom/datastore

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

Details

Attachments

(2 files, 1 obsolete file)

Attached patch Wshadow_datastore.patch (obsolete) — Splinter Review
dom/datastore/DataStoreService.cpp:956:15 [-Wshadow-local] shadowed declaration is here
dom/datastore/DataStoreService.cpp:974:14 [-Wshadow-local] declaration of 'rv' shadows a previous local
Attachment #8665803 - Flags: review?(amarchesini)
Comment on attachment 8665803 [details] [diff] [review]
Wshadow_datastore.patch

Review of attachment 8665803 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/datastore/DataStoreService.cpp
@@ +953,5 @@
>    }
>  
>    nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(window);
> +  ErrorResult createResult;
> +  nsRefPtr<Promise> promise = Promise::Create(global, createResult);

Instead doing this, can you use 'rv' also in the rest of the code?
Attachment #8665803 - Flags: review?(amarchesini) → review+
(In reply to Andrea Marchesini (:baku) from comment #1)
> >    nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(window);
> > +  ErrorResult createResult;
> > +  nsRefPtr<Promise> promise = Promise::Create(global, createResult);
> 
> Instead doing this, can you use 'rv' also in the rest of the code?

I'm not sure I understand. Do you mean I should use a variable name like 'createRv' or simply 'rv'? I can't use the name 'ErrorResult rv' here because it will clash with the declaration 'nsresult rv' later in this function, which is the original -Wshadow warning I am trying to fix. :)
Flags: needinfo?(amarchesini)
Attached patch example.patchSplinter Review
I meant something like this.
Flags: needinfo?(amarchesini)
Attachment #8666666 - Flags: review?(cpeterson)
Comment on attachment 8666666 [details] [diff] [review]
example.patch

Review of attachment 8666666 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks! I understand now. I didn't see the ErrorResult class had a conversion constructor for nsresult values.
Attachment #8666666 - Flags: review?(cpeterson) → feedback+
This patch includes the rv changes you asked for plus some other -Wshadow fixes in the DataStoreService::GetDataStoreInfos() member function.
Attachment #8665803 - Attachment is obsolete: true
Attachment #8669286 - Flags: review?(amarchesini)
Attachment #8669286 - Flags: review?(amarchesini) → review+
https://hg.mozilla.org/mozilla-central/rev/9adede8793f2
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: