Bug 1198128 - Fix -Wshadow warnings in widget/gtk. r=karlt
authorChris Peterson <cpeterson@mozilla.com>
Sun, 23 Aug 2015 17:55:09 -0700
changeset 288041 d799977fb4099f31f074babd3ee3edb889a9613a
parent 288040 61993e366ce613026be995d5c6f53c8c093bd40f
child 288042 fc23dad2b3831e68854d2b499514acd3f9d89a9b
push id4792
push useryura.zenevich@gmail.com
push dateWed, 26 Aug 2015 20:00:52 +0000
reviewerskarlt
bugs1198128
milestone43.0a1
Bug 1198128 - Fix -Wshadow warnings in widget/gtk. r=karlt
widget/gtk/gtk3drawing.c
widget/gtk/moz.build
widget/gtk/nsClipboard.cpp
widget/gtk/nsDragService.cpp
widget/gtk/nsWindow.cpp
--- a/widget/gtk/gtk3drawing.c
+++ b/widget/gtk/gtk3drawing.c
@@ -2714,23 +2714,21 @@ moz_gtk_get_widget_border(GtkThemeWidget
             gtk_style_context_save(style);
             gtk_style_context_add_class(style, GTK_STYLE_CLASS_FRAME);
             moz_gtk_add_style_border(style, left, top, right, bottom);
             gtk_style_context_restore(style);
             return MOZ_GTK_SUCCESS;
         }
     case MOZ_GTK_TREE_HEADER_CELL:
         {
-            /* A Tree Header in GTK is just a different styled button 
+            /* A Tree Header in GTK is just a different styled button
              * It must be placed in a TreeView for getting the correct style
              * assigned.
-             * That is why the following code is the same as for MOZ_GTK_BUTTON.  
+             * That is why the following code is the same as for MOZ_GTK_BUTTON.
              * */
-            GtkStyleContext *style;
-
             ensure_tree_header_cell_widget();
             *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gTreeHeaderCellWidget));
 
             style = gtk_widget_get_style_context(gTreeHeaderCellWidget);
 
             moz_gtk_add_style_border(style, left, top, right, bottom);
             moz_gtk_add_style_padding(style, left, top, right, bottom);
             return MOZ_GTK_SUCCESS;
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -55,16 +55,19 @@ if CONFIG['NS_PRINTING']:
     ]
 
 if CONFIG['MOZ_X11']:
     UNIFIED_SOURCES += [
         'nsClipboard.cpp',
         'nsDragService.cpp',
     ]
 
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 if CONFIG['ACCESSIBILITY']:
     UNIFIED_SOURCES += [
         'maiRedundantObjectFactory.c',
     ]
 
 if CONFIG['MOZ_ENABLE_GTK2']:
--- a/widget/gtk/nsClipboard.cpp
+++ b/widget/gtk/nsClipboard.cpp
@@ -524,19 +524,18 @@ nsClipboard::SelectionGetEvent(GtkClipbo
 #endif
       return;
     }
 
     nsresult rv;
     nsCOMPtr<nsISupports> item;
     uint32_t len;
 
-  
     GdkAtom selectionTarget = gtk_selection_data_get_target(aSelectionData);
-  
+
     // Check to see if the selection data includes any of the string
     // types that we support.
     if (selectionTarget == gdk_atom_intern ("STRING", FALSE) ||
         selectionTarget == gdk_atom_intern ("TEXT", FALSE) ||
         selectionTarget == gdk_atom_intern ("COMPOUND_TEXT", FALSE) ||
         selectionTarget == gdk_atom_intern ("UTF8_STRING", FALSE)) {
         // Try to convert our internal type into a text string.  Get
         // the transferable for this clipboard and try to get the
@@ -564,22 +563,21 @@ nsClipboard::SelectionGetEvent(GtkClipbo
         return;
     }
 
     // Check to see if the selection data is an image type
     if (gtk_targets_include_image(&selectionTarget, 1, TRUE)) {
         // Look through our transfer data for the image
         static const char* const imageMimeTypes[] = {
             kNativeImageMime, kPNGImageMime, kJPEGImageMime, kJPGImageMime, kGIFImageMime };
-        nsCOMPtr<nsISupports> item;
-        uint32_t len;
+        nsCOMPtr<nsISupports> imageItem;
         nsCOMPtr<nsISupportsInterfacePointer> ptrPrimitive;
         for (uint32_t i = 0; !ptrPrimitive && i < ArrayLength(imageMimeTypes); i++) {
-            rv = trans->GetTransferData(imageMimeTypes[i], getter_AddRefs(item), &len);
-            ptrPrimitive = do_QueryInterface(item);
+            rv = trans->GetTransferData(imageMimeTypes[i], getter_AddRefs(imageItem), &len);
+            ptrPrimitive = do_QueryInterface(imageItem);
         }
         if (!ptrPrimitive)
             return;
 
         nsCOMPtr<nsISupports> primitiveData;
         ptrPrimitive->GetData(getter_AddRefs(primitiveData));
         nsCOMPtr<imgIContainer> image(do_QueryInterface(primitiveData));
         if (!image) // Not getting an image for an image mime type!?
--- a/widget/gtk/nsDragService.cpp
+++ b/widget/gtk/nsDragService.cpp
@@ -779,18 +779,18 @@ nsDragService::GetData(nsITransferable *
                         int32_t convertedTextLen = 0;
 
                         GetTextUriListItem(text, mTargetDragDataLen, aItemIndex,
                                            &convertedText, &convertedTextLen);
 
                         if (convertedText) {
                             nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
                             nsCOMPtr<nsIURI> fileURI;
-                            nsresult rv = ioService->NewURI(NS_ConvertUTF16toUTF8(convertedText),
-                                                            nullptr, nullptr, getter_AddRefs(fileURI));
+                            rv = ioService->NewURI(NS_ConvertUTF16toUTF8(convertedText),
+                                                   nullptr, nullptr, getter_AddRefs(fileURI));
                             if (NS_SUCCEEDED(rv)) {
                                 nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(fileURI, &rv);
                                 if (NS_SUCCEEDED(rv)) {
                                     nsCOMPtr<nsIFile> file;
                                     rv = fileURL->GetFile(getter_AddRefs(file));
                                     if (NS_SUCCEEDED(rv)) {
                                         // The common wrapping code at the end of 
                                         // this function assumes the data is text
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2389,18 +2389,16 @@ nsWindow::OnSizeAllocate(GtkAllocation *
          (void *)this, aAllocation->x, aAllocation->y,
          aAllocation->width, aAllocation->height));
 
     nsIntSize size = GdkRectToDevicePixels(*aAllocation).Size();
 
     if (mBounds.Size() == size)
         return;
 
-    nsIntRect rect;
-
     // Invalidate the new part of the window now for the pending paint to
     // minimize background flashes (GDK does not do this for external resizes
     // of toplevels.)
     if (mBounds.width < size.width) {
         GdkRectangle rect = DevicePixelsToGdkRectRoundOut(
             { mBounds.width, 0, size.width - mBounds.width, size.height });
         gdk_window_invalidate_rect(mGdkWindow, &rect, FALSE);
     }