From: Vadim Zeitlin Date: Fri, 21 Sep 2007 12:00:25 +0000 (+0000) Subject: various warning fixes for icc 9.1 compilation X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/74ab5f5b9df928c75c119a2c00b0d2092caa49f1?ds=sidebyside various warning fixes for icc 9.1 compilation - variable shadowing - unused code and variables - extra semicolons git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48864 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/imagiff.cpp b/src/common/imagiff.cpp index 311fcadfbb..058d6e5cd0 100644 --- a/src/common/imagiff.cpp +++ b/src/common/imagiff.cpp @@ -379,22 +379,15 @@ int wxIFFDecoder::ReadIFF() // main decoding loop. searches IFF chunks and handles them. // terminates when BODY chunk was found or dataptr ran over end of file // - bool BMHDok = false, CMAPok = false, CAMGok = false; + bool BMHDok = false, CAMGok = false; int bmhd_width = 0, bmhd_height = 0, bmhd_bitplanes = 0, bmhd_transcol = -1; - byte bmhd_masking = 0, bmhd_compression = 0; + byte bmhd_compression = 0; long camg_viewmode = 0; int colors = 0; while (dataptr + 8 <= dataend) { // get chunk length and make even - size_t chunkLen = (iff_getlong(dataptr + 4) + 1) & 0xfffffffe; -#ifdef __VMS - // Silence compiler warning - int chunkLen_; - chunkLen_ = chunkLen; - if (chunkLen_ < 0) { // format error? -#else - if (chunkLen < 0) { // format error? -#endif + long chunkLen = (iff_getlong(dataptr + 4) + 1) & 0xfffffffe; + if (chunkLen < 0) { // format error? break; } bool truncated = (dataptr + 8 + chunkLen > dataend); @@ -406,7 +399,7 @@ int wxIFFDecoder::ReadIFF() bmhd_width = iff_getword(dataptr + 8); // width of picture bmhd_height= iff_getword(dataptr + 8 + 2); // height of picture bmhd_bitplanes = *(dataptr + 8 + 8); // # of bitplanes - bmhd_masking = *(dataptr + 8 + 9); + // bmhd_masking = *(dataptr + 8 + 9); -- unused currently bmhd_compression = *(dataptr + 8 + 10); // get compression bmhd_transcol = iff_getword(dataptr + 8 + 12); BMHDok = true; // got BMHD @@ -440,7 +433,6 @@ int wxIFFDecoder::ReadIFF() wxLogTrace(_T("iff"), _T("Read %d colors from IFF file."), colors); - CMAPok = true; // got CMAP dataptr += 8 + chunkLen; // to next chunk } else if (strncmp((char *)dataptr, "CAMG", 4) == 0) { // CAMG ? if (chunkLen < 4 || truncated) { diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index ed30da1d39..9dde5b581b 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -1376,8 +1376,8 @@ wxFlexGridSizer::~wxFlexGridSizer() void wxFlexGridSizer::RecalcSizes() { - int nitems, nrows, ncols; - if ( (nitems = CalcRowsCols(nrows, ncols)) == 0 ) + int nrows, ncols; + if ( !CalcRowsCols(nrows, ncols) ) return; const wxPoint pt(GetPosition()); diff --git a/src/generic/collpaneg.cpp b/src/generic/collpaneg.cpp index f31a7762c7..ae5f0cde3c 100644 --- a/src/generic/collpaneg.cpp +++ b/src/generic/collpaneg.cpp @@ -184,11 +184,11 @@ void wxGenericCollapsiblePane::OnStateChange(const wxSize& sz) if (top->GetSizer()) { // we have just set the size hints... - wxSize sz = top->GetSizer()->CalcMin(); + wxSize szClient = top->GetSizer()->CalcMin(); // use SetClientSize() and not SetSize() otherwise the size for // e.g. a wxFrame with a menubar wouldn't be correctly set - top->SetClientSize(sz); + top->SetClientSize(szClient); } else top->Layout(); diff --git a/src/generic/filectrlg.cpp b/src/generic/filectrlg.cpp index f85cf1d342..5427143e01 100644 --- a/src/generic/filectrlg.cpp +++ b/src/generic/filectrlg.cpp @@ -393,9 +393,6 @@ void wxFileData::MakeItem( wxListItem &item ) // wxFileListCtrl //----------------------------------------------------------------------------- -// FIXME: what is this for? It's never read -static bool ignoreChanges = false; - IMPLEMENT_DYNAMIC_CLASS(wxFileListCtrl,wxListCtrl) BEGIN_EVENT_TABLE(wxFileListCtrl,wxListCtrl) @@ -722,10 +719,8 @@ void wxFileListCtrl::GoToParentDir() long id = FindItem( 0, fname ); if (id != wxNOT_FOUND) { - ignoreChanges = true; SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); EnsureVisible( id ); - ignoreChanges = false; } } } @@ -743,9 +738,7 @@ void wxFileListCtrl::GoToDir( const wxString &dir ) m_dirName = dir; UpdateFiles(); - ignoreChanges = true; SetItemState( 0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); - ignoreChanges = false; EnsureVisible( 0 ); } @@ -818,9 +811,7 @@ void wxFileListCtrl::OnListEndLabelEdit( wxListEvent &event ) { fd->SetNewName( new_name, event.GetLabel() ); - ignoreChanges = true; SetItemState( event.GetItem(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); - ignoreChanges = false; UpdateItem( event.GetItem() ); EnsureVisible( event.GetItem() ); diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index ee25469cc6..4d4c52bc70 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -1188,18 +1188,18 @@ void wxScrollHelper::HandleOnChar(wxKeyEvent& event) if ( m_xScrollPosition != xScrollOld ) { - wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, m_xScrollPosition, + wxScrollWinEvent evt(wxEVT_SCROLLWIN_THUMBTRACK, m_xScrollPosition, wxHORIZONTAL); - event.SetEventObject(m_win); - m_win->GetEventHandler()->ProcessEvent(event); + evt.SetEventObject(m_win); + m_win->GetEventHandler()->ProcessEvent(evt); } if ( m_yScrollPosition != yScrollOld ) { - wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, m_yScrollPosition, + wxScrollWinEvent evt(wxEVT_SCROLLWIN_THUMBTRACK, m_yScrollPosition, wxVERTICAL); - event.SetEventObject(m_win); - m_win->GetEventHandler()->ProcessEvent(event); + evt.SetEventObject(m_win); + m_win->GetEventHandler()->ProcessEvent(evt); } } diff --git a/src/generic/srchctlg.cpp b/src/generic/srchctlg.cpp index fc5adf6dee..b12fe8e6ae 100644 --- a/src/generic/srchctlg.cpp +++ b/src/generic/srchctlg.cpp @@ -342,8 +342,6 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id, m_text = new wxSearchTextCtrl(this, value, style & ~wxBORDER_MASK); m_text->SetDescriptiveText(_("Search")); - wxSize sizeText = m_text->GetBestSize(); - m_searchButton = new wxSearchButton(this, wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, m_searchBitmap); diff --git a/src/gtk/collpane.cpp b/src/gtk/collpane.cpp index e616adb537..b5fd6511b5 100644 --- a/src/gtk/collpane.cpp +++ b/src/gtk/collpane.cpp @@ -96,7 +96,7 @@ static void gtk_collapsiblepane_expanded_callback (GObject *object, // fire an event wxCollapsiblePaneEvent ev(p, p->GetId(), p->IsCollapsed()); p->GetEventHandler()->ProcessEvent(ev); - + // the user asked to explicitely handle the resizing itself... return; } @@ -106,7 +106,7 @@ static void gtk_collapsiblepane_expanded_callback (GObject *object, if ( top && top->GetSizer() ) { // 2) recalculate minimal size of the top window - wxSize sz = top->GetSizer()->CalcMin(); + sz = top->GetSizer()->CalcMin(); if (top->m_mainWidget) { diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 91207fc70a..d36c8abf44 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -775,8 +775,6 @@ unsigned int wxComboBox::GetCount() const } return count; } - - return 0; } void wxComboBox::SetSelection( int n ) diff --git a/src/gtk/filectrl.cpp b/src/gtk/filectrl.cpp index 6b2a0001df..c8b852d36d 100644 --- a/src/gtk/filectrl.cpp +++ b/src/gtk/filectrl.cpp @@ -194,7 +194,7 @@ int wxGtkFileChooser::GetFilterIndex() const } else return index; -}; +} //----------------------------------------------------------------------------- // end wxGtkFileChooser Implementation diff --git a/src/gtk/gnome/gprint.cpp b/src/gtk/gnome/gprint.cpp index 8b7eef989a..993cba2195 100644 --- a/src/gtk/gnome/gprint.cpp +++ b/src/gtk/gnome/gprint.cpp @@ -1031,10 +1031,10 @@ void wxGnomePrintDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoo alpha1 = 0.0; alpha2 = 360.0; } - else - if (radius == 0.0) + else if ( wxIsNullDouble(radius) ) { - alpha1 = alpha2 = 0.0; + alpha1 = + alpha2 = 0.0; } else { @@ -1161,8 +1161,8 @@ void wxGnomePrintDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxC int i; for (i = 1; i < n; i++) { - int x = points[i].x + xoffset; - int y = points[i].y + yoffset; + x = points[i].x + xoffset; + y = points[i].y + yoffset; gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) ); CalcBoundingBox( x, y ); } @@ -1181,8 +1181,8 @@ void wxGnomePrintDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxC int i; for (i = 1; i < n; i++) { - int x = points[i].x + xoffset; - int y = points[i].y + yoffset; + x = points[i].x + xoffset; + y = points[i].y + yoffset; gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) ); CalcBoundingBox( x, y ); } diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index 343e27f848..a9aa6021e9 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -33,14 +33,19 @@ gtk_value_changed(GtkRange* range, wxScrollBar* win) { const int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL; const int value = win->GetThumbPosition(); - wxScrollEvent event(eventType, win->GetId(), value, orient); - event.SetEventObject(win); - win->GetEventHandler()->ProcessEvent(event); + const int id = win->GetId(); + + // first send the specific event for the user action + wxScrollEvent evtSpec(eventType, id, value, orient); + evtSpec.SetEventObject(win); + win->GetEventHandler()->ProcessEvent(evtSpec); + if (!win->m_isScrolling) { - wxScrollEvent event(wxEVT_SCROLL_CHANGED, win->GetId(), value, orient); - event.SetEventObject(win); - win->GetEventHandler()->ProcessEvent(event); + // and if it's over also send a general "changed" event + wxScrollEvent evtChanged(wxEVT_SCROLL_CHANGED, id, value, orient); + evtChanged.SetEventObject(win); + win->GetEventHandler()->ProcessEvent(evtChanged); } } } @@ -73,14 +78,15 @@ gtk_event_after(GtkRange* range, GdkEvent* event, wxScrollBar* win) const int value = win->GetThumbPosition(); const int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL; + const int id = win->GetId(); - wxScrollEvent event(wxEVT_SCROLL_THUMBRELEASE, win->GetId(), value, orient); - event.SetEventObject(win); - win->GetEventHandler()->ProcessEvent(event); + wxScrollEvent evtRel(wxEVT_SCROLL_THUMBRELEASE, id, value, orient); + evtRel.SetEventObject(win); + win->GetEventHandler()->ProcessEvent(evtRel); - wxScrollEvent event2(wxEVT_SCROLL_CHANGED, win->GetId(), value, orient); - event2.SetEventObject(win); - win->GetEventHandler()->ProcessEvent(event2); + wxScrollEvent evtChanged(wxEVT_SCROLL_CHANGED, id, value, orient); + evtChanged.SetEventObject(win); + win->GetEventHandler()->ProcessEvent(evtChanged); } } } diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index cb6c98f1c5..b1409d49f7 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -527,8 +527,8 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) // if we have a dropdown menu, we use 2 GTK tools internally wxToolBarToolsList::compatibility_iterator node = m_tools.Item( i ); - wxToolBarTool *tool = (wxToolBarTool*) node->GetData(); - if ( tool->IsButton() && (tool->GetKind() == wxITEM_DROPDOWN) ) + wxToolBarTool * const tool2 = (wxToolBarTool*) node->GetData(); + if ( tool2->IsButton() && tool2->GetKind() == wxITEM_DROPDOWN ) posGtk++; } } diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 9517877940..8d403c0228 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -251,10 +251,10 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, for (size_t i = 0; i < tabs.GetCount(); i++) tagname += wxString::Format(_T(" %d"), tabs[i]); - const wxWX2MBbuf buf = tagname.mb_str(wxConvUTF8); + const wxWX2MBbuf buftag = tagname.utf8_str(); tag = gtk_text_tag_table_lookup( gtk_text_buffer_get_tag_table( text_buffer ), - buf ); + buftag ); if (!tag) { // Factor to convert from 1/10th of a mm into pixels @@ -270,7 +270,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, PangoTabArray* tabArray = pango_tab_array_new(tabs.GetCount(), TRUE); for (size_t i = 0; i < tabs.GetCount(); i++) pango_tab_array_set_tab(tabArray, i, PANGO_TAB_LEFT, (gint)(tabs[i] * factor)); - tag = gtk_text_buffer_create_tag( text_buffer, buf, + tag = gtk_text_buffer_create_tag( text_buffer, buftag, "tabs", tabArray, NULL ); pango_tab_array_free(tabArray); } @@ -951,7 +951,6 @@ wxString wxTextCtrl::GetValue() const { wxCHECK_MSG( m_text != NULL, wxEmptyString, wxT("invalid text ctrl") ); - wxString tmp; if ( IsMultiLine() ) { GtkTextIter start; @@ -967,8 +966,6 @@ wxString wxTextCtrl::GetValue() const const gchar *text = gtk_entry_get_text( GTK_ENTRY(m_text) ); return wxGTK_CONV_BACK(text); } - - return tmp; } wxFontEncoding wxTextCtrl::GetTextEncoding() const diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 7f19277268..b7e49281e1 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2002,9 +2002,10 @@ gtk_scrollbar_event_after(GtkRange* range, GdkEvent* event, wxWindow* win) const int orient = wxWindow::OrientFromScrollDir( win->ScrollDirFromRange(range)); - wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBRELEASE, win->GetScrollPos(orient), orient); - event.SetEventObject(win); - win->GTKProcessEvent(event); + wxScrollWinEvent evt(wxEVT_SCROLLWIN_THUMBRELEASE, + win->GetScrollPos(orient), orient); + evt.SetEventObject(win); + win->GTKProcessEvent(evt); } } diff --git a/src/unix/appunix.cpp b/src/unix/appunix.cpp index 0bca1979a9..77748127e0 100644 --- a/src/unix/appunix.cpp +++ b/src/unix/appunix.cpp @@ -8,8 +8,17 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/app.h" -#include "wx/log.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/log.h" +#endif + #include "wx/evtloop.h" #include