avoid shadowed variable warnings with VS2015

This commit is contained in:
Paul Cornett
2015-07-24 20:56:11 -07:00
parent 64308117e8
commit 36e31e515e
18 changed files with 88 additions and 90 deletions

View File

@@ -4111,23 +4111,23 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
wxDataViewItem itemDragged = GetItemByRow( drag_item_row ); wxDataViewItem itemDragged = GetItemByRow( drag_item_row );
// Notify cell about drag // Notify cell about drag
wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, m_owner->GetId() ); wxDataViewEvent evt( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, m_owner->GetId() );
event.SetEventObject( m_owner ); evt.SetEventObject( m_owner );
event.SetItem( itemDragged ); evt.SetItem( itemDragged );
event.SetModel( model ); evt.SetModel( model );
if (!m_owner->HandleWindowEvent( event )) if (!m_owner->HandleWindowEvent( evt ))
return; return;
if (!event.IsAllowed()) if (!evt.IsAllowed())
return; return;
wxDataObject *obj = event.GetDataObject(); wxDataObject *obj = evt.GetDataObject();
if (!obj) if (!obj)
return; return;
wxDataViewDropSource drag( this, drag_item_row ); wxDataViewDropSource drag( this, drag_item_row );
drag.SetData( *obj ); drag.SetData( *obj );
/* wxDragResult res = */ drag.DoDragDrop(event.GetDragFlags()); /* wxDragResult res = */ drag.DoDragDrop(evt.GetDragFlags());
delete obj; delete obj;
} }
return; return;

View File

@@ -197,7 +197,7 @@ wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id,
wxIcon icon; wxIcon icon;
icon.CreateFromHICON( (WXHICON)sii.hIcon ); icon.CreateFromHICON( (WXHICON)sii.hIcon );
wxBitmap bitmap( icon ); bitmap = wxBitmap(icon);
::DestroyIcon(sii.hIcon); ::DestroyIcon(sii.hIcon);
if ( bitmap.IsOk() ) if ( bitmap.IsOk() )

View File

@@ -685,7 +685,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
unsigned char val = *src++; unsigned char val = *src++;
unsigned char reversed = 0; unsigned char reversed = 0;
for ( int bits = 0; bits < 8; bits++) for ( int bit = 0; bit < 8; bit++)
{ {
reversed <<= 1; reversed <<= 1;
reversed |= (unsigned char)(val & 0x01); reversed |= (unsigned char)(val & 0x01);

View File

@@ -663,7 +663,7 @@ int wxFileDialog::ShowModal()
const wxChar* extension = filterBuffer.t_str(); const wxChar* extension = filterBuffer.t_str();
int maxFilter = (int)(of.nFilterIndex*2L) - 1; int maxFilter = (int)(of.nFilterIndex*2L) - 1;
for( int i = 0; i < maxFilter; i++ ) // get extension for( int j = 0; j < maxFilter; j++ ) // get extension
extension = extension + wxStrlen( extension ) + 1; extension = extension + wxStrlen( extension ) + 1;
// use dummy name a to avoid assert in AppendExtension // use dummy name a to avoid assert in AppendExtension
@@ -725,11 +725,11 @@ int wxFileDialog::ShowModal()
m_fileNames.Add(toke.GetNextToken()); m_fileNames.Add(toke.GetNextToken());
#endif // OFN_EXPLORER #endif // OFN_EXPLORER
wxString dir(m_dir); m_path = m_dir;
if ( m_dir.Last() != wxT('\\') ) if ( m_dir.Last() != wxT('\\') )
dir += wxT('\\'); m_path += wxT('\\');
m_path = dir + m_fileName; m_path += m_fileName;
m_filterIndex = (int)of.nFilterIndex - 1; m_filterIndex = (int)of.nFilterIndex - 1;
} }
else else
@@ -745,7 +745,7 @@ int wxFileDialog::ShowModal()
const wxChar* extension = filterBuffer.t_str(); const wxChar* extension = filterBuffer.t_str();
int maxFilter = (int)(of.nFilterIndex*2L) - 1; int maxFilter = (int)(of.nFilterIndex*2L) - 1;
for( int i = 0; i < maxFilter; i++ ) // get extension for( int j = 0; j < maxFilter; j++ ) // get extension
extension = extension + wxStrlen( extension ) + 1; extension = extension + wxStrlen( extension ) + 1;
m_fileName = AppendExtension(fileNameBuffer, extension); m_fileName = AppendExtension(fileNameBuffer, extension);

View File

@@ -1761,11 +1761,11 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD
interim.GetPixelFormat(),&data); interim.GetPixelFormat(),&data);
bool hasAlpha = false; bool hasAlpha = false;
for ( size_t y = 0 ; y < height && !hasAlpha ; ++y) for ( size_t yy = 0 ; yy < height && !hasAlpha ; ++yy)
{ {
for( size_t x = 0 ; x < width && !hasAlpha; ++x) for( size_t xx = 0 ; xx < width && !hasAlpha; ++xx)
{ {
ARGB *dest = (ARGB*)((BYTE*)data.Scan0 + data.Stride*y + x*4); ARGB *dest = (ARGB*)((BYTE*)data.Scan0 + data.Stride*yy + xx*4);
if ( ( *dest & Color::AlphaMask ) != 0 ) if ( ( *dest & Color::AlphaMask ) != 0 )
hasAlpha = true; hasAlpha = true;
} }

View File

@@ -688,7 +688,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
{ {
// we must use position in SetOwnerDrawnMenuItem because // we must use position in SetOwnerDrawnMenuItem because
// all separators have the same id // all separators have the same id
int pos = 0; int position = 0;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
while (node) while (node)
{ {
@@ -697,14 +697,14 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
if ( !item->IsOwnerDrawn()) if ( !item->IsOwnerDrawn())
{ {
item->SetOwnerDrawn(true); item->SetOwnerDrawn(true);
SetOwnerDrawnMenuItem(GetHmenu(), pos, SetOwnerDrawnMenuItem(GetHmenu(), position,
reinterpret_cast<ULONG_PTR>(item), TRUE); reinterpret_cast<ULONG_PTR>(item), TRUE);
} }
item->SetMarginWidth(m_maxBitmapWidth); item->SetMarginWidth(m_maxBitmapWidth);
node = node->GetNext(); node = node->GetNext();
pos++; position++;
} }
// set menu as ownerdrawn // set menu as ownerdrawn

View File

@@ -1074,13 +1074,13 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc,
SIZE accelSize; SIZE accelSize;
::GetTextExtentPoint32(hdc, accel.c_str(), accel.length(), &accelSize); ::GetTextExtentPoint32(hdc, accel.c_str(), accel.length(), &accelSize);
int flags = DST_TEXT; flags = DST_TEXT;
// themes menu is using specified color for disabled labels // themes menu is using specified color for disabled labels
if ( data->MenuLayout() == MenuDrawData::Classic && if ( data->MenuLayout() == MenuDrawData::Classic &&
(stat & wxODDisabled) && !(stat & wxODSelected) ) (stat & wxODDisabled) && !(stat & wxODSelected) )
flags |= DSS_DISABLED; flags |= DSS_DISABLED;
int x = rcText.right - data->ArrowMargin.GetTotalX() x = rcText.right - data->ArrowMargin.GetTotalX()
- data->ArrowSize.cx - data->ArrowSize.cx
- data->ArrowBorder; - data->ArrowBorder;
@@ -1090,7 +1090,7 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc,
else else
x -= m_parentMenu->GetMaxAccelWidth(); x -= m_parentMenu->GetMaxAccelWidth();
int y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2; y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2;
::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(accel), ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(accel),
accel.length(), x, y, 0, 0, flags); accel.length(), x, y, 0, 0, flags);

View File

@@ -300,7 +300,7 @@ void wxMessageDialog::ReplaceStaticWithEdit()
if ( !hwndBtn ) if ( !hwndBtn )
continue; // it's ok, not all buttons are always present continue; // it's ok, not all buttons are always present
RECT rc = wxGetWindowRect(hwndBtn); rc = wxGetWindowRect(hwndBtn);
rc.top -= dh; rc.top -= dh;
rc.bottom -= dh; rc.bottom -= dh;
rc.left += dw/2; rc.left += dw/2;

View File

@@ -1289,8 +1289,8 @@ wxColour wxNotebook::GetThemeBackgroundColour() const
WCHAR szwThemeColor[256]; WCHAR szwThemeColor[256];
if (S_OK == wxUxThemeEngine::Get()->GetCurrentThemeName(szwThemeFile, 1024, szwThemeColor, 256, NULL, 0)) if (S_OK == wxUxThemeEngine::Get()->GetCurrentThemeName(szwThemeFile, 1024, szwThemeColor, 256, NULL, 0))
{ {
wxString themeFile(szwThemeFile), themeColor(szwThemeColor); wxString themeFile(szwThemeFile);
if (themeFile.Find(wxT("Aero")) != -1 && themeColor == wxT("NormalColor")) if (themeFile.Find(wxT("Aero")) != -1 && wxString(szwThemeColor) == wxT("NormalColor"))
s_AeroStatus = 1; s_AeroStatus = 1;
else else
s_AeroStatus = 0; s_AeroStatus = 0;

View File

@@ -1007,13 +1007,13 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
// wxAutoOleInterface<> assumes a ref has already been added // wxAutoOleInterface<> assumes a ref has already been added
// TYPEATTR // TYPEATTR
TYPEATTR *ta = NULL; TYPEATTR *ta2 = NULL;
hret = ti->GetTypeAttr(&ta); hret = ti->GetTypeAttr(&ta2);
CHECK_HR(hret); CHECK_HR(hret);
if (ta->typekind == TKIND_DISPATCH) if (ta2->typekind == TKIND_DISPATCH)
{ {
// WXOLE_TRACEOUT("GUID = " << GetIIDName(ta->guid).c_str()); // WXOLE_TRACEOUT("GUID = " << GetIIDName(ta2->guid).c_str());
if (defEventSink) if (defEventSink)
{ {
wxAutoIConnectionPoint cp; wxAutoIConnectionPoint cp;
@@ -1022,8 +1022,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
wxAutoIConnectionPointContainer cpContainer(IID_IConnectionPointContainer, m_ActiveX); wxAutoIConnectionPointContainer cpContainer(IID_IConnectionPointContainer, m_ActiveX);
wxASSERT( cpContainer.IsOk()); wxASSERT( cpContainer.IsOk());
HRESULT hret = hret = cpContainer->FindConnectionPoint(ta2->guid, cp.GetRef());
cpContainer->FindConnectionPoint(ta->guid, cp.GetRef());
// Notice that the return value of CONNECT_E_NOCONNECTION is // Notice that the return value of CONNECT_E_NOCONNECTION is
// expected if the interface doesn't support connection points. // expected if the interface doesn't support connection points.
@@ -1035,7 +1034,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
if ( cp ) if ( cp )
{ {
wxActiveXEvents * const wxActiveXEvents * const
events = new wxActiveXEvents(this, ta->guid); events = new wxActiveXEvents(this, ta2->guid);
hret = cp->Advise(events, &adviseCookie); hret = cp->Advise(events, &adviseCookie);
// We don't need this object any more and cp will keep a // We don't need this object any more and cp will keep a
@@ -1048,7 +1047,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
} }
} }
ti->ReleaseTypeAttr(ta); ti->ReleaseTypeAttr(ta2);
} }
// free // free

View File

@@ -356,13 +356,13 @@ void wxWindowsPrintPreview::DetermineScaling()
if ( printerDC.IsOk() ) if ( printerDC.IsOk() )
{ {
wxPrinterDCImpl *impl = (wxPrinterDCImpl*) printerDC.GetImpl(); wxPrinterDCImpl *impl = (wxPrinterDCImpl*) printerDC.GetImpl();
HDC dc = GetHdcOf(*impl); HDC hdc = GetHdcOf(*impl);
printerWidthMM = ::GetDeviceCaps(dc, HORZSIZE); printerWidthMM = ::GetDeviceCaps(hdc, HORZSIZE);
printerHeightMM = ::GetDeviceCaps(dc, VERTSIZE); printerHeightMM = ::GetDeviceCaps(hdc, VERTSIZE);
printerXRes = ::GetDeviceCaps(dc, HORZRES); printerXRes = ::GetDeviceCaps(hdc, HORZRES);
printerYRes = ::GetDeviceCaps(dc, VERTRES); printerYRes = ::GetDeviceCaps(hdc, VERTRES);
logPPIPrinterX = ::GetDeviceCaps(dc, LOGPIXELSX); logPPIPrinterX = ::GetDeviceCaps(hdc, LOGPIXELSX);
logPPIPrinterY = ::GetDeviceCaps(dc, LOGPIXELSY); logPPIPrinterY = ::GetDeviceCaps(hdc, LOGPIXELSY);
paperRect = printerDC.GetPaperRect(); paperRect = printerDC.GetPaperRect();

View File

@@ -79,11 +79,11 @@ bool wxSpinButton::Create(wxWindow *parent,
// get the right size for the control // get the right size for the control
if ( width <= 0 || height <= 0 ) if ( width <= 0 || height <= 0 )
{ {
wxSize size = DoGetBestSize(); wxSize bestSize = DoGetBestSize();
if ( width <= 0 ) if ( width <= 0 )
width = size.x; width = bestSize.x;
if ( height <= 0 ) if ( height <= 0 )
height = size.y; height = bestSize.y;
} }
if ( x < 0 ) if ( x < 0 )

View File

@@ -194,12 +194,12 @@ void wxSpinCtrl::OnChar(wxKeyEvent& event)
{ {
case WXK_RETURN: case WXK_RETURN:
{ {
wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId); wxCommandEvent evt(wxEVT_TEXT_ENTER, m_windowId);
InitCommandEvent(event); InitCommandEvent(evt);
wxString val = wxGetWindowText(m_hwndBuddy); wxString val = wxGetWindowText(m_hwndBuddy);
event.SetString(val); evt.SetString(val);
event.SetInt(GetValue()); evt.SetInt(GetValue());
if ( HandleWindowEvent(event) ) if ( HandleWindowEvent(evt) )
return; return;
break; break;
} }

View File

@@ -479,8 +479,7 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT&)
// the label: this is consistent with the behaviour under pre-XP // the label: this is consistent with the behaviour under pre-XP
// systems (i.e. without visual themes) and generally makes sense // systems (i.e. without visual themes) and generally makes sense
wxBrush brush = wxBrush(GetBackgroundColour()); wxBrush brush = wxBrush(GetBackgroundColour());
wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl(); ::FillRect(hdc, &dimensions, GetHbrushOf(brush));
::FillRect(GetHdcOf(*impl), &dimensions, GetHbrushOf(brush));
} }
else // paint parent background else // paint parent background
{ {

View File

@@ -1974,10 +1974,10 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
{ {
case WXK_RETURN: case WXK_RETURN:
{ {
wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId); wxCommandEvent evt(wxEVT_TEXT_ENTER, m_windowId);
InitCommandEvent(event); InitCommandEvent(evt);
event.SetString(GetValue()); evt.SetString(GetValue());
if ( HandleWindowEvent(event) ) if ( HandleWindowEvent(evt) )
if ( !HasFlag(wxTE_MULTILINE) ) if ( !HasFlag(wxTE_MULTILINE) )
return; return;
//else: multiline controls need Enter for themselves //else: multiline controls need Enter for themselves

View File

@@ -799,10 +799,10 @@ bool wxToolBar::Realize()
// MapBitmap() to work correctly // MapBitmap() to work correctly
for ( int y = 0; y < h; y++ ) for ( int y = 0; y < h; y++ )
{ {
for ( int x = 0; x < w; x++ ) for ( int xx = 0; xx < w; xx++ )
{ {
if ( imgGreyed.IsTransparent(x, y) ) if ( imgGreyed.IsTransparent(xx, y) )
imgGreyed.SetRGB(x, y, imgGreyed.SetRGB(xx, y,
wxLIGHT_GREY->Red(), wxLIGHT_GREY->Red(),
wxLIGHT_GREY->Green(), wxLIGHT_GREY->Green(),
wxLIGHT_GREY->Blue()); wxLIGHT_GREY->Blue());
@@ -885,11 +885,11 @@ bool wxToolBar::Realize()
if ( addBitmap ) // no old bitmap or we can't replace it if ( addBitmap ) // no old bitmap or we can't replace it
{ {
TBADDBITMAP addBitmap; TBADDBITMAP tbAddBitmap;
addBitmap.hInst = 0; tbAddBitmap.hInst = 0;
addBitmap.nID = (UINT_PTR)hBitmap; tbAddBitmap.nID = (UINT_PTR)hBitmap;
if ( ::SendMessage(GetHwnd(), TB_ADDBITMAP, if ( ::SendMessage(GetHwnd(), TB_ADDBITMAP,
(WPARAM) nButtons, (LPARAM)&addBitmap) == -1 ) (WPARAM) nButtons, (LPARAM)&tbAddBitmap) == -1 )
{ {
wxFAIL_MSG(wxT("Could not add bitmap to toolbar")); wxFAIL_MSG(wxT("Could not add bitmap to toolbar"));
} }
@@ -1025,12 +1025,12 @@ bool wxToolBar::Realize()
while ( nodePrev ) while ( nodePrev )
{ {
TBBUTTON& prevButton = buttons[prevIndex]; TBBUTTON& prevButton = buttons[prevIndex];
wxToolBarToolBase *tool = nodePrev->GetData(); wxToolBarToolBase *toolPrev = nodePrev->GetData();
if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO ) if ( !toolPrev->IsButton() || toolPrev->GetKind() != wxITEM_RADIO )
break; break;
if ( tool->Toggle(false) ) if ( toolPrev->Toggle(false) )
DoToggleTool(tool, false); DoToggleTool(toolPrev, false);
prevButton.fsState &= ~TBSTATE_CHECKED; prevButton.fsState &= ~TBSTATE_CHECKED;
nodePrev = nodePrev->GetPrevious(); nodePrev = nodePrev->GetPrevious();

View File

@@ -1525,10 +1525,10 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent,
// need this to make the "[+]" appear // need this to make the "[+]" appear
if ( firstChild ) if ( firstChild )
{ {
TVGetItemRectParam param; TVGetItemRectParam param2;
wxTreeView_GetItemRect(GetHwnd(), HITEM(parent), param, FALSE); wxTreeView_GetItemRect(GetHwnd(), HITEM(parent), param2, FALSE);
::InvalidateRect(GetHwnd(), &param.rect, FALSE); ::InvalidateRect(GetHwnd(), &param2.rect, FALSE);
} }
// associate the application tree item with Win32 tree item handle // associate the application tree item with Win32 tree item handle

View File

@@ -2819,17 +2819,17 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
case WM_MOVING: case WM_MOVING:
{ {
LPRECT pRect = (LPRECT)lParam; LPRECT pRect = (LPRECT)lParam;
wxRect rc; wxRect rect;
rc.SetLeft(pRect->left); rect.SetLeft(pRect->left);
rc.SetTop(pRect->top); rect.SetTop(pRect->top);
rc.SetRight(pRect->right); rect.SetRight(pRect->right);
rc.SetBottom(pRect->bottom); rect.SetBottom(pRect->bottom);
processed = HandleMoving(rc); processed = HandleMoving(rect);
if (processed) { if (processed) {
pRect->left = rc.GetLeft(); pRect->left = rect.GetLeft();
pRect->top = rc.GetTop(); pRect->top = rect.GetTop();
pRect->right = rc.GetRight(); pRect->right = rect.GetRight();
pRect->bottom = rc.GetBottom(); pRect->bottom = rect.GetBottom();
} }
} }
break; break;
@@ -2849,17 +2849,17 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
case WM_SIZING: case WM_SIZING:
{ {
LPRECT pRect = (LPRECT)lParam; LPRECT pRect = (LPRECT)lParam;
wxRect rc; wxRect rect;
rc.SetLeft(pRect->left); rect.SetLeft(pRect->left);
rc.SetTop(pRect->top); rect.SetTop(pRect->top);
rc.SetRight(pRect->right); rect.SetRight(pRect->right);
rc.SetBottom(pRect->bottom); rect.SetBottom(pRect->bottom);
processed = HandleSizing(rc); processed = HandleSizing(rect);
if (processed) { if (processed) {
pRect->left = rc.GetLeft(); pRect->left = rect.GetLeft();
pRect->top = rc.GetTop(); pRect->top = rect.GetTop();
pRect->right = rc.GetRight(); pRect->right = rect.GetRight();
pRect->bottom = rc.GetBottom(); pRect->bottom = rect.GetBottom();
} }
} }
break; break;