Use a separate variable for each loop in the widgets sample
This avoids VC14 variable shadowing warning and is also just better practice.
This commit is contained in:
@@ -272,8 +272,7 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
|
|||||||
|
|
||||||
StartTest(wxT("Append some items with data objects"));
|
StartTest(wxT("Append some items with data objects"));
|
||||||
wxClientData **objects = new wxClientData *[m_items.GetCount()];
|
wxClientData **objects = new wxClientData *[m_items.GetCount()];
|
||||||
unsigned i;
|
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||||
for ( i = 0; i < m_items.GetCount(); ++i )
|
|
||||||
objects[i] = CreateClientData(i);
|
objects[i] = CreateClientData(i);
|
||||||
m_container->Append(m_items, objects);
|
m_container->Append(m_items, objects);
|
||||||
EndTest(expected_result);
|
EndTest(expected_result);
|
||||||
@@ -281,19 +280,19 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
|
|||||||
|
|
||||||
StartTest(wxT("Append some items with data"));
|
StartTest(wxT("Append some items with data"));
|
||||||
void **data = new void *[m_items.GetCount()];
|
void **data = new void *[m_items.GetCount()];
|
||||||
for ( i = 0; i < m_items.GetCount(); ++i )
|
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||||
data[i] = wxUIntToPtr(i);
|
data[i] = wxUIntToPtr(i);
|
||||||
m_container->Append(m_items, data);
|
m_container->Append(m_items, data);
|
||||||
EndTest(expected_result);
|
EndTest(expected_result);
|
||||||
delete[] data;
|
delete[] data;
|
||||||
|
|
||||||
StartTest(wxT("Append some items with data, one by one"));
|
StartTest(wxT("Append some items with data, one by one"));
|
||||||
for ( i = 0; i < m_items.GetCount(); ++i )
|
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||||
m_container->Append(m_items[i], wxUIntToPtr(i));
|
m_container->Append(m_items[i], wxUIntToPtr(i));
|
||||||
EndTest(expected_result);
|
EndTest(expected_result);
|
||||||
|
|
||||||
StartTest(wxT("Append some items with data objects, one by one"));
|
StartTest(wxT("Append some items with data objects, one by one"));
|
||||||
for ( i = 0; i < m_items.GetCount(); ++i )
|
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||||
m_container->Append(m_items[i], CreateClientData(i));
|
m_container->Append(m_items[i], CreateClientData(i));
|
||||||
EndTest(expected_result);
|
EndTest(expected_result);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user