From 2a230426807715c54b6fdcf410e3678ee0dfada6 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 15 May 2008 17:24:48 +0000 Subject: [PATCH] fix some warnings from GCC -Wextra git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dataview.h | 4 +++- include/wx/dcsvg.h | 2 +- include/wx/mstream.h | 1 + src/common/iconbndl.cpp | 2 +- src/common/regex.cpp | 2 ++ src/common/valgen.cpp | 3 ++- src/generic/logg.cpp | 2 +- src/generic/prntdlgg.cpp | 6 ++++-- src/generic/vscroll.cpp | 4 ++-- src/gtk/bitmap.cpp | 4 ++-- src/gtk/window.cpp | 18 +++++++++--------- src/richtext/richtextbuffer.cpp | 5 +++-- 12 files changed, 31 insertions(+), 22 deletions(-) diff --git a/include/wx/dataview.h b/include/wx/dataview.h index ee31afec70..23e6747392 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -478,7 +478,9 @@ public: : m_text(text), m_icon(icon) { } wxDataViewIconText( const wxDataViewIconText &other ) - { m_icon = other.m_icon; m_text = other.m_text; } + : wxObject() + , m_text(other.m_text), m_icon(other.m_icon) + { } void SetText( const wxString &text ) { m_text = text; } wxString GetText() const { return m_text; } diff --git a/include/wx/dcsvg.h b/include/wx/dcsvg.h index 2ac99a2548..fc17548fae 100644 --- a/include/wx/dcsvg.h +++ b/include/wx/dcsvg.h @@ -114,7 +114,7 @@ private: virtual void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord); - virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = 0); + virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = false); virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord w, wxCoord h); diff --git a/include/wx/mstream.h b/include/wx/mstream.h index 97d6f5e00b..eb5e729ad5 100644 --- a/include/wx/mstream.h +++ b/include/wx/mstream.h @@ -31,6 +31,7 @@ public: InitFromStream(stream, lenFile); } wxMemoryInputStream(wxMemoryInputStream& stream) + : wxInputStream() { InitFromStream(stream, wxInvalidOffset); } diff --git a/src/common/iconbndl.cpp b/src/common/iconbndl.cpp index 11b113004f..676ff07f12 100644 --- a/src/common/iconbndl.cpp +++ b/src/common/iconbndl.cpp @@ -176,7 +176,7 @@ wxIcon wxIconBundle::GetIcon(const wxSize& size) const // the best icon is by default (arbitrarily) the first one but // if we find a system-sized icon, take it instead - if ( sx == sysX && sy == sysY || !iconBest.IsOk() ) + if ((sx == sysX && sy == sysY) || !iconBest.IsOk()) iconBest = icon; } } diff --git a/src/common/regex.cpp b/src/common/regex.cpp index 7879616899..f6ca878291 100644 --- a/src/common/regex.cpp +++ b/src/common/regex.cpp @@ -282,12 +282,14 @@ bool wxRegExImpl::Compile(const wxString& expr, int flags) // translate our flags to regcomp() ones int flagsRE = 0; if ( !(flags & wxRE_BASIC) ) + { #ifndef WX_NO_REGEX_ADVANCED if (flags & wxRE_ADVANCED) flagsRE |= REG_ADVANCED; else #endif flagsRE |= REG_EXTENDED; + } if ( flags & wxRE_ICASE ) flagsRE |= REG_ICASE; if ( flags & wxRE_NOSUB ) diff --git a/src/common/valgen.cpp b/src/common/valgen.cpp index e38f6789bd..37cefb5e74 100644 --- a/src/common/valgen.cpp +++ b/src/common/valgen.cpp @@ -370,7 +370,8 @@ bool wxGenericValidator::TransferToWindow(void) } } else #endif - ; // to match the last 'else' above + { // to match the last 'else' above + } // unrecognized control, or bad pointer return false; diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index ecac929db9..5d4bcc8771 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -1080,7 +1080,7 @@ static int OpenLogFile(wxFile& file, wxString *pFilename, wxWindow *parent) // open file // --------- - bool bOk wxDUMMY_INITIALIZE(false); + bool bOk = false; if ( wxFile::Exists(filename) ) { bool bAppend = false; wxString strMsg; diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index 704d6244e3..c869dd68a1 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -208,9 +208,9 @@ void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent)) if (factory->HasStatusLine()) { flex->Add( new wxStaticText( this, wxID_ANY, _("Status:") ), - 0, wxALIGN_CENTER_VERTICAL|wxALL-wxTOP, 5 ); + 0, wxALIGN_CENTER_VERTICAL|(wxALL-wxTOP), 5 ); flex->Add( new wxStaticText( this, wxID_ANY, factory->CreateStatusLine() ), - 0, wxALIGN_CENTER_VERTICAL|wxALL-wxTOP, 5 ); + 0, wxALIGN_CENTER_VERTICAL|(wxALL-wxTOP), 5 ); } mainsizer->Add( topsizer, 0, wxLEFT|wxTOP|wxRIGHT|wxGROW, 10 ); @@ -361,10 +361,12 @@ bool wxGenericPrintDialog::TransferDataToWindow() if (m_printDialogData.GetToPage() > 0) m_toText->SetValue(wxString::Format(_T("%d"), m_printDialogData.GetToPage())); if(m_rangeRadioBox) + { if (m_printDialogData.GetAllPages() || m_printDialogData.GetFromPage() == 0) m_rangeRadioBox->SetSelection(0); else m_rangeRadioBox->SetSelection(1); + } } else { diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp index a948519a9a..50bb4c1c6d 100644 --- a/src/generic/vscroll.cpp +++ b/src/generic/vscroll.cpp @@ -592,8 +592,8 @@ bool wxVarScrollHelperBase::DoScrollToUnit(size_t unit) // finally refresh the display -- but only redraw as few units as possible // to avoid flicker. We can't do this if we have children because they // won't be scrolled - if ( m_targetWindow->GetChildren().empty() && - GetVisibleBegin() >= unitLastOld || GetVisibleEnd() <= unitFirstOld ) + if ( (m_targetWindow->GetChildren().empty() && + GetVisibleBegin() >= unitLastOld) || GetVisibleEnd() <= unitFirstOld ) { // the simplest case: we don't have any old units left, just redraw // everything diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index b1fe2f76f1..18fb4f02b0 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -902,8 +902,8 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) const bool hasAlpha = HasAlpha(); // allow access if bpp is valid and matches existence of alpha if (pixbuf != NULL && ( - bpp == 24 && !hasAlpha || - bpp == 32 && hasAlpha)) + (bpp == 24 && !hasAlpha) || + (bpp == 32 && hasAlpha))) { data.m_height = gdk_pixbuf_get_height( pixbuf ); data.m_width = gdk_pixbuf_get_width( pixbuf ); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index f31a76fe73..f7c7bf4e24 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -500,11 +500,11 @@ static long wxTranslateKeySymToWXKey(KeySym keysym, bool isChar) case GDK_KP_7: case GDK_KP_8: case GDK_KP_9: - key_code = (isChar ? '0' : WXK_NUMPAD0) + keysym - GDK_KP_0; + key_code = (isChar ? '0' : int(WXK_NUMPAD0)) + keysym - GDK_KP_0; break; case GDK_KP_Space: - key_code = isChar ? ' ' : WXK_NUMPAD_SPACE; + key_code = isChar ? ' ' : int(WXK_NUMPAD_SPACE); break; case GDK_KP_Tab: @@ -576,32 +576,32 @@ static long wxTranslateKeySymToWXKey(KeySym keysym, bool isChar) break; case GDK_KP_Equal: - key_code = isChar ? '=' : WXK_NUMPAD_EQUAL; + key_code = isChar ? '=' : int(WXK_NUMPAD_EQUAL); break; case GDK_KP_Multiply: - key_code = isChar ? '*' : WXK_NUMPAD_MULTIPLY; + key_code = isChar ? '*' : int(WXK_NUMPAD_MULTIPLY); break; case GDK_KP_Add: - key_code = isChar ? '+' : WXK_NUMPAD_ADD; + key_code = isChar ? '+' : int(WXK_NUMPAD_ADD); break; case GDK_KP_Separator: // FIXME: what is this? - key_code = isChar ? '.' : WXK_NUMPAD_SEPARATOR; + key_code = isChar ? '.' : int(WXK_NUMPAD_SEPARATOR); break; case GDK_KP_Subtract: - key_code = isChar ? '-' : WXK_NUMPAD_SUBTRACT; + key_code = isChar ? '-' : int(WXK_NUMPAD_SUBTRACT); break; case GDK_KP_Decimal: - key_code = isChar ? '.' : WXK_NUMPAD_DECIMAL; + key_code = isChar ? '.' : int(WXK_NUMPAD_DECIMAL); break; case GDK_KP_Divide: - key_code = isChar ? '/' : WXK_NUMPAD_DIVIDE; + key_code = isChar ? '/' : int(WXK_NUMPAD_DIVIDE); break; diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index aae4eaa579..1a855ee7de 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -875,7 +875,7 @@ wxRichTextLine* wxRichTextParagraphLayoutBox::GetLineAtPosition(long pos, bool c // If the position is end-of-paragraph, then return the last line of // of the paragraph. - (range.GetEnd() == child->GetRange().GetEnd()-1) && (pos == child->GetRange().GetEnd())) + ((range.GetEnd() == child->GetRange().GetEnd()-1) && (pos == child->GetRange().GetEnd()))) return line; node2 = node2->GetNext(); @@ -5943,7 +5943,7 @@ wxString wxRichTextBuffer::GetExtWildcard(bool combine, bool save, wxArrayInt* t while (node) { wxRichTextFileHandler* handler = (wxRichTextFileHandler*) node->GetData(); - if (handler->IsVisible() && ((save && handler->CanSave()) || !save && handler->CanLoad())) + if (handler->IsVisible() && ((save && handler->CanSave()) || (!save && handler->CanLoad()))) { if (combine) { @@ -7774,6 +7774,7 @@ wxRichTextFontTable::wxRichTextFontTable() } wxRichTextFontTable::wxRichTextFontTable(const wxRichTextFontTable& table) + : wxObject() { (*this) = table; } -- 2.45.2