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
This commit is contained in:
Paul Cornett 2012-10-04 15:55:06 +00:00
parent f821bc3617
commit 7d1214cd72
18 changed files with 86 additions and 91 deletions

View File

@ -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<int>(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<int>(ui); \
} \
} \

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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

View File

@ -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 \

View File

@ -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;

View File

@ -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) )

View File

@ -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(); }

View File

@ -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)));

View File

@ -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;

View File

@ -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;

View File

@ -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
}

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}
}