From 7d1214cd7298f63d03b8f3686524c5f227fcd242 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 4 Oct 2012 15:55:06 +0000 Subject: [PATCH] silence warnings about shadowed variables with GCC -Wshadow git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/arrimpl.cpp | 6 ++--- src/aui/auibar.cpp | 6 ++--- src/aui/auibook.cpp | 40 +++++++++++++++++----------------- src/aui/framemanager.cpp | 24 ++++++++++---------- src/common/dynarray.cpp | 8 +++---- src/common/file.cpp | 18 +++++++-------- src/common/markupparser.cpp | 1 - src/common/translation.cpp | 4 ++-- src/generic/grid.cpp | 18 ++++++--------- src/generic/treectlg.cpp | 4 ++-- src/gtk/bmpcbox.cpp | 6 ++--- src/gtk/colordlg.cpp | 8 +++---- src/gtk/print.cpp | 6 ++--- src/gtk/toplevel.cpp | 6 ++--- src/propgrid/editors.cpp | 6 ++--- src/propgrid/property.cpp | 4 ++-- src/ribbon/art_msw.cpp | 4 ++-- src/unix/fswatcher_inotify.cpp | 8 +++---- 18 files changed, 86 insertions(+), 91 deletions(-) diff --git a/include/wx/arrimpl.cpp b/include/wx/arrimpl.cpp index f2bc7ce73f..1ed418dd6a 100644 --- a/include/wx/arrimpl.cpp +++ b/include/wx/arrimpl.cpp @@ -91,13 +91,13 @@ void name::Insert(const T& item, size_t uiIndex, size_t nInsert) \ base_array::operator[](uiIndex + i) = new T(item); \ } \ \ -int name::Index(const T& Item, bool bFromEnd) const \ +int name::Index(const T& item, bool bFromEnd) const \ { \ if ( bFromEnd ) { \ if ( size() > 0 ) { \ size_t ui = size() - 1; \ do { \ - if ( (T*)base_array::operator[](ui) == &Item ) \ + if ( (T*)base_array::operator[](ui) == &item ) \ return static_cast(ui); \ ui--; \ } \ @@ -106,7 +106,7 @@ int name::Index(const T& Item, bool bFromEnd) const \ } \ else { \ for( size_t ui = 0; ui < size(); ui++ ) { \ - if( (T*)base_array::operator[](ui) == &Item ) \ + if( (T*)base_array::operator[](ui) == &item ) \ return static_cast(ui); \ } \ } \ diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp index 9cb1b9ab0a..b18adb3440 100644 --- a/src/aui/auibar.cpp +++ b/src/aui/auibar.cpp @@ -2530,9 +2530,9 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt) Refresh(false); if (res != -1) { - wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, res); - e.SetEventObject(this); - GetParent()->GetEventHandler()->ProcessEvent(e); + wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, res); + event.SetEventObject(this); + GetParent()->GetEventHandler()->ProcessEvent(event); } } diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index d4a0f5a940..4a2596f52b 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -1093,11 +1093,11 @@ void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt) { m_isDragging = false; - wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, m_windowId); - evt.SetSelection(GetIdxFromWindow(m_clickTab)); - evt.SetOldSelection(evt.GetSelection()); - evt.SetEventObject(this); - GetEventHandler()->ProcessEvent(evt); + wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, m_windowId); + e.SetSelection(GetIdxFromWindow(m_clickTab)); + e.SetOldSelection(e.GetSelection()); + e.SetEventObject(this); + GetEventHandler()->ProcessEvent(e); return; } @@ -1121,11 +1121,11 @@ void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt) if (!(m_pressedButton->curState & wxAUI_BUTTON_STATE_DISABLED)) { - wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, m_windowId); - evt.SetSelection(GetIdxFromWindow(m_clickTab)); - evt.SetInt(m_pressedButton->id); - evt.SetEventObject(this); - GetEventHandler()->ProcessEvent(evt); + wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, m_windowId); + e.SetSelection(GetIdxFromWindow(m_clickTab)); + e.SetInt(m_pressedButton->id); + e.SetEventObject(this); + GetEventHandler()->ProcessEvent(e); } m_pressedButton = NULL; @@ -1254,11 +1254,11 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt) if (m_isDragging) { - wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, m_windowId); - evt.SetSelection(GetIdxFromWindow(m_clickTab)); - evt.SetOldSelection(evt.GetSelection()); - evt.SetEventObject(this); - GetEventHandler()->ProcessEvent(evt); + wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, m_windowId); + e.SetSelection(GetIdxFromWindow(m_clickTab)); + e.SetOldSelection(e.GetSelection()); + e.SetEventObject(this); + GetEventHandler()->ProcessEvent(e); return; } @@ -1269,11 +1269,11 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt) if (abs(pos.x - m_clickPt.x) > drag_x_threshold || abs(pos.y - m_clickPt.y) > drag_y_threshold) { - wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, m_windowId); - evt.SetSelection(GetIdxFromWindow(m_clickTab)); - evt.SetOldSelection(evt.GetSelection()); - evt.SetEventObject(this); - GetEventHandler()->ProcessEvent(evt); + wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, m_windowId); + e.SetSelection(GetIdxFromWindow(m_clickTab)); + e.SetOldSelection(e.GetSelection()); + e.SetEventObject(this); + GetEventHandler()->ProcessEvent(e); m_isDragging = true; } diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 30ca612af4..696a1f2a7b 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -3236,16 +3236,16 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, // determine the mouse offset and the pane size, both in the // direction of the dock itself, and perpendicular to the dock - int offset, size; + int mouseOffset, size; if (part->orientation == wxVERTICAL) { - offset = pt.y - part->rect.y; + mouseOffset = pt.y - part->rect.y; size = part->rect.GetHeight(); } else { - offset = pt.x - part->rect.x; + mouseOffset = pt.x - part->rect.x; size = part->rect.GetWidth(); } @@ -3253,7 +3253,7 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, // if we are in the top/left part of the pane, // insert the pane before the pane being hovered over - if (offset <= size/2) + if (mouseOffset <= size/2) { drop_position = part->pane->dock_pos; DoInsertPane(panes, @@ -3265,7 +3265,7 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, // if we are in the bottom/right part of the pane, // insert the pane before the pane being hovered over - if (offset > size/2) + if (mouseOffset > size/2) { drop_position = part->pane->dock_pos+1; DoInsertPane(panes, @@ -3367,15 +3367,15 @@ void wxAuiManager::ShowHint(const wxRect& rect) pane.frame && pane.frame->IsShown()) { - wxRect rect = pane.frame->GetRect(); + wxRect r = pane.frame->GetRect(); #ifdef __WXGTK__ // wxGTK returns the client size, not the whole frame size - rect.width += 15; - rect.height += 35; - rect.Inflate(5); + r.width += 15; + r.height += 35; + r.Inflate(5); #endif - clip.Subtract(rect); + clip.Subtract(r); } } @@ -4658,8 +4658,8 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) pane.SetFlag(wxAuiPaneInfo::actionPane, true); - wxPoint pt = event.GetPosition(); - DoDrop(m_docks, m_panes, pane, pt, m_actionOffset); + wxPoint point = event.GetPosition(); + DoDrop(m_docks, m_panes, pane, point, m_actionOffset); // if DoDrop() decided to float the pane, set up // the floating pane's initial position diff --git a/src/common/dynarray.cpp b/src/common/dynarray.cpp index 8d62ca6b06..0f556decb5 100644 --- a/src/common/dynarray.cpp +++ b/src/common/dynarray.cpp @@ -158,13 +158,13 @@ void name::Grow(size_t nIncrement) \ if( (m_nCount == m_nSize) || ((m_nSize - m_nCount) < nIncrement) ) { \ if( m_nSize == 0 ) { \ /* was empty, determine initial size */ \ - size_t size = WX_ARRAY_DEFAULT_INITIAL_SIZE; \ - if (size < nIncrement) size = nIncrement; \ + size_t sz = WX_ARRAY_DEFAULT_INITIAL_SIZE; \ + if (sz < nIncrement) sz = nIncrement; \ /* allocate some memory */ \ - m_pItems = new T[size]; \ + m_pItems = new T[sz]; \ /* only grow if allocation succeeded */ \ if ( m_pItems ) { \ - m_nSize = size; \ + m_nSize = sz; \ } \ } \ else \ diff --git a/src/common/file.cpp b/src/common/file.cpp index 02a15cb2ca..b2cd1bed5f 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -204,17 +204,17 @@ bool wxFile::Create(const wxString& fileName, bool bOverwrite, int accessMode) { // if bOverwrite we create a new file or truncate the existing one, // otherwise we only create the new file and fail if it already exists - int fd = wxOpen( fileName, + int fildes = wxOpen( fileName, O_BINARY | O_WRONLY | O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), accessMode ); - if ( CheckForError(fd) ) + if ( CheckForError(fildes) ) { wxLogSysError(_("can't create file '%s'"), fileName); return false; } - Attach(fd); + Attach(fildes); return true; } @@ -258,15 +258,15 @@ bool wxFile::Open(const wxString& fileName, OpenMode mode, int accessMode) accessMode &= wxS_IRUSR | wxS_IWUSR; #endif // __WINDOWS__ - int fd = wxOpen( fileName, flags, accessMode); + int fildes = wxOpen( fileName, flags, accessMode); - if ( CheckForError(fd) ) + if ( CheckForError(fildes) ) { wxLogSysError(_("can't open file '%s'"), fileName); return false; } - Attach(fd); + Attach(fildes); return true; } @@ -304,11 +304,11 @@ bool wxFile::ReadAll(wxString *str, const wxMBConv& conv) { static const unsigned READSIZE = 4096; - ssize_t read = Read(p, length > READSIZE ? READSIZE : length); - if ( read == wxInvalidOffset ) + ssize_t nread = Read(p, length > READSIZE ? READSIZE : length); + if ( nread == wxInvalidOffset ) return false; - p += read; + p += nread; } *p = 0; diff --git a/src/common/markupparser.cpp b/src/common/markupparser.cpp index c0580e242f..70b680bd7f 100644 --- a/src/common/markupparser.cpp +++ b/src/common/markupparser.cpp @@ -172,7 +172,6 @@ wxMarkupParser::ParseAttrs(wxString attrs, TagAndAttrs& tagAndAttrs) else // Must be a CSS-like size specification { int cssSize = 1; - wxString rest; if ( value.StartsWith("xx-", &rest) ) cssSize = 3; else if ( value.StartsWith("x-", &rest) ) diff --git a/src/common/translation.cpp b/src/common/translation.cpp index d5022c9ac6..1996330eac 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -289,7 +289,7 @@ public: T_LEFT_BRACKET, T_RIGHT_BRACKET }; Type type() const { return m_type; } - void setType(Type type) { m_type = type; } + void setType(Type t) { m_type = t; } // for T_NUMBER only typedef int Number; Number number() const { return m_number; } @@ -466,7 +466,7 @@ private: class wxPluralFormsNode { public: - wxPluralFormsNode(const wxPluralFormsToken& token) : m_token(token) {} + wxPluralFormsNode(const wxPluralFormsToken& t) : m_token(t) {} const wxPluralFormsToken& token() const { return m_token; } const wxPluralFormsNode* node(unsigned i) const { return m_nodes[i].get(); } diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 375fc63b75..6d6649d96e 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -2877,7 +2877,6 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) if ( !m_colAt.IsEmpty() ) { //Shift the column IDs - int i; for ( i = 0; i < m_numCols - numCols; i++ ) { if ( m_colAt[i] >= (int)pos ) @@ -2947,7 +2946,6 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) m_colAt.Add( 0, numCols ); //Set the new columns' positions - int i; for ( i = oldNumCols; i < m_numCols; i++ ) { m_colAt[i] = i; @@ -3531,9 +3529,8 @@ void wxGrid::DoUpdateResizeColWidth(int w) void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event ) { - int x, y; - wxPoint pos( event.GetPosition() ); - CalcUnscrolledPosition( pos.x, pos.y, &x, &y ); + int x; + CalcUnscrolledPosition( event.GetPosition().x, 0, &x, NULL ); int col = XToCol(x); if ( event.Dragging() ) @@ -3649,14 +3646,13 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event ) // else if ( event.LeftDown() ) { - int col = XToEdgeOfCol(x); - if ( col != wxNOT_FOUND && CanDragColSize(col) ) + int colEdge = XToEdgeOfCol(x); + if ( colEdge != wxNOT_FOUND && CanDragColSize(colEdge) ) { ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL, GetColLabelWindow()); } else // not a request to start resizing { - col = XToCol(x); if ( col >= 0 && !SendEvent( wxEVT_GRID_LABEL_LEFT_CLICK, -1, col, event ) ) { @@ -4415,14 +4411,14 @@ bool wxGrid::DoEndDragResizeLine(const wxGridOperations& oper) oper.SelectSize(rect) = oper.Select(size); int subtractLines = 0; - const int lineStart = doper.PosToLine(this, posLineStart); - if ( lineStart >= 0 ) + int line = doper.PosToLine(this, posLineStart); + if ( line >= 0 ) { // ensure that if we have a multi-cell block we redraw all of // it by increasing the refresh area to cover it entirely if a // part of it is affected const int lineEnd = doper.PosToLine(this, posLineEnd, true); - for ( int line = lineStart; line < lineEnd; line++ ) + for ( ; line < lineEnd; line++ ) { int cellLines = oper.Select( GetCellSize(oper.MakeCoords(m_dragRowOrCol, line))); diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 0eaabbf6de..33b3eaeca3 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -423,8 +423,8 @@ BEGIN_EVENT_TABLE(wxTreeTextCtrl,wxTextCtrl) END_EVENT_TABLE() wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner, - wxGenericTreeItem *item) - : m_itemEdited(item), m_startValue(item->GetText()) + wxGenericTreeItem *itm) + : m_itemEdited(itm), m_startValue(itm->GetText()) { m_owner = owner; m_aboutToFinish = false; diff --git a/src/gtk/bmpcbox.cpp b/src/gtk/bmpcbox.cpp index 672413d798..f9f8f042fb 100644 --- a/src/gtk/bmpcbox.cpp +++ b/src/gtk/bmpcbox.cpp @@ -102,9 +102,9 @@ bool wxBitmapComboBox::Create(wxWindow *parent, // Select 'value' in entry-less mode if ( !GetEntry() ) { - int n = FindString(value); - if ( n != wxNOT_FOUND ) - SetSelection(n); + int i = FindString(value); + if (i != wxNOT_FOUND) + SetSelection(i); } return true; diff --git a/src/gtk/colordlg.cpp b/src/gtk/colordlg.cpp index ed38b7d933..c6ac162f2f 100644 --- a/src/gtk/colordlg.cpp +++ b/src/gtk/colordlg.cpp @@ -131,13 +131,13 @@ void wxColourDialog::ColourDataToDialog() gtk_color_selection_dialog_get_color_selection( GTK_COLOR_SELECTION_DIALOG(m_widget))); - const wxColour& c = m_data.GetColour(); - if (c.IsOk()) + const wxColour& color = m_data.GetColour(); + if (color.IsOk()) { #ifdef __WXGTK3__ - gtk_color_selection_set_current_rgba(sel, c); + gtk_color_selection_set_current_rgba(sel, color); #else - gtk_color_selection_set_current_color(sel, c.GetColor()); + gtk_color_selection_set_current_color(sel, color.GetColor()); #endif } diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index 7ef941c862..34143e4b73 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -1501,9 +1501,9 @@ void wxGtkPrinterDCImpl::DoDrawPolygon(int n, wxPoint points[], int i; for (i = 1; i < n; i++) { - int x = points[i].x + xoffset; - int y = points[i].y + yoffset; - cairo_line_to( m_cairo, XLOG2DEV(x), YLOG2DEV(y) ); + int xx = points[i].x + xoffset; + int yy = points[i].y + yoffset; + cairo_line_to( m_cairo, XLOG2DEV(xx), YLOG2DEV(yy) ); } cairo_close_path(m_cairo); diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 1bcc3ce8e9..b561d5f61d 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -377,9 +377,9 @@ gtk_frame_window_state_callback( GtkWidget* WXUNUSED(widget), // if maximized bit changed and it is now set if (event->changed_mask & event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) { - wxMaximizeEvent event(win->GetId()); - event.SetEventObject(win); - win->HandleWindowEvent(event); + wxMaximizeEvent evt(win->GetId()); + evt.SetEventObject(win); + win->HandleWindowEvent(evt); } return false; diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 1c2b9b6039..fe58ba0ef7 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -882,7 +882,7 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, if ( comValIndex >= 0 ) { const wxPGCommonValue* cv = GetCommonValue(comValIndex); - wxPGCellRenderer* renderer = cv->GetRenderer(); + renderer = cv->GetRenderer(); r.width = rect.width; renderer->Render( dc, r, this, p, m_selColumn, comValIndex, renderFlags ); return; @@ -1619,8 +1619,8 @@ wxPGWindowList wxPGCheckBoxEditor::CreateControls( wxPropertyGrid* propGrid, // If mouse cursor was on the item, toggle the value now. if ( propGrid->GetInternalFlags() & wxPG_FL_ACTIVATION_BY_CLICK ) { - wxPoint pt = cb->ScreenToClient(::wxGetMousePosition()); - if ( pt.x <= (wxPG_XBEFORETEXT-2+cb->m_boxHeight) ) + wxPoint point = cb->ScreenToClient(::wxGetMousePosition()); + if ( point.x <= (wxPG_XBEFORETEXT-2+cb->m_boxHeight) ) { if ( cb->m_state & wxSCB_STATE_CHECKED ) cb->m_state &= ~wxSCB_STATE_CHECKED; diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 5fc00a35b5..ceaba28ae3 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -1035,7 +1035,7 @@ bool wxPGProperty::IntToValue( wxVariant& variant, int number, int WXUNUSED(argF } // Convert semicolon delimited tokens into child values. -bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const +bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFlags ) const { if ( !GetChildCount() ) return false; @@ -1240,7 +1240,7 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int } if ( changed ) - variant = list; + v = list; return changed; } diff --git a/src/ribbon/art_msw.cpp b/src/ribbon/art_msw.cpp index 8bd4273eeb..ca4b457e23 100644 --- a/src/ribbon/art_msw.cpp +++ b/src/ribbon/art_msw.cpp @@ -1428,7 +1428,7 @@ void wxRibbonMSWArtProvider::ReallyDrawTabSeparator(wxWindow* wnd, const wxRect& } void wxRibbonMSWArtProvider::DrawPartialPageBackground(wxDC& dc, - wxWindow* wnd, const wxRect& rect, wxRibbonPage* page, + wxWindow* wnd, const wxRect& r, wxRibbonPage* page, wxPoint offset, bool hovered) { wxRect background; @@ -1465,7 +1465,7 @@ void wxRibbonMSWArtProvider::DrawPartialPageBackground(wxDC& dc, lower_rect.y += upper_rect.height; lower_rect.height -= upper_rect.height; - wxRect paint_rect(rect); + wxRect paint_rect(r); paint_rect.x += offset.x; paint_rect.y += offset.y; diff --git a/src/unix/fswatcher_inotify.cpp b/src/unix/fswatcher_inotify.cpp index 675d1168e3..3b40d6aa2e 100644 --- a/src/unix/fswatcher_inotify.cpp +++ b/src/unix/fswatcher_inotify.cpp @@ -268,8 +268,8 @@ protected: // renames else if (nativeFlags & IN_MOVE) { - wxInotifyCookies::iterator it = m_cookies.find(inevt.cookie); - if ( it == m_cookies.end() ) + wxInotifyCookies::iterator it2 = m_cookies.find(inevt.cookie); + if ( it2 == m_cookies.end() ) { int size = sizeof(inevt) + inevt.len; inotify_event* e = (inotify_event*) operator new (size); @@ -280,7 +280,7 @@ protected: } else { - inotify_event& oldinevt = *(it->second); + inotify_event& oldinevt = *(it2->second); wxFileSystemWatcherEvent event(flags); if ( inevt.mask & IN_MOVED_FROM ) @@ -295,7 +295,7 @@ protected: } SendEvent(event); - m_cookies.erase(it); + m_cookies.erase(it2); delete &oldinevt; } } -- 2.45.2