Patch #1788 2007-01-01 16:34
stahta01
SDK patch to reduce warning for wxWidgets 2.8- Download
- 1788-SDK_patch_to_r.patch (9.7 KB)
Index: src/sdk/editarraystringdlg.cpp
===================================================================
--- src/sdk/editarraystringdlg.cpp (revision 3832)
+++ src/sdk/editarraystringdlg.cpp (working copy)
@@ -57,7 +57,7 @@
{
wxListBox* list = XRCCTRL(*this, "lstItems", wxListBox);
m_Array.Clear();
- for (int i = 0; i < list->GetCount(); ++i)
+ for (cbItemCount i = 0; i < list->GetCount(); ++i)
{
m_Array.Add(list->GetString(i));
}
Index: src/sdk/editarrayorderdlg.cpp
===================================================================
--- src/sdk/editarrayorderdlg.cpp (revision 3832)
+++ src/sdk/editarrayorderdlg.cpp (working copy)
@@ -67,7 +67,7 @@
wxListBox* list = XRCCTRL(*this, "lstItems", wxListBox);
XRCCTRL(*this, "btnMoveUp", wxButton)->Enable(list->GetSelection() > 0);
- XRCCTRL(*this, "btnMoveDown", wxButton)->Enable(list->GetSelection() >= 0 && list->GetSelection() < list->GetCount() - 1);
+ XRCCTRL(*this, "btnMoveDown", wxButton)->Enable(list->GetSelection() >= 0 && list->GetSelection() < (int)(list->GetCount()) - 1);
}
void EditArrayOrderDlg::OnMoveUp(wxCommandEvent& event)
@@ -89,7 +89,7 @@
wxListBox* list = XRCCTRL(*this, "lstItems", wxListBox);
int sel = list->GetSelection();
- if (sel < list->GetCount() - 1)
+ if (sel < (int)(list->GetCount()) - 1)
{
wxString tmp = list->GetString(sel);
list->Delete(sel);
@@ -105,7 +105,7 @@
wxListBox* list = XRCCTRL(*this, "lstItems", wxListBox);
m_Array.Clear();
- for (int i = 0; i < list->GetCount(); ++i)
+ for (cbItemCount i = 0; i < list->GetCount(); ++i)
m_Array.Add(list->GetString(i));
}
Index: src/sdk/editarrayfiledlg.cpp
===================================================================
--- src/sdk/editarrayfiledlg.cpp (revision 3832)
+++ src/sdk/editarrayfiledlg.cpp (working copy)
@@ -67,7 +67,7 @@
{
wxListBox* list = XRCCTRL(*this, "lstItems", wxListBox);
m_Array.Clear();
- for (int i = 0; i < list->GetCount(); ++i)
+ for (cbItemCount i = 0; i < list->GetCount(); ++i)
{
m_Array.Add(list->GetString(i));
}
Index: src/sdk/multiselectdlg.cpp
===================================================================
--- src/sdk/multiselectdlg.cpp (revision 3832)
+++ src/sdk/multiselectdlg.cpp (working copy)
@@ -79,7 +79,7 @@
{
int count = 0;
wxCheckListBox* lst = XRCCTRL(*this, "lstItems", wxCheckListBox);
- for (int i = 0; i < lst->GetCount(); ++i)
+ for (cbItemCount i = 0; i < lst->GetCount(); ++i)
{
if (lst->IsChecked(i))
++count;
@@ -93,7 +93,7 @@
{
wxArrayString ret;
wxCheckListBox* lst = XRCCTRL(*this, "lstItems", wxCheckListBox);
- for (int i = 0; i < lst->GetCount(); ++i)
+ for (cbItemCount i = 0; i < lst->GetCount(); ++i)
{
if (lst->IsChecked(i))
ret.Add(lst->GetString(i));
@@ -105,7 +105,7 @@
{
wxArrayInt ret;
wxCheckListBox* lst = XRCCTRL(*this, "lstItems", wxCheckListBox);
- for (int i = 0; i < lst->GetCount(); ++i)
+ for (cbItemCount i = 0; i < lst->GetCount(); ++i)
{
if (lst->IsChecked(i))
ret.Add(i);
@@ -119,7 +119,7 @@
return;
wxArrayString wilds = GetArrayFromString(wild, _T(";"));
wxCheckListBox* lst = XRCCTRL(*this, "lstItems", wxCheckListBox);
- for (int i = 0; i < lst->GetCount(); ++i)
+ for (cbItemCount i = 0; i < lst->GetCount(); ++i)
{
if (clearOld || !lst->IsChecked(i))
{
@@ -167,7 +167,7 @@
void MultiSelectDlg::OnToggle(wxCommandEvent& /*event*/)
{
wxCheckListBox* lst = XRCCTRL(*this, "lstItems", wxCheckListBox);
- for (int i = 0; i < lst->GetCount(); ++i)
+ for (cbItemCount i = 0; i < lst->GetCount(); ++i)
{
lst->Check(i, !lst->IsChecked(i));
}
@@ -177,7 +177,7 @@
void MultiSelectDlg::OnSelectAll(wxCommandEvent& /*event*/)
{
wxCheckListBox* lst = XRCCTRL(*this, "lstItems", wxCheckListBox);
- for (int i = 0; i < lst->GetCount(); ++i)
+ for (cbItemCount i = 0; i < lst->GetCount(); ++i)
{
lst->Check(i, true);
}
@@ -187,7 +187,7 @@
void MultiSelectDlg::OnDeselectAll(wxCommandEvent& /*event*/)
{
wxCheckListBox* lst = XRCCTRL(*this, "lstItems", wxCheckListBox);
- for (int i = 0; i < lst->GetCount(); ++i)
+ for (cbItemCount i = 0; i < lst->GetCount(); ++i)
{
lst->Check(i, false);
}
Index: src/sdk/editorconfigurationdlg.cpp
===================================================================
--- src/sdk/editorconfigurationdlg.cpp (revision 3832)
+++ src/sdk/editorconfigurationdlg.cpp (working copy)
@@ -781,7 +781,7 @@
{
m_AutoCompMap.erase(it);
lstKeyword->Delete(sel);
- if (sel >= lstKeyword->GetCount())
+ if (sel >= ((int)lstKeyword->GetCount()))
download for full patch...
History
Change 1: The return types of the following methods changed from int to unsigned int.
wxControlWithItems::GetCount
wxTreeCtrl::GetCount
Warning 1: comparison between signed and unsigned integer expressions
Solution 1a: cast GetCount() to int.
Solution 1b: use cbItemCount for local variable.
Added to sdk/globals.h
#if wxCHECK_VERSION(2,8,0)
typedef unsigned int cbItemCount;
#else
typedef int cbItemCount;
#endif
Note, this is a low priority patch since it is just to reduce warnings when Code::Blocks is compiled using wxWidgets 2.8.0. But, can you OK the use of the typedef name of cbItemCount so I can work on the later patches that will use it. Thanks. Tim S
Change 1: The return types of the following methods changed from int to unsigned int.
wxControlWithItems::GetCount
wxTreeCtrl::GetCount
Warning 1: comparison between signed and unsigned integer expressions
Solution 1a: cast GetCount() to int.
Solution 1b: use cbItemCount for local variable.
Added to sdk/globals.h
#if wxCHECK_VERSION(2,8,0)
typedef unsigned int cbItemCount;
#else
typedef int cbItemCount;
#endif
Change 2: Signature changed for constructor of wxFontDialog.
Solution 3: Added #if/else/endif block for new Signature.
Change 3: wxRect::Contains has been depreciated/obsoleted.
Solution 3: Replaced with wxRect::Inside
Change 4: wxDC::BeginDrawing & wxDC::EndDrawing has been depreciated/obsoleted.
Solution 4: Removed them.
Change 5: wxStartTimer and wxGetElapsedTime have been depreciated/obsoleted.
Solution 5: replaced them with wxGetLocalTimeMillis and added code.
Change 1: The return types of the following methods changed from int to unsigned int.
wxControlWithItems::GetCount
wxTreeCtrl::GetCount
Warning 1: comparison between signed and unsigned integer expressions
Solution 1a: cast GetCount() to int.
Solution 1b: use cbItemCount for local variable.
Added to sdk/globals.h
#if wxCHECK_VERSION(2,8,0)
typedef unsigned int cbItemCount;
#else
typedef int cbItemCount;
#endif
Change 2: Signature changed for constructor of wxFontDialog.
Solution 3: Added #if/else/endif block for new Signature.
Change 3: wxRect::Inside has been depreciated/obsoleted.
Solution 3: Replaced with wxRect::Contains
Change 4: wxDC::BeginDrawing & wxDC::EndDrawing has been depreciated/obsoleted.
Solution 4: Removed them.
Change 5: wxStartTimer and wxGetElapsedTime have been depreciated/obsoleted.
Solution 5: replaced them with wxGetLocalTimeMillis and added code.
Filename: SDK_Warning_Patch-unix.patch
Purpose: Reduce the number of Compiler warnings for CB SDK when linked against wxWidgets 2.8
Note: Some code was moved to [ Patch #1908 ] Patch SDK files for wxW28 with disable_compat26
Change 1: The return types of the following methods changed from int to unsigned int.
wxControlWithItems::GetCount
wxTreeCtrl::GetCount
Warning 1: comparison between signed and unsigned integer expressions
Solution 1a: cast GetCount() to int.
Solution 1b: use cbItemCount for local variable.
Added to sdk/globals.h
#if wxCHECK_VERSION(2,8,0)
typedef unsigned int cbItemCount;
#else
typedef int cbItemCount;
#endif
Can you check if this patch still applies?
I 've built C::B using wx2.8 (but with wx2.6-compat enabled) and I don't recall seeing any wx2.8 specific warnings. Maybe they were gone with the previous wx2.8 patches we applied?
The main cause of warnings is the wxControlWithItems::GetCount change.
Tim S
Change 1: The return types of the following methods changed from int to unsigned int.
wxControlWithItems::GetCount
wxTreeCtrl::GetCount
Warning 1: comparison between signed and unsigned integer expressions
Solution 1a: cast GetCount() to int.
Solution 1b: use cbItemCount for local variable.
Added to sdk/globals.h
#if wxCHECK_VERSION(2,8,0)
typedef unsigned int cbItemCount;
#else
typedef int cbItemCount;
#endif
Updated to SVN 3832;
Please see thread http://forums.codeblocks.org/index.php/topic,5665.0.html
for more details. Tim S
Please close use Patch #1982 instead about the same, but I am tired of updating this patch. Tim S
[ Patch #1982 ] Eliminate signed/unsigned compiler warnings
Closed on request from submitter.