Closed Bug 1204398 Opened 6 years ago Closed 6 years ago

Fix -Wshadow warnings in widget/cocoa

Categories

(Core :: Widget: Cocoa, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

Details

Attachments

(1 file)

When one variable's name shadowed another's, I renamed both variables to ensure that I did not miss a renaming and leave a name referencing the wrong variable.

widget/cocoa/nsChildView.mm:6048:20 [-Wshadow] declaration shadows a local variable
widget/cocoa/nsClipboard.mm:472:16 [-Wshadow] declaration shadows a local variable
widget/cocoa/nsDragService.mm:99:23 [-Wshadow] declaration shadows a local variable
widget/cocoa/nsDragService.mm:388:16 [-Wshadow] declaration shadows a local variable
widget/cocoa/nsPrintOptionsX.mm:39:14 [-Wshadow] declaration shadows a local variable
Attachment #8660533 - Flags: review?(spohl.mozilla.bugs)
Comment on attachment 8660533 [details] [diff] [review]
Wshadow_widget-cocoa.patch

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

::: widget/cocoa/nsClipboard.mm
@@ +468,5 @@
>        if (!surface) {
>          continue;
>        }
>        CGImageRef imageRef = NULL;
> +      rv = nsCocoaUtils::CreateCGImageFromSurface(surface, &imageRef);

rv is reused throughout this function. I confirmed that reusing rv here is safe.

::: widget/cocoa/nsPrintOptionsX.mm
@@ +35,5 @@
>      // names, but the OS X printing prompt code only really cares about
>      // the first one, so we just send the first to save IPC traffic.
>      char16_t** docTitles;
>      uint32_t titleCount;
> +    rv = aWBP->EnumerateDocumentNames(&titleCount, &docTitles);

rv is reused throughout this function. I confirmed that reusing rv here is safe.
Comment on attachment 8660533 [details] [diff] [review]
Wshadow_widget-cocoa.patch

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

::: widget/cocoa/nsChildView.mm
@@ +6113,5 @@
>      return NO;
>  
>    // Declare the pasteboard types.
>    unsigned int typeCount = [pasteboardOutputDict count];
> +  NSMutableArray * declaredTypes = [NSMutableArray arrayWithCapacity:typeCount];

nit: s/NSMutableArray */NSMutableArray*/
Attachment #8660533 - Flags: review?(spohl.mozilla.bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/ab8764ec9c2e
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.