diff --git a/demos/forty/pile.cpp b/demos/forty/pile.cpp index a04978bfed..0ddab95dfc 100644 --- a/demos/forty/pile.cpp +++ b/demos/forty/pile.cpp @@ -155,13 +155,14 @@ Card* Pile::RemoveTopCard() //+-------------------------------------------------------------+ Card* Pile::RemoveTopCard(wxDC& dc, int xOffset, int yOffset) { - int topX, topY, x, y; + int topX, topY; GetTopCardPos(topX, topY); Card* card = RemoveTopCard(); if (card) { + int x, y; card->Erase(dc, topX - xOffset, topY - yOffset); GetTopCardPos(x, y); if (m_topCard < 0) diff --git a/demos/life/game.cpp b/demos/life/game.cpp index b509a259f5..bf5bb2461e 100644 --- a/demos/life/game.cpp +++ b/demos/life/game.cpp @@ -584,7 +584,7 @@ extern int g_tab2[]; bool Life::NextTic() { LifeCellBox *c, *up, *dn, *lf, *rt; - wxUint32 t1, t2, t3, t4; + wxUint32 t1, t2; bool changed = false; m_numcells = 0; @@ -833,6 +833,7 @@ bool Life::NextTic() t1 = 0; t2 = 0; + wxUint32 t3, t4; t3 = c->m_live1; c->m_old1 = t3; diff --git a/demos/poem/wxpoem.cpp b/demos/poem/wxpoem.cpp index 0990137dec..d51be491a3 100644 --- a/demos/poem/wxpoem.cpp +++ b/demos/poem/wxpoem.cpp @@ -148,7 +148,6 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y) int i = pages[current_page]; int ch = -1; int y = 0; - int j; wxChar *line_ptr; int curr_width = 0; bool page_break = false; @@ -204,6 +203,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y) while (ch != 0 && !page_break) { + int j; j = 0; #if defined(__WXMSW__) || defined(__WXMAC__) while (((ch = poem_buffer[i]) != 13) && (ch != 0)) @@ -464,8 +464,6 @@ void MainWindow::PreviousPage(void) // Search for a string void MainWindow::Search(bool ask) { - long position; - if (ask || m_searchString.empty()) { wxString s = wxGetTextFromUser( wxT("Enter search string"), wxT("Search"), m_searchString); @@ -488,6 +486,7 @@ void MainWindow::Search(bool ask) if (!m_searchString.empty() && search_ok) { + long position; position = DoSearch(); if (position > -1) { diff --git a/samples/richtext/richtext.cpp b/samples/richtext/richtext.cpp index 63ad46d12d..cc6582e576 100644 --- a/samples/richtext/richtext.cpp +++ b/samples/richtext/richtext.cpp @@ -1613,11 +1613,11 @@ void MyFrame::OnUpdateFormat(wxUpdateUIEvent& event) void MyFrame::OnUpdateImage(wxUpdateUIEvent& event) { wxRichTextRange range; - wxRichTextObject *obj; range = m_richTextCtrl->GetSelectionRange(); if (range.ToInternal().GetLength() == 1) { + wxRichTextObject *obj; obj = m_richTextCtrl->GetFocusObject()->GetLeafObjectAtPosition(range.GetStart()); if (obj && obj->IsKindOf(CLASSINFO(wxRichTextImage))) { diff --git a/samples/vscroll/vstest.cpp b/samples/vscroll/vstest.cpp index d684059885..bd9f911ebe 100644 --- a/samples/vscroll/vstest.cpp +++ b/samples/vscroll/vstest.cpp @@ -343,13 +343,12 @@ public: wxSize clientSize = GetClientSize(); wxCoord y = 0; - wxCoord x = 0; for ( size_t row = rowFirst; row < rowLast; row++ ) { wxCoord rowHeight = OnGetRowHeight(row); dc.DrawLine(0, y, clientSize.GetWidth(), y); - x = 0; + wxCoord x = 0; for ( size_t col = columnFirst; col < columnLast; col++ ) { wxCoord colWidth = OnGetColumnWidth(col); diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp index 1e7a55062f..ad0ea7ec59 100644 --- a/src/aui/auibar.cpp +++ b/src/aui/auibar.cpp @@ -1571,12 +1571,13 @@ void wxAuiToolBar::ToggleTool(int tool_id, bool state) { if (tool->m_kind == wxITEM_RADIO) { - int i, idx, count; + int idx, count; idx = GetToolIndex(tool_id); count = (int)m_items.GetCount(); if (idx >= 0 && idx < count) { + int i; for (i = idx + 1; i < count; ++i) { if (m_items[i].m_kind != wxITEM_RADIO) diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 35518fd79e..aadeb4a519 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -1674,7 +1674,7 @@ void wxAuiManager::GetPanePositionsAndSizes(wxAuiDockInfo& dock, positions.Empty(); sizes.Empty(); - int offset, action_pane = -1; + int action_pane = -1; int pane_i, pane_count = dock.panes.GetCount(); // find the pane marked as our action pane @@ -1737,7 +1737,7 @@ void wxAuiManager::GetPanePositionsAndSizes(wxAuiDockInfo& dock, // if the dock mode is fixed, make sure none of the panes // overlap; we will bump panes that overlap - offset = 0; + int offset = 0; for (pane_i = action_pane; pane_i < pane_count; ++pane_i) { int amount = positions[pane_i] - offset; diff --git a/src/aui/tabartgtk.cpp b/src/aui/tabartgtk.cpp index 419ff06eea..c97caa7471 100644 --- a/src/aui/tabartgtk.cpp +++ b/src/aui/tabartgtk.cpp @@ -308,9 +308,9 @@ void wxAuiGtkTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& p wxCoord textX = tab_rect.x + padding + style_notebook->xthickness; - int bitmap_offset = 0; if (page.bitmap.IsOk()) { + int bitmap_offset; bitmap_offset = textX; // draw bitmap diff --git a/src/common/arrstr.cpp b/src/common/arrstr.cpp index e78f8259b5..e3ebe2e43e 100644 --- a/src/common/arrstr.cpp +++ b/src/common/arrstr.cpp @@ -370,13 +370,14 @@ int wxArrayString::Index(const wxString& str, bool bCase, bool bFromEnd) const wxASSERT_MSG( bCase && !bFromEnd, wxT("search parameters ignored for auto sorted array") ); - size_t i, + size_t lo = 0, hi = m_nCount; - int res; while ( lo < hi ) { + size_t i; i = (lo + hi)/2; + int res; res = str.compare(m_pItems[i]); if ( res < 0 ) hi = i; @@ -416,13 +417,14 @@ size_t wxArrayString::Add(const wxString& str, size_t nInsert) { if ( m_autoSort ) { // insert the string at the correct position to keep the array sorted - size_t i, + size_t lo = 0, hi = m_nCount; - int res; while ( lo < hi ) { + size_t i; i = (lo + hi)/2; + int res; res = m_compareFunction ? m_compareFunction(str, m_pItems[i]) : str.Cmp(m_pItems[i]); if ( res < 0 ) hi = i; diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 47000e5f1f..916afb07ec 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -792,13 +792,13 @@ static wxPointList wx_spline_point_list; void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4, double b4) { - double xmid, ymid; double x1, y1, x2, y2, x3, y3, x4, y4; wx_clear_stack(); wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4); while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) { + double xmid, ymid; xmid = (double)half(x2, x3); ymid = (double)half(y2, y3); if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD && @@ -888,7 +888,7 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points ) wxCHECK_RET( IsOk(), wxT("invalid window dc") ); const wxPoint *p; - double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4; + double cx1, cy1, cx2, cy2; double x1, y1, x2, y2; wxPointList::compatibility_iterator node = points->GetFirst(); @@ -919,6 +919,7 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points ) #endif // !wxUSE_STD_CONTAINERS ) { + double cx3, cy3, cx4, cy4; p = node->GetData(); x1 = x2; y1 = y2; diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 9f8ffb9936..8e25ed4334 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -911,7 +911,6 @@ bool wxStandardDialogLayoutAdapter::DoFitWithScrolling(wxDialog* dialog, wxWindo wxSize windowSize, displaySize; int scrollFlags = DoMustScroll(dialog, windowSize, displaySize); - int scrollBarSize = 20; if (scrollFlags) { @@ -922,6 +921,7 @@ bool wxStandardDialogLayoutAdapter::DoFitWithScrolling(wxDialog* dialog, wxWindo if (windows.GetCount() != 0) { // Allow extra for a scrollbar, assuming we resizing in one direction only. + int scrollBarSize = 20; if ((resizeVertically && !resizeHorizontally) && (windowSize.x < (displaySize.x - scrollBarSize))) scrollBarExtraX = scrollBarSize; if ((resizeHorizontally && !resizeVertically) && (windowSize.y < (displaySize.y - scrollBarSize))) diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 8f958f4777..241fa2cf42 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -2235,11 +2235,10 @@ bool wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream) if ( !file.IsOpened() ) return false; - char buf[4096]; - - size_t nRead; do { + char buf[4096]; + size_t nRead; nRead = file.Read(buf, WXSIZEOF(buf)); if ( file.Error() ) return false; diff --git a/src/common/encconv.cpp b/src/common/encconv.cpp index b9094288ed..f9f41ef9c2 100644 --- a/src/common/encconv.cpp +++ b/src/common/encconv.cpp @@ -157,12 +157,12 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e else // output !Unicode { CharsetItem *rev = BuildReverseTable(out_tbl); - CharsetItem *item; CharsetItem key; for (i = 0; i < 128; i++) { key.u = in_tbl[i]; + CharsetItem* item; item = (CharsetItem*) bsearch(&key, rev, 128, sizeof(CharsetItem), CompareCharsetItems); if (item == NULL && method == wxCONVERT_SUBSTITUTE) item = (CharsetItem*) bsearch(&key, encoding_unicode_fallback, diff --git a/src/common/ffile.cpp b/src/common/ffile.cpp index ede1e9a157..abccca0abb 100644 --- a/src/common/ffile.cpp +++ b/src/common/ffile.cpp @@ -263,11 +263,11 @@ wxFileOffset wxFFile::Length() const wxCHECK_MSG( IsOpened(), wxInvalidOffset, wxT("wxFFile::Length(): file is closed!") ); - wxFFile& self = *const_cast(this); - wxFileOffset posOld = Tell(); if ( posOld != wxInvalidOffset ) { + wxFFile& self = *const_cast(this); + if ( self.SeekEnd() ) { wxFileOffset len = Tell(); diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 77fa9a8103..54262d8038 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -1535,16 +1535,17 @@ wxString wxFileConfigGroup::GetFullName() const wxFileConfigEntry * wxFileConfigGroup::FindEntry(const wxString& name) const { - size_t i, + size_t lo = 0, hi = m_aEntries.GetCount(); - int res; wxFileConfigEntry *pEntry; while ( lo < hi ) { + size_t i; i = (lo + hi)/2; pEntry = m_aEntries[i]; + int res; #if wxCONFIG_CASE_SENSITIVE res = pEntry->Name().compare(name); #else @@ -1565,16 +1566,17 @@ wxFileConfigGroup::FindEntry(const wxString& name) const wxFileConfigGroup * wxFileConfigGroup::FindSubgroup(const wxString& name) const { - size_t i, + size_t lo = 0, hi = m_aSubgroups.GetCount(); - int res; wxFileConfigGroup *pGroup; while ( lo < hi ) { + size_t i; i = (lo + hi)/2; pGroup = m_aSubgroups[i]; + int res; #if wxCONFIG_CASE_SENSITIVE res = pGroup->Name().compare(name); #else diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index 232f41aa40..8406b93898 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -58,12 +58,12 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) { wxString ext, mime; wxString loc = GetRightLocation(location); - wxChar c; int l = loc.length(), l2; l2 = l; for (int i = l-1; i >= 0; i--) { + wxChar c; c = loc[(unsigned int) i]; if ( c == wxT('#') ) l2 = i + 1; @@ -234,10 +234,10 @@ wxString wxFileSystemHandler::GetRightLocation(const wxString& location) /* static */ wxString wxFileSystemHandler::GetAnchor(const wxString& location) { - wxChar c; int l = location.length(); for (int i = l-1; i >= 0; i--) { + wxChar c; c = location[i]; if (c == wxT('#')) return location.Right(l-i-1); @@ -384,7 +384,6 @@ static wxString MakeCorrectPath(const wxString& path) void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir) { - int i, pathpos = -1; m_Path = MakeCorrectPath(location); @@ -393,9 +392,9 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir) if (!m_Path.empty() && m_Path.Last() != wxT('/') && m_Path.Last() != wxT(':')) m_Path << wxT('/'); } - else { + int i, pathpos = -1; for (i = m_Path.length()-1; i >= 0; i--) { if (m_Path[(unsigned int) i] == wxT('/')) diff --git a/src/common/gbsizer.cpp b/src/common/gbsizer.cpp index 7ee9b8273a..1f4e7d25cf 100644 --- a/src/common/gbsizer.cpp +++ b/src/common/gbsizer.cpp @@ -546,11 +546,11 @@ void wxGridBagSizer::RepositionChildren(const wxSize& minSize) wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); while (node) { - int row, col, endrow, endcol; wxGBSizerItem* item = (wxGBSizerItem*)node->GetData(); if ( item->IsShown() ) { + int row, col, endrow, endcol; item->GetPos(row, col); item->GetEndPos(endrow, endcol); diff --git a/src/common/gifdecod.cpp b/src/common/gifdecod.cpp index 923aeb814c..74d5b1cfa1 100644 --- a/src/common/gifdecod.cpp +++ b/src/common/gifdecod.cpp @@ -376,7 +376,7 @@ wxGIFDecoder::dgif(wxInputStream& stream, GIFImage *img, int interl, int bits) int pos; // index into decompresion stack unsigned int x, y; // position in image buffer - int code, readcode, lastcode, abcabca; + int code, lastcode, abcabca; // these won't change ab_clr = (1 << bits); @@ -399,6 +399,7 @@ wxGIFDecoder::dgif(wxInputStream& stream, GIFImage *img, int interl, int bits) do { // get next code + int readcode; readcode = code = getcode(stream, ab_bits, ab_fin); // end of image? diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp index 41e9e86dee..ce8a133658 100644 --- a/src/common/imagbmp.cpp +++ b/src/common/imagbmp.cpp @@ -1004,7 +1004,6 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream, { wxUint16 aWord; wxInt32 dbuf[4]; - wxInt8 bbuf[4]; // offset to bitmap data wxFileOffset offset; @@ -1012,6 +1011,7 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream, wxInt32 hdrSize; if ( IsBmp ) { + wxInt8 bbuf[4]; // read the header off the .BMP format file if ( !stream.ReadAll(bbuf, 2) || !stream.ReadAll(dbuf, 16) ) diff --git a/src/common/image.cpp b/src/common/image.cpp index daae5d3427..a6575bb25c 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1339,7 +1339,6 @@ wxImage wxImage::Rotate90( bool clockwise ) const if ( source_alpha ) { unsigned char *alpha_data = image.GetAlpha(); - unsigned char *target_alpha = 0 ; for (long ii = 0; ii < width; ) { @@ -1351,6 +1350,7 @@ wxImage wxImage::Rotate90( bool clockwise ) const for (long i = ii; i < next_ii; i++) { + unsigned char* target_alpha; if ( clockwise ) { target_alpha = alpha_data + (i+1)*height - j - 1; @@ -1929,10 +1929,10 @@ void wxImage::SetRGB( const wxRect& rect_, unsigned char r, unsigned char g, uns x2 = rect.GetRight() + 1, y2 = rect.GetBottom() + 1; - unsigned char *data wxDUMMY_INITIALIZE(NULL); int x, y, width = GetWidth(); for (y = y1; y < y2; y++) { + unsigned char* data; data = M_IMGDATA->m_data + (y*width + x1)*3; for (x = x1; x < x2; x++) { @@ -3236,8 +3236,6 @@ void wxImage::RotateHue(double angle) { AllocExclusive(); - unsigned char *srcBytePtr; - unsigned char *dstBytePtr; unsigned long count; wxImage::HSVValue hsv; wxImage::RGBValue rgb; @@ -3246,6 +3244,8 @@ void wxImage::RotateHue(double angle) count = M_IMGDATA->m_width * M_IMGDATA->m_height; if ( count > 0 && !wxIsNullDouble(angle) ) { + unsigned char* srcBytePtr; + unsigned char* dstBytePtr; srcBytePtr = M_IMGDATA->m_data; dstBytePtr = srcBytePtr; do @@ -3448,9 +3448,8 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) const { wxHashTable h; wxObject dummy; - unsigned char r, g, b; unsigned char *p; - unsigned long size, nentries, key; + unsigned long size, nentries; p = GetData(); size = static_cast(GetWidth()) * GetHeight(); @@ -3458,6 +3457,8 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) const for (unsigned long j = 0; (j < size) && (nentries <= stopafter) ; j++) { + unsigned char r, g, b; + unsigned long key; r = *(p++); g = *(p++); b = *(p++); @@ -3483,9 +3484,9 @@ unsigned long wxImage::ComputeHistogram( wxImageHistogram &h ) const const unsigned long size = static_cast(GetWidth()) * GetHeight(); - unsigned char r, g, b; for ( unsigned long n = 0; n < size; n++ ) { + unsigned char r, g, b; r = *p++; g = *p++; b = *p++; diff --git a/src/common/imaggif.cpp b/src/common/imaggif.cpp index c75775fb15..a14cb2f26a 100644 --- a/src/common/imaggif.cpp +++ b/src/common/imaggif.cpp @@ -394,9 +394,7 @@ bool wxGIFHandler::SetupCompress(wxOutputStream *stream, int bpp) bool wxGIFHandler::CompressLine(wxOutputStream *stream, const wxUint8 *line, int lineLen) { - int i = 0, crntCode, newCode; - unsigned long newKey; - wxUint8 pixel; + int i = 0, crntCode; if (m_crntCode == FIRST_CODE) // It's first time! crntCode = line[i++]; else @@ -405,10 +403,13 @@ bool wxGIFHandler::CompressLine(wxOutputStream *stream, while (i < lineLen) { // Decode lineLen items. + wxUint8 pixel; pixel = line[i++]; // Get next pixel from stream. // Form a new unique key to search hash table for the code combines // crntCode as Prefix string with Pixel as postfix char. + unsigned long newKey; newKey = (((unsigned long) crntCode) << 8) + pixel; + int newCode; if ((newCode = ExistsHashTable(newKey)) >= 0) { // This Key is already there, or the string is old one, so diff --git a/src/common/imagpcx.cpp b/src/common/imagpcx.cpp index 41a3f2d8bb..ea293f0b06 100644 --- a/src/common/imagpcx.cpp +++ b/src/common/imagpcx.cpp @@ -44,7 +44,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPCXHandler,wxImageHandler); static void RLEencode(unsigned char *p, unsigned int size, wxOutputStream& s) { - unsigned int data, last, cont; + unsigned int last, cont; // Write 'size' bytes. The PCX official specs say there will be // a decoding break at the end of each scanline, so in order to @@ -57,6 +57,7 @@ void RLEencode(unsigned char *p, unsigned int size, wxOutputStream& s) while (size-- > 0) { + unsigned data; data = (unsigned char) *(p++); // Up to 63 bytes with the same value can be stored using @@ -266,8 +267,6 @@ int ReadPCX(wxImage *image, wxInputStream& stream) if (format == wxPCX_8BIT) { - unsigned char index; - if (stream.GetC() != 12) return wxPCX_INVFORMAT; @@ -276,6 +275,7 @@ int ReadPCX(wxImage *image, wxInputStream& stream) p = image->GetData(); for (unsigned long k = height * width; k; k--) { + unsigned char index; index = *p; *(p++) = pal[3 * index]; *(p++) = pal[3 * index + 1]; @@ -310,7 +310,6 @@ static int SavePCX(wxImage *image, wxOutputStream& stream) { unsigned char hdr[128]; // PCX header - unsigned char pal[768]; // palette for 8 bit images unsigned char *p; // space to store one scanline unsigned char *src; // pointer into wxImage data unsigned int width, height; // size of the image @@ -376,10 +375,9 @@ int SavePCX(wxImage *image, wxOutputStream& stream) { case wxPCX_8BIT: { - unsigned char r, g, b; - for (i = 0; i < width; i++) { + unsigned char r, g, b; r = *(src++); g = *(src++); b = *(src++); @@ -409,15 +407,15 @@ int SavePCX(wxImage *image, wxOutputStream& stream) // For 8 bit images, build the palette and write it to the stream: if (format == wxPCX_8BIT) { + unsigned char pal[768]; // zero unused colours memset(pal, 0, sizeof(pal)); - unsigned long index; - for (wxImageHistogram::iterator entry = histogram.begin(); entry != histogram.end(); ++entry ) { key = entry->first; + unsigned long index; index = entry->second.index; pal[3 * index] = (unsigned char)(key >> 16); pal[3 * index + 1] = (unsigned char)(key >> 8); diff --git a/src/common/imagpnm.cpp b/src/common/imagpnm.cpp index de2bab1d76..af6848426d 100644 --- a/src/common/imagpnm.cpp +++ b/src/common/imagpnm.cpp @@ -97,9 +97,10 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose if (c=='2') // Ascii GREY { - wxUint32 value, size=width*height; + wxUint32 size=width*height; for (wxUint32 i=0; i> 5; *(dst++) = temp; @@ -571,10 +570,9 @@ int ReadTGA(wxImage* image, wxInputStream& stream) case 16: { - unsigned char temp; - for (unsigned long index = 0; index < imageSize; index += pixelSize) { + unsigned char temp; temp = (imageData[index + 1] & 0x7c) << 1; temp |= temp >> 5; *(dst++) = temp; diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 47428befa5..e62a8b3c3d 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -1087,10 +1087,10 @@ wxString wxMenuBarBase::GetHelpString(int itemid) const void wxMenuBarBase::UpdateMenus() { - wxMenu* menu; int nCount = GetMenuCount(); for (int n = 0; n < nCount; n++) { + wxMenu* menu; menu = GetMenu( n ); if (menu != NULL) menu->UpdateUI(); diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 560322317a..e839a3a0d3 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -1195,7 +1195,6 @@ size_t wxMBConvUTF8::ToWChar(wchar_t *buf, size_t n, while ((isNulTerminated ? *psz : srcLen--) && ((!buf) || (len < n))) { const char *opsz = psz; - bool invalid = false; unsigned char cc = *psz++, fc = cc; unsigned cnt; for (cnt = 0; fc & 0x80; cnt++) @@ -1219,6 +1218,7 @@ size_t wxMBConvUTF8::ToWChar(wchar_t *buf, size_t n, } else { + bool invalid = false; cnt--; if (!cnt) { diff --git a/src/common/tarstrm.cpp b/src/common/tarstrm.cpp index f2f7109f28..178634000f 100644 --- a/src/common/tarstrm.cpp +++ b/src/common/tarstrm.cpp @@ -1338,9 +1338,9 @@ wxString wxTarOutputStream::PaxHeaderPath(const wxString& format, ret.reserve(format.length() + path.length() + 16); size_t begin = 0; - size_t end; for (;;) { + size_t end; end = format.find('%', begin); if (end == wxString::npos || end + 1 >= format.length()) break; diff --git a/src/common/translation.cpp b/src/common/translation.cpp index bf92ed2942..97162940ac 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -1478,9 +1478,9 @@ wxTranslations::~wxTranslations() delete m_loader; // free catalogs memory - wxMsgCatalog *pTmpCat; while ( m_pMsgCat != NULL ) { + wxMsgCatalog* pTmpCat; pTmpCat = m_pMsgCat; m_pMsgCat = m_pMsgCat->m_pNext; delete pTmpCat; diff --git a/src/common/xpmdecod.cpp b/src/common/xpmdecod.cpp index 7c7df92bad..b0571819fc 100644 --- a/src/common/xpmdecod.cpp +++ b/src/common/xpmdecod.cpp @@ -526,9 +526,6 @@ static unsigned char ParseHexadecimal(char digit1, char digit2) static bool GetRGBFromName(const char *inname, bool *isNone, unsigned char *r, unsigned char*g, unsigned char *b) { - int left, right, middle; - int cmp; - wxUint32 rgbVal; char *name; char *grey, *p; @@ -583,14 +580,18 @@ static bool GetRGBFromName(const char *inname, bool *isNone, found = false; // binary search: + int left, right; left = 0; right = numTheRGBRecords - 1; do { + int middle; middle = (left + right) / 2; + int cmp; cmp = strcmp(name, theRGBRecords[middle].name); if ( cmp == 0 ) { + wxUint32 rgbVal; rgbVal = theRGBRecords[middle].rgb; *r = (unsigned char)((rgbVal >> 16) & 0xFF); *g = (unsigned char)((rgbVal >> 8) & 0xFF); @@ -663,7 +664,6 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) unsigned width, height, colors_cnt, chars_per_pixel; size_t i, j, i_key; char key[64]; - const char *clr_def; wxXPMColourMap clr_tbl; wxXPMColourMap::iterator it; wxString maskKey; @@ -709,6 +709,7 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) for (i_key = 0; i_key < chars_per_pixel; i_key++) key[i_key] = xmpColLine[i_key]; + const char *clr_def; clr_def = ParseColor(xmpColLine + chars_per_pixel); if ( clr_def == NULL ) diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 9787ed6fc6..503fba2d44 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -1471,7 +1471,7 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points ) // a and b are not used //double a, b; - double c, d, x1, y1, x2, y2, x3, y3; + double c, d, x1, y1, x3, y3; wxPoint *p, *q; wxPointList::compatibility_iterator node = points->GetFirst(); @@ -1509,6 +1509,7 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points ) node = node->GetNext(); while (node) { + double x2, y2; q = node->GetData(); x1 = x3; diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 306dd35ec9..f79ad3035a 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1304,16 +1304,17 @@ void wxGridStringTable::SetValue( int row, int col, const wxString& value ) void wxGridStringTable::Clear() { - int row, col; - int numRows, numCols; - + int numRows; numRows = m_data.GetCount(); if ( numRows > 0 ) { + int numCols; numCols = m_data[0].GetCount(); + int row; for ( row = 0; row < numRows; row++ ) { + int col; for ( col = 0; col < numCols; col++ ) { m_data[row][col].clear(); @@ -3167,10 +3168,10 @@ wxArrayInt wxGrid::CalcColLabelsExposed( const wxRegion& reg ) const // find the cells within these bounds // - int col; int colPos; for ( colPos = GetColPos( internalXToCol(left) ); colPos < m_numCols; colPos++ ) { + int col; col = GetColAt( colPos ); if ( GetColRight(col) < left ) @@ -5355,11 +5356,11 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells ) return; int i, numCells = cells.GetCount(); - int row, col, cell_rows, cell_cols; wxGridCellCoordsArray redrawCells; for ( i = numCells - 1; i >= 0; i-- ) { + int row, col, cell_rows, cell_cols; row = cells[i].GetRow(); col = cells[i].GetCol(); GetCellSize( row, col, &cell_rows, &cell_cols ); @@ -6141,12 +6142,12 @@ void wxGrid::DrawTextRectangle(wxDC& dc, void wxGrid::StringToLines( const wxString& value, wxArrayString& lines ) const { int startPos = 0; - int pos; wxString eol = wxTextFile::GetEOL( wxTextFileType_Unix ); wxString tVal = wxTextFile::Translate( value, wxTextFileType_Unix ); while ( startPos < (int)tVal.length() ) { + int pos; pos = tVal.Mid(startPos).Find( eol ); if ( pos < 0 ) { @@ -6774,7 +6775,6 @@ bool wxGrid::IsVisible( int row, int col, bool wholeCellVisible ) const // void wxGrid::MakeCellVisible( int row, int col ) { - int i; int xpos = -1, ypos = -1; if ( row >= 0 && row < m_numRows && @@ -6799,6 +6799,7 @@ void wxGrid::MakeCellVisible( int row, int col ) { int h = r.GetHeight(); ypos = r.GetTop(); + int i; for ( i = row - 1; i >= 0; i-- ) { int rowHeight = GetRowHeight(i); diff --git a/src/generic/gridctrl.cpp b/src/generic/gridctrl.cpp index e4f8df8ffd..f6df548502 100644 --- a/src/generic/gridctrl.cpp +++ b/src/generic/gridctrl.cpp @@ -597,10 +597,9 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid, int hAlign, vAlign; attr.GetAlignment(&hAlign, &vAlign); - int overflowCols = 0; - if (attr.GetOverflow()) { + int overflowCols = 0; int cols = grid.GetNumberCols(); int best_width = GetBestSize(grid,attr,dc,row,col).GetWidth(); int cell_rows, cell_cols; diff --git a/src/generic/helpext.cpp b/src/generic/helpext.cpp index 971c2ee875..a8928b63f3 100644 --- a/src/generic/helpext.cpp +++ b/src/generic/helpext.cpp @@ -349,9 +349,9 @@ bool wxExtHelpController::DisplaySection(int sectionNo) wxBusyCursor b; // display a busy cursor wxList::compatibility_iterator node = m_MapList->GetFirst(); - wxExtHelpMapEntry *entry; while (node) { + wxExtHelpMapEntry* entry; entry = (wxExtHelpMapEntry *)node->GetData(); if (entry->entryid == sectionNo) return DisplayHelp(entry->url); diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index c60d83f45e..0394bfaba7 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -3129,10 +3129,13 @@ void wxListMainWindow::SetImageList( wxImageList *imageList, int which ) m_dirty = true; // calc the spacing from the icon size - int width = 0, height = 0; + int width = 0; if ((imageList) && (imageList->GetImageCount()) ) + { + int height; imageList->GetSize(0, width, height); + } if (which == wxIMAGE_LIST_NORMAL) { @@ -4052,16 +4055,16 @@ void wxListMainWindow::DeleteItem( long lindex ) // we're deleting contain the Max Column Width wxListLineData * const line = GetLine(index); wxListItemDataList::compatibility_iterator n; - wxListItemData *itemData; wxListItem item; - int itemWidth; for (size_t i = 0; i < m_columns.GetCount(); i++) { n = line->m_items.Item( i ); + wxListItemData* itemData; itemData = n->GetData(); itemData->GetItem(item); + int itemWidth; itemWidth = GetItemWidthWithImage(&item); wxColWidthInfo *pWidthInfo = m_aColWidths.Item(i); diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 6d0f120f46..761aa65e20 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -709,21 +709,21 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest(const wxPoint& point, if ((point.x >= m_x) && (point.x <= m_x+m_width)) { int image_w = -1; - int image_h; // assuming every image (normal and selected) has the same size! if ( (GetImage() != NO_IMAGE) && theCtrl->m_imageListNormal ) { + int image_h; theCtrl->m_imageListNormal->GetSize(GetImage(), image_w, image_h); } int state_w = -1; - int state_h; if ( (GetState() != wxTREE_ITEMSTATE_NONE) && theCtrl->m_imageListState ) { + int state_h; theCtrl->m_imageListState->GetSize(GetState(), state_w, state_h); } @@ -3419,18 +3419,20 @@ bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item, if ( textOnly ) { - int image_h = 0, image_w = 0; + int image_w = 0; int image = ((wxGenericTreeItem*) item.m_pItem)->GetCurrentImage(); if ( image != NO_IMAGE && m_imageListNormal ) { + int image_h; m_imageListNormal->GetSize( image, image_w, image_h ); image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; } - int state_h = 0, state_w = 0; + int state_w = 0; int state = ((wxGenericTreeItem*) item.m_pItem)->GetState(); if ( state != wxTREE_ITEMSTATE_NONE && m_imageListState ) { + int state_h; m_imageListState->GetSize( state, state_w, state_h ); if ( image_w != 0 ) state_w += MARGIN_BETWEEN_STATE_AND_IMAGE; diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 954fb060a0..095bbe4e35 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -677,12 +677,12 @@ int wxListBox::GetSelections( wxArrayInt& aSelections ) const aSelections.Empty(); - int i = 0; GtkTreeIter iter; GtkTreeSelection* selection = gtk_tree_view_get_selection(m_treeview); if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(m_liststore), &iter)) { //gtk_tree_selection_get_selected_rows is GTK 2.2+ so iter instead + int i = 0; do { if (gtk_tree_selection_iter_is_selected(selection, &iter)) diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index f972a6d202..4dc2dad80c 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -1699,7 +1699,7 @@ void wxGtkPrinterDCImpl::DoDrawSpline(const wxPointList *points) { SetPen (m_pen); - double c, d, x1, y1, x2, y2, x3, y3; + double c, d, x1, y1, x3, y3; wxPoint *p, *q; wxPointList::compatibility_iterator node = points->GetFirst(); @@ -1726,6 +1726,7 @@ void wxGtkPrinterDCImpl::DoDrawSpline(const wxPointList *points) node = node->GetNext(); while (node) { + double x2, y2; q = node->GetData(); x1 = x3; diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index fe47602ac6..54af9c1def 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -409,11 +409,12 @@ au_check_word( GtkTextIter *s, GtkTextIter *e ) gtk_text_iter_forward_char(&end); wxGtkString text(gtk_text_iter_get_text( &start, &end )); - size_t len = strlen(text), prefix_len; + size_t len = strlen(text); size_t n; for( n = 0; n < WXSIZEOF(URIPrefixes); ++n ) { + size_t prefix_len; prefix_len = strlen(URIPrefixes[n]); if((len > prefix_len) && !wxStrnicmp(text, URIPrefixes[n], prefix_len)) break; diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index 3a93267e49..05af129704 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -732,10 +732,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x) if (!has_non_ascii) { wxFileSystem fsys; - wxFSFile *f; // 1. try to open given file: for (i = 0; i < cnt; i++) { + wxFSFile *f; f = fsys.OpenFile(m_bookRecords[i].GetFullPath(x)); if (f) { diff --git a/src/html/helpwnd.cpp b/src/html/helpwnd.cpp index 88dca44361..aa1d9d8ed7 100644 --- a/src/html/helpwnd.cpp +++ b/src/html/helpwnd.cpp @@ -861,9 +861,9 @@ bool wxHtmlHelpWindow::KeywordSearch(const wxString& keyword, wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE); #endif - int curi; while (status.IsActive()) { + int curi; curi = status.GetCurIndex(); if (curi % 32 == 0 #if wxUSE_PROGRESSDLG @@ -1092,13 +1092,13 @@ void wxHtmlHelpWindow::ReadCustomization(wxConfigBase *cfg, const wxString& path m_FontSize = cfg->Read(wxT("hcBaseFontSize"), m_FontSize); { - int i; int cnt; wxString val, s; cnt = cfg->Read(wxT("hcBookmarksCnt"), 0L); if (cnt != 0) { + int i; m_BookmarksNames.Clear(); m_BookmarksPages.Clear(); if (m_Bookmarks) @@ -1296,7 +1296,6 @@ wxEND_EVENT_TABLE() void wxHtmlHelpWindow::OptionsDialog() { wxHtmlHelpWindowOptionsDialog dlg(this); - unsigned i; if (m_NormalFonts == NULL) { @@ -1331,6 +1330,7 @@ void wxHtmlHelpWindow::OptionsDialog() // Lock updates to the choice controls before inserting potentially many // items into them until the end of this block. { + unsigned i; wxWindowUpdateLocker lockNormalFont(dlg.NormalFont); wxWindowUpdateLocker lockFixedFont(dlg.FixedFont); diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index 298df16443..8532699459 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -730,8 +730,8 @@ void wxHtmlContainerCell::Layout(int w) wxHtmlCell *nextCell; long xpos = 0, ypos = m_IndentTop; - int xdelta = 0, ybasicpos = 0, ydiff; - int s_width, nextWordWidth, s_indent; + int xdelta = 0, ybasicpos = 0; + int s_width, s_indent; int ysizeup = 0, ysizedown = 0; int MaxLineWidth = 0; int curLineWidth = 0; @@ -784,6 +784,7 @@ void wxHtmlContainerCell::Layout(int w) case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell->GetHeight(); break; case wxHTML_ALIGN_CENTER : ybasicpos = - cell->GetHeight() / 2; break; } + int ydiff; ydiff = cell->GetHeight() + ybasicpos; if (cell->GetDescent() + ydiff > ysizedown) ysizedown = cell->GetDescent() + ydiff; @@ -809,6 +810,7 @@ void wxHtmlContainerCell::Layout(int w) cell = cell->GetNext(); // compute length of the next word that would be added: + int nextWordWidth; nextWordWidth = 0; if (cell) { @@ -1322,9 +1324,9 @@ wxHtmlCell *wxHtmlContainerCell::GetFirstTerminal() const { if ( m_Cells ) { - wxHtmlCell *c2; for (wxHtmlCell *c = m_Cells; c; c = c->GetNext()) { + wxHtmlCell *c2; c2 = c->GetFirstTerminal(); if ( c2 ) return c2; diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 8d97ab74f6..ac04fcd7b6 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -150,7 +150,6 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur, if (end_pos <= begin_pos) return; - wxChar c; wxString::const_iterator i = begin_pos; wxString::const_iterator textBeginning = begin_pos; @@ -165,6 +164,7 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur, while (i < end_pos) { + wxChar c; c = *i; if (c == wxT('<')) diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index 617309a56f..d3373316a5 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -454,7 +454,6 @@ bool wxHtmlWindow::DoSetPage(const wxString& source) if (m_Processors || m_GlobalProcessors) { wxHtmlProcessorList::compatibility_iterator nodeL, nodeG; - int prL, prG; if ( m_Processors ) nodeL = m_Processors->GetFirst(); @@ -468,6 +467,7 @@ bool wxHtmlWindow::DoSetPage(const wxString& source) // in every iteration while (nodeL || nodeG) { + int prL, prG; prL = (nodeL) ? nodeL->GetData()->GetPriority() : -1; prG = (nodeG) ? nodeG->GetData()->GetPriority() : -1; if (prL > prG) diff --git a/src/html/m_fonts.cpp b/src/html/m_fonts.cpp index 109db31967..cb77dd675d 100644 --- a/src/html/m_fonts.cpp +++ b/src/html/m_fonts.cpp @@ -86,10 +86,10 @@ TAG_HANDLER_BEGIN(FONT, "FONT" ) m_Faces = wxFontEnumerator::GetFacenames(); wxStringTokenizer tk(faces, wxT(",")); - int index; while (tk.HasMoreTokens()) { + int index; if ((index = m_Faces.Index(tk.GetNextToken(), false)) != wxNOT_FOUND) { m_WParser->SetFontFace(m_Faces[index]); diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 51cf1fe9a5..ddeb2d6ba9 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -1104,7 +1104,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points) const size_t n_bezier_points = n_points * 3 + 1; POINT *lppt = new POINT[n_bezier_points]; size_t bezier_pos = 0; - wxCoord x1, y1, x2, y2, cx1, cy1, cx4, cy4; + wxCoord x1, y1, x2, y2, cx1, cy1; wxPointList::compatibility_iterator node = points->GetFirst(); wxPoint *p = node->GetData(); @@ -1135,6 +1135,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points) while ((node = node->GetNext())) #endif // !wxUSE_STD_CONTAINERS { + int cx4, cy4; p = (wxPoint *)node->GetData(); x1 = x2; y1 = y2; diff --git a/src/msw/menuitem.cpp b/src/msw/menuitem.cpp index 1c53d8de1d..59691dfabe 100644 --- a/src/msw/menuitem.cpp +++ b/src/msw/menuitem.cpp @@ -787,11 +787,11 @@ bool wxMenuItem::OnMeasureItem(size_t *width, size_t *height) if ( IsOwnerDrawn() ) { - *width = data->ItemMargin.GetTotalX(); - *height = data->ItemMargin.GetTotalY(); - if ( IsSeparator() ) { + *width = data->ItemMargin.GetTotalX(); + *height = data->ItemMargin.GetTotalY(); + *width += data->SeparatorSize.cx + data->SeparatorMargin.GetTotalX(); *height += data->SeparatorSize.cy diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp index 6d529a1946..9322045a72 100644 --- a/src/msw/renderer.cpp +++ b/src/msw/renderer.cpp @@ -857,21 +857,18 @@ wxRendererXP::DrawCollapseButton(wxWindow *win, { wxUxThemeHandle hTheme(win, L"TASKDIALOG"); - int state; - if (flags & wxCONTROL_PRESSED) - state = TDLGEBS_PRESSED; - else if (flags & wxCONTROL_CURRENT) - state = TDLGEBS_HOVER; - else - state = TDLGEBS_NORMAL; - - if ( flags & wxCONTROL_EXPANDED ) - state += 3; - if ( ::IsThemePartDefined(hTheme, TDLG_EXPANDOBUTTON, 0) ) { - if (flags & wxCONTROL_EXPANDED) - flags |= wxCONTROL_CHECKED; + int state; + if (flags & wxCONTROL_PRESSED) + state = TDLGEBS_PRESSED; + else if (flags & wxCONTROL_CURRENT) + state = TDLGEBS_HOVER; + else + state = TDLGEBS_NORMAL; + + if ( flags & wxCONTROL_EXPANDED ) + state += 3; RECT r = ConvertToRECT(dc, rect); diff --git a/src/osx/carbon/dataobj.cpp b/src/osx/carbon/dataobj.cpp index cb1abf26de..591bb674f6 100644 --- a/src/osx/carbon/dataobj.cpp +++ b/src/osx/carbon/dataobj.cpp @@ -298,9 +298,9 @@ void wxDataObject::AddToPasteboard( void * pb, wxIntPtr itemID ) memset( buf, 0, sz ); if ( GetDataHere( thisFormat, buf ) ) { - wxIntPtr counter = 1 ; if ( thisFormat.GetType() == wxDF_FILENAME ) { + wxIntPtr counter = 1; // the data is D-normalized UTF8 strings of filenames delimited with \n char *fname = strtok((char*) buf,"\n"); while (fname != NULL) @@ -398,7 +398,6 @@ bool wxDataObject::GetFromPasteboard( void * pb ) ItemCount itemCount = 0; wxString filenamesPassed; bool transferred = false; - bool pastelocationset = false; // we synchronize here once again, so we don't mind which flags get returned PasteboardSynchronize( pasteboard ); @@ -406,6 +405,7 @@ bool wxDataObject::GetFromPasteboard( void * pb ) OSStatus err = PasteboardGetItemCount( pasteboard, &itemCount ); if ( err == noErr ) { + bool pastelocationset = false; for (size_t i = 0; !transferred && i < formatcount; i++) { // go through the data in our order of preference diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 004b67c347..898d08b155 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -857,10 +857,10 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits for ( int y = 0 ; y < the_height ; ++y , linestart += linesize, destptr += GetBitmapData()->GetBytesPerRow() ) { unsigned char* destination = destptr; - int index, bit, mask; for ( int x = 0 ; x < the_width ; ++x ) { + int index, bit, mask; index = x / 8 ; bit = x % 8 ; mask = 1 << bit ; @@ -1311,11 +1311,11 @@ wxImage wxBitmap::ConvertToImage() const { unsigned char * maskp = mask ; const wxUint32 * source = (wxUint32*)sourcestart; - unsigned char a, r, g, b; for (int xx = 0; xx < width; xx++) { const wxUint32 color = *source++; + unsigned char a, r, g, b; #ifdef WORDS_BIGENDIAN a = ((color&0xFF000000) >> 24) ; r = ((color&0x00FF0000) >> 16) ; diff --git a/src/osx/core/mimetype.cpp b/src/osx/core/mimetype.cpp index afc4562694..1ad1c4b316 100644 --- a/src/osx/core/mimetype.cpp +++ b/src/osx/core/mimetype.cpp @@ -133,15 +133,13 @@ bool CheckDocTypeMatchesExt( CFDictionaryRef docType, CFStringRef requiredExt ) // if a match is found, or null otherwise CFDictionaryRef GetDocTypeForExt( CFTypeRef docTypeData, CFStringRef requiredExt ) { - CFDictionaryRef docType; - CFArrayRef docTypes; - CFTypeRef item; - if( !docTypeData ) return NULL; if( CFGetTypeID( docTypeData ) == CFArrayGetTypeID() ) { + CFTypeRef item; + CFArrayRef docTypes; docTypes = reinterpret_cast< CFArrayRef >( docTypeData ); for( CFIndex i = 0, n = CFArrayGetCount( docTypes ); i < n; i++ ) @@ -150,6 +148,7 @@ CFDictionaryRef GetDocTypeForExt( CFTypeRef docTypeData, CFStringRef requiredExt if( CFGetTypeID( item ) == CFDictionaryGetTypeID() ) { + CFDictionaryRef docType; docType = reinterpret_cast< CFDictionaryRef >( item ); if( CheckDocTypeMatchesExt( docType, requiredExt ) ) diff --git a/src/osx/core/printmac.cpp b/src/osx/core/printmac.cpp index c14c376226..1e96df18a2 100644 --- a/src/osx/core/printmac.cpp +++ b/src/osx/core/printmac.cpp @@ -113,11 +113,10 @@ void wxOSXPrintData::UpdateToPMState() void wxOSXPrintData::TransferPrinterNameFrom( const wxPrintData &data ) { CFArrayRef printerList; - CFIndex index, count; - CFStringRef name; if (PMServerCreatePrinterList(kPMServerLocal, &printerList) == noErr) { + CFIndex index, count; PMPrinter printer = NULL; count = CFArrayGetCount(printerList); for (index = 0; index < count; index++) @@ -127,6 +126,7 @@ void wxOSXPrintData::TransferPrinterNameFrom( const wxPrintData &data ) break; else { + CFStringRef name; name = PMPrinterGetName(printer); CFRetain(name); if (data.GetPrinterName() == wxCFStringRef(name).AsString()) diff --git a/src/osx/palette.cpp b/src/osx/palette.cpp index 428db12d2a..e0519daa13 100644 --- a/src/osx/palette.cpp +++ b/src/osx/palette.cpp @@ -99,11 +99,11 @@ int wxPalette::GetPixel(unsigned char red, unsigned char green, unsigned char bl long bestdiff = 3 * 256 ; long bestpos = 0 ; - long currentdiff ; for ( int i = 0 ; i < M_PALETTEDATA->m_count ; ++i ) { const wxColour& col = M_PALETTEDATA->m_palette[i] ; + long currentdiff; currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue ) ; if ( currentdiff < bestdiff ) { diff --git a/src/osx/radiobox_osx.cpp b/src/osx/radiobox_osx.cpp index 4d0e06b92a..fa98137a27 100644 --- a/src/osx/radiobox_osx.cpp +++ b/src/osx/radiobox_osx.cpp @@ -368,7 +368,6 @@ void wxRadioBox::SetFocus() void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - int i; wxRadioButton *current; // define the position @@ -470,6 +469,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) y_offset = y_start; current = m_radioButtonCycle; + int i; for (i = 0 ; i < (int)m_noItems; i++) { // not to do for the zero button! diff --git a/src/osx/slider_osx.cpp b/src/osx/slider_osx.cpp index 8a4cad4a1a..275e8a254d 100644 --- a/src/osx/slider_osx.cpp +++ b/src/osx/slider_osx.cpp @@ -397,9 +397,7 @@ wxSize wxSlider::DoGetBestSize() const void wxSlider::DoSetSize(int x, int y, int w, int h, int sizeFlags) { - int yborder = 0; int minValWidth, maxValWidth, textheight; - int sliderBreadth; int width = w; if (GetWindowStyle() & wxSL_LABELS) @@ -444,9 +442,11 @@ void wxSlider::DoSetSize(int x, int y, int w, int h, int sizeFlags) GetTextExtent(text, &valValWidth, &ht); + int yborder; yborder = textheight + wxSLIDER_BORDERTEXT; // Get slider breadth + int sliderBreadth; if (GetWindowStyle() & wxSL_AUTOTICKS) sliderBreadth = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS; else diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index fa6349c560..fe3fcfb720 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -1701,10 +1701,9 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) GetPeer()->ScrollRect( &scrollrect, dx, dy ); } - wxWindowMac *child; - int x, y, w, h; for (wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext()) { + wxWindowMac* child; child = node->GetData(); if (child == NULL) continue; @@ -1715,6 +1714,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) if ( !IsClientAreaChild(child) ) continue; + int x, y, w, h; child->GetPosition( &x, &y ); child->GetSize( &w, &h ); if (rect) @@ -2003,10 +2003,10 @@ void wxWindowMac::MacPaintChildrenBorders() // in Composited windowing wxPoint clientOrigin = GetClientAreaOrigin() ; - wxWindowMac *child; int x, y, w, h; for (wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext()) { + wxWindowMac* child; child = node->GetData(); if (child == NULL) continue; @@ -2230,10 +2230,10 @@ void wxWindowMac::MacSuperChangedPosition() m_cachedClippedRectValid = false ; - wxWindowMac *child; wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); while ( node ) { + wxWindowMac* child; child = node->GetData(); child->MacSuperChangedPosition() ; @@ -2245,10 +2245,10 @@ void wxWindowMac::MacTopLevelWindowChangedPosition() { // only screen-absolute structures have to be moved i.e. glcanvas - wxWindowMac *child; wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); while ( node ) { + wxWindowMac* child; child = node->GetData(); child->MacTopLevelWindowChangedPosition() ; diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 5a9af11668..791bad1b81 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -303,13 +303,12 @@ bool wxPGSpinCtrlEditor::OnEvent( wxPropertyGrid* propgrid, wxPGProperty* proper wxWindow* wnd, wxEvent& event ) const { wxEventType evtType = event.GetEventType(); - int keycode = -1; - int spins = 1; bool bigStep = false; if ( evtType == wxEVT_KEY_DOWN ) { wxKeyEvent& keyEvent = (wxKeyEvent&)event; + int keycode; keycode = keyEvent.GetKeyCode(); if ( keycode == WXK_UP ) @@ -330,6 +329,7 @@ bool wxPGSpinCtrlEditor::OnEvent( wxPropertyGrid* propgrid, wxPGProperty* proper if ( evtType == wxEVT_SCROLL_LINEUP || evtType == wxEVT_SCROLL_LINEDOWN ) { + int spins = 1; #if IS_MOTION_SPIN_SUPPORTED if ( property->GetAttributeAsLong(wxPG_ATTR_SPINCTRL_MOTION, 0) ) { diff --git a/src/qt/frame.cpp b/src/qt/frame.cpp index 2492927aff..be927ce2cd 100644 --- a/src/qt/frame.cpp +++ b/src/qt/frame.cpp @@ -107,9 +107,9 @@ void wxFrame::SetStatusBar( wxStatusBar *statusBar ) void wxFrame::SetToolBar(wxToolBar *toolbar) { - int area = 0; if ( toolbar != NULL ) { + int area = 0; if (toolbar->HasFlag(wxTB_LEFT)) { area = Qt::LeftToolBarArea; } else if (toolbar->HasFlag(wxTB_RIGHT)) { area = Qt::RightToolBarArea; } else if (toolbar->HasFlag(wxTB_BOTTOM)){ area = Qt::BottomToolBarArea;} diff --git a/src/qt/listbox.cpp b/src/qt/listbox.cpp index 6b5152b60b..9e5ab77853 100644 --- a/src/qt/listbox.cpp +++ b/src/qt/listbox.cpp @@ -88,10 +88,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, { DoCreate(parent, style); - QListWidgetItem* item; - while ( n-- > 0 ) { + QListWidgetItem* item; item = new QListWidgetItem(); item->setText(wxQtConvertString( *choices++ )); if ( m_hasCheckBoxes ) diff --git a/src/qt/listctrl.cpp b/src/qt/listctrl.cpp index 2c13dd1f40..4ba6cfcefd 100644 --- a/src/qt/listctrl.cpp +++ b/src/qt/listctrl.cpp @@ -878,12 +878,12 @@ bool wxListCtrl::EnsureVisible(long item) long wxListCtrl::FindItem(long start, const wxString& str, bool partial) { - int ret; QList qitems = m_qtTreeWidget->findItems( wxQtConvertString(str), !partial ? Qt::MatchExactly : Qt::MatchContains ); for (int i=0; iindexOfTopLevelItem(qitems.at(i)); if ( ret >= start ) return ret; diff --git a/src/ribbon/bar.cpp b/src/ribbon/bar.cpp index 9804ec19d7..e96f85c2ab 100644 --- a/src/ribbon/bar.cpp +++ b/src/ribbon/bar.cpp @@ -1258,7 +1258,7 @@ wxSize wxRibbonBar::DoGetBestSize() const void wxRibbonBar::HitTestRibbonButton(const wxRect& rect, const wxPoint& position, bool &hover_flag) { - bool hovered = false, toggle_button_hovered = false; + bool hovered = false; if(position.x >= 0 && position.y >= 0) { wxSize size = GetSize(); @@ -1269,6 +1269,7 @@ void wxRibbonBar::HitTestRibbonButton(const wxRect& rect, const wxPoint& positio } if(hovered) { + bool toggle_button_hovered; toggle_button_hovered = rect.Contains(position); if ( hovered != m_bar_hovered || toggle_button_hovered != hover_flag ) diff --git a/src/ribbon/page.cpp b/src/ribbon/page.cpp index a97b002c4b..171cd62ced 100644 --- a/src/ribbon/page.cpp +++ b/src/ribbon/page.cpp @@ -1008,7 +1008,6 @@ bool wxRibbonPage::CollapsePanels(wxOrientation direction, int minimum_amount) { while(minimum_amount > 0) { - int largest_size = 0; wxRibbonPanel* largest_panel = NULL; wxSize* largest_panel_size = NULL; wxSize* panel_size = m_size_calc_array; @@ -1032,6 +1031,7 @@ bool wxRibbonPage::CollapsePanels(wxOrientation direction, int minimum_amount) } else { + int largest_size = 0; for(wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext(), ++panel_size ) diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 0a447d2e2d..fb9e09e652 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -7026,8 +7026,6 @@ bool wxRichTextPlainText::DrawTabbedString(wxDC& dc, const wxRichTextAttr& attr, else tabCount = 0; - int nextTabPos = -1; - int tabPos = -1; wxCoord w, h; if (selected) @@ -7061,10 +7059,12 @@ bool wxRichTextPlainText::DrawTabbedString(wxDC& dc, const wxRichTextAttr& attr, wxString stringChunk = str.BeforeFirst(wxT('\t')); str = str.AfterFirst(wxT('\t')); dc.GetTextExtent(stringChunk, & w, & h); + int tabPos; tabPos = x + w; bool not_found = true; for (int i = 0; i < tabCount && not_found; ++i) { + int nextTabPos; nextTabPos = tabArray.Item(i) + x_orig; // Find the next tab position. @@ -7253,8 +7253,6 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz tabArray[i] = pos; } - int nextTabPos = -1; - while (stringChunk.Find(wxT('\t')) >= 0) { int absoluteWidth = 0; @@ -7295,6 +7293,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz bool notFound = true; for (int i = 0; i < tabCount && notFound; ++i) { + int nextTabPos; nextTabPos = tabArray.Item(i); // Find the next tab position. diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index db797e696f..8da80d379b 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -1842,11 +1842,10 @@ void wxThreadModule::OnExit() { wxASSERT_MSG( wxThread::IsMain(), wxT("only main thread can be here") ); - // are there any threads left which are being deleted right now? - size_t nThreadsBeingDeleted; - { wxMutexLocker lock( *gs_mutexDeleteThread ); + // are there any threads left which are being deleted right now? + size_t nThreadsBeingDeleted; nThreadsBeingDeleted = gs_nThreadsBeingDeleted; if ( nThreadsBeingDeleted > 0 )