From 42841dfcaddc6045ffc618acbb620b1fde1bc618 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Mon, 11 Oct 2004 16:30:43 +0000 Subject: [PATCH] Warning fixes found under hardest mode of OpenWatcom. Seems clean in Borland, MinGW and DMC. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/confbase.h | 2 +- include/wx/datetime.h | 2 +- include/wx/html/helpdata.h | 4 ++-- include/wx/msw/regconf.h | 2 +- include/wx/textbuf.h | 2 +- src/common/config.cpp | 4 ---- src/common/datetime.cpp | 29 +++++++++++++---------------- src/common/sizer.cpp | 4 ++-- src/common/textbuf.cpp | 4 ---- src/generic/choicbkg.cpp | 3 ++- src/generic/grid.cpp | 13 +++++++------ src/generic/listbkg.cpp | 5 +++-- src/generic/sashwin.cpp | 6 ++++-- src/html/helpdata.cpp | 4 ++-- src/html/helpfrm.cpp | 2 +- src/html/htmltag.cpp | 2 +- src/msw/listbox.cpp | 9 ++++++--- src/msw/regconf.cpp | 5 ----- src/xml/xml.cpp | 5 +++-- 19 files changed, 50 insertions(+), 57 deletions(-) diff --git a/include/wx/confbase.h b/include/wx/confbase.h index 0e23972e4c..15c4919896 100644 --- a/include/wx/confbase.h +++ b/include/wx/confbase.h @@ -117,7 +117,7 @@ public: long style = 0); // empty but ensures that dtor of all derived classes is virtual - virtual ~wxConfigBase(); + virtual ~wxConfigBase(){}; // path management // set current path: if the first character is '/', it's the absolute path, diff --git a/include/wx/datetime.h b/include/wx/datetime.h index 2ed9826fea..6303d40250 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -1327,7 +1327,7 @@ public: static void AddAuthority(wxDateTimeHolidayAuthority *auth); // the base class must have a virtual dtor - virtual ~wxDateTimeHolidayAuthority(); + virtual ~wxDateTimeHolidayAuthority(){}; protected: // this function is called to determine whether a given day is a holiday diff --git a/include/wx/html/helpdata.h b/include/wx/html/helpdata.h index ff2feb6ab5..a59c6f76d6 100644 --- a/include/wx/html/helpdata.h +++ b/include/wx/html/helpdata.h @@ -84,7 +84,7 @@ struct WXDLLIMPEXP_HTML wxHtmlHelpDataItem { wxHtmlHelpDataItem() : level(0), parent(NULL), id(wxID_ANY), book(NULL) {} - short int level; + int level; wxHtmlHelpDataItem *parent; int id; wxString name; @@ -110,7 +110,7 @@ struct wxHtmlContentsItem wxHtmlContentsItem& operator=(const wxHtmlContentsItem& d); ~wxHtmlContentsItem(); - short int m_Level; + int m_Level; int m_ID; wxChar *m_Name; wxChar *m_Page; diff --git a/include/wx/msw/regconf.h b/include/wx/msw/regconf.h index 166d4ac623..d0d0172bd5 100644 --- a/include/wx/msw/regconf.h +++ b/include/wx/msw/regconf.h @@ -39,7 +39,7 @@ public: long style = wxCONFIG_USE_GLOBAL_FILE); // dtor will save unsaved data - virtual ~wxRegConfig(); + virtual ~wxRegConfig(){}; // implement inherited pure virtual functions // ------------------------------------------ diff --git a/include/wx/textbuf.h b/include/wx/textbuf.h index 8da8b29454..ac8b14a3b3 100644 --- a/include/wx/textbuf.h +++ b/include/wx/textbuf.h @@ -165,7 +165,7 @@ public: wxMBConv& conv = wxConvUTF8); // dtor - virtual ~wxTextBuffer(); + virtual ~wxTextBuffer(){}; protected: // ctors diff --git a/src/common/config.cpp b/src/common/config.cpp index 80b43e4b9a..00f2daa6b7 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -73,10 +73,6 @@ wxConfigBase::wxConfigBase(const wxString& appName, m_bRecordDefaults = false; } -wxConfigBase::~wxConfigBase() -{ -} - wxConfigBase *wxConfigBase::Set(wxConfigBase *pConfig) { wxConfigBase *pOld = ms_pConfig; diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index e2194fb574..1d85ebbbd8 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -1974,7 +1974,7 @@ wxDateTime& wxDateTime::SetToYearDay(wxDateTime::wxDateTime_t yday) // yday lies in December then if ( (mon == Dec) || (yday <= gs_cumulatedDays[isLeap][mon + 1]) ) { - Set(yday - gs_cumulatedDays[isLeap][mon], mon, year); + Set((wxDateTime::wxDateTime_t)(yday - gs_cumulatedDays[isLeap][mon]), mon, year); break; } @@ -2565,7 +2565,7 @@ const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date) return (wxChar *)NULL; } - wxDateTime_t hour = *p++ - _T('0'); + wxDateTime_t hour = (wxDateTime_t)(*p++ - _T('0')); if ( !wxIsdigit(*p) ) { @@ -2573,7 +2573,7 @@ const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date) } hour *= 10; - hour += *p++ - _T('0'); + hour = (wxDateTime_t)(hour + (*p++ - _T('0'))); if ( *p++ != _T(':') ) { @@ -2585,7 +2585,7 @@ const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date) return (wxChar *)NULL; } - wxDateTime_t min = *p++ - _T('0'); + wxDateTime_t min = (wxDateTime_t)(*p++ - _T('0')); if ( !wxIsdigit(*p) ) { @@ -2593,7 +2593,7 @@ const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date) } min *= 10; - min += *p++ - _T('0'); + min = (wxDateTime_t)(min + *p++ - _T('0')); wxDateTime_t sec = 0; if ( *p++ == _T(':') ) @@ -2603,7 +2603,7 @@ const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date) return (wxChar *)NULL; } - sec = *p++ - _T('0'); + sec = (wxDateTime_t)(*p++ - _T('0')); if ( !wxIsdigit(*p) ) { @@ -2611,7 +2611,7 @@ const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date) } sec *= 10; - sec += *p++ - _T('0'); + sec = (wxDateTime_t)(sec + *p++ - _T('0')); } if ( *p++ != _T(' ') ) @@ -3463,9 +3463,11 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) } else // may be either day or year { - wxDateTime_t maxDays = haveMon + wxDateTime_t maxDays = (wxDateTime_t)( + haveMon ? GetNumOfDaysInMonth(haveYear ? year : Inv_Year, mon) - : 31; + : 31 + ); // can it be day? if ( (val == 0) || (val > (unsigned long)maxDays) ) @@ -3519,7 +3521,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) { // no need to check in month range as always < 12, but // the days are counted from 1 unlike the months - day = (wxDateTime_t)mon + 1; + day = (wxDateTime_t)(mon + 1); haveDay = true; } else @@ -3641,7 +3643,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) // we're in the current year then if ( (year > 0) && (year <= (int)GetNumOfDaysInMonth(Inv_Year, mon)) ) { - day = year; + day = (wxDateTime_t)year; haveMon = true; haveYear = false; @@ -4028,11 +4030,6 @@ void wxDateTimeHolidayAuthority::AddAuthority(wxDateTimeHolidayAuthority *auth) ms_authorities.push_back(auth); } -wxDateTimeHolidayAuthority::~wxDateTimeHolidayAuthority() -{ - // nothing to do here -} - // ---------------------------------------------------------------------------- // wxDateTimeWorkDays // ---------------------------------------------------------------------------- diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 475867e17b..9f73688a00 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -1351,7 +1351,7 @@ void wxBoxSizer::RecalcSizes() } wxPoint child_pos( pt ); - wxSize child_size( wxSize( size.x, height) ); + wxSize child_size( size.x, height ); if (item->GetFlag() & (wxEXPAND | wxSHAPED)) child_size.x = m_size.x; @@ -1377,7 +1377,7 @@ void wxBoxSizer::RecalcSizes() } wxPoint child_pos( pt ); - wxSize child_size( wxSize(width, size.y) ); + wxSize child_size( width, size.y ); if (item->GetFlag() & (wxEXPAND | wxSHAPED)) child_size.y = m_size.y; diff --git a/src/common/textbuf.cpp b/src/common/textbuf.cpp index 6158973ff1..42268b62ed 100644 --- a/src/common/textbuf.cpp +++ b/src/common/textbuf.cpp @@ -146,10 +146,6 @@ wxTextBuffer::wxTextBuffer(const wxString& strBufferName) m_isOpened = false; } -wxTextBuffer::~wxTextBuffer() -{ -} - // ---------------------------------------------------------------------------- // buffer operations // ---------------------------------------------------------------------------- diff --git a/src/generic/choicbkg.cpp b/src/generic/choicbkg.cpp index 9c3062d742..15390adec2 100644 --- a/src/generic/choicbkg.cpp +++ b/src/generic/choicbkg.cpp @@ -144,7 +144,8 @@ wxRect wxChoicebook::GetPageRect() const { const wxSize sizeChoice = m_choice->GetSize(); - wxRect rectPage(wxPoint(0, 0), GetClientSize()); + wxPoint pt(0, 0); + wxRect rectPage(pt, GetClientSize()); switch ( GetWindowStyle() & wxCHB_ALIGN_MASK ) { default: diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index ac9b77b5e0..64a0c40a1d 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1072,7 +1072,8 @@ void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event) char tmpbuf[2]; tmpbuf[0] = (char) keycode; tmpbuf[1] = '\0'; - bool is_decimal_point = ( wxString(tmpbuf, *wxConvCurrent) == + wxString strbuf(tmpbuf, *wxConvCurrent); + bool is_decimal_point = ( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER) ); if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-' || is_decimal_point @@ -8909,7 +8910,7 @@ void wxGrid::SetDefaultEditor(wxGridCellEditor *editor) { RegisterDataType(wxGRID_VALUE_STRING, GetDefaultRendererForType(wxGRID_VALUE_STRING), - editor); + editor); } // ---------------------------------------------------------------------------- @@ -9891,7 +9892,7 @@ wxSize wxGrid::DoGetBestSize() const if (!width) width=100; if (!height) height=80; - + // Round up to a multiple the scroll rate NOTE: this still doesn't get rid // of the scrollbars, is there any magic incantaion for that? int xpu, ypu; @@ -9900,16 +9901,16 @@ wxSize wxGrid::DoGetBestSize() const width += 1 + xpu - (width % xpu); if (ypu) height += 1 + ypu - (height % ypu); - + // limit to 1/4 of the screen size int maxwidth, maxheight; wxDisplaySize( & maxwidth, & maxheight ); maxwidth /= 2; - maxheight /= 2; + maxheight /= 2; if ( width > maxwidth ) width = maxwidth; if ( height > maxheight ) height = maxheight; - + wxSize best(width, height); // NOTE: This size should be cached, but first we need to add calls to // InvalidateBestSize everywhere that could change the results of this diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index 34d726efe7..3b10666dcb 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -172,7 +172,8 @@ wxRect wxListbook::GetPageRect() const { const wxSize sizeList = m_list->GetSize(); - wxRect rectPage(wxPoint(0, 0), GetClientSize()); + wxPoint pt(0, 0); + wxRect rectPage(pt, GetClientSize()); switch ( GetWindowStyle() & wxLB_ALIGN_MASK ) { default: @@ -401,7 +402,7 @@ wxListbook::InsertPage(size_t n, // index of the selected page if ( int(n) <= m_selection ) { - // one extra page added + // one extra page added m_selection++; m_list->Select(m_selection); m_list->Focus(m_selection); diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index ad855afdbc..e6469b11ee 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -483,8 +483,10 @@ void wxSashWindow::DrawSash(wxSashEdgePosition edge, wxDC& dc) wxPen darkShadowPen(m_darkShadowColour, 1, wxSOLID); wxPen lightShadowPen(m_lightShadowColour, 1, wxSOLID); wxPen hilightPen(m_hilightColour, 1, wxSOLID); - wxPen blackPen(wxColour(0, 0, 0), 1, wxSOLID); - wxPen whitePen(wxColour(255, 255, 255), 1, wxSOLID); + wxColour blackClr(0, 0, 0); + wxColour whiteClr(255, 255, 255); + wxPen blackPen(blackClr, 1, wxSOLID); + wxPen whitePen(whiteClr, 1, wxSOLID); if ( edge == wxSASH_LEFT || edge == wxSASH_RIGHT ) { diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index 327cc5fa4e..9d5e70638d 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -82,7 +82,7 @@ wxHtmlHelpIndexCompareFunc(wxHtmlHelpDataItem **a, wxHtmlHelpDataItem **b) return -1; if (ib == NULL) return 1; - + if (ia->parent == ib->parent) { return ia->name.CmpNoCase(ib->name); @@ -686,7 +686,7 @@ bool wxHtmlHelpData::AddBook(const wxString& book) lineptr = ReadLine(lineptr, linebuf, 300); for (wxChar *ch = linebuf; *ch != wxT('\0') && *ch != wxT('='); ch++) - *ch = tolower(*ch); + *ch = (wxChar)wxTolower(*ch); if (wxStrstr(linebuf, _T("title=")) == linebuf) title = linebuf + wxStrlen(_T("title=")); diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index bf3223b784..5858f92b08 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -1674,7 +1674,7 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) // other items, show them as well, because they are refinements // of the displayed index entry (i.e. it is implicitly contained // in them: "foo" with parent "bar" reads as "bar, foo"): - short int level = index[i].items[0]->level; + int level = index[i].items[0]->level; i++; while (i < cnt && index[i].items[0]->level > level) { diff --git a/src/html/htmltag.cpp b/src/html/htmltag.cpp index a8e30676ec..1b9b7bd784 100644 --- a/src/html/htmltag.cpp +++ b/src/html/htmltag.cpp @@ -90,7 +90,7 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source) src[pos] != wxT('>') && !wxIsspace(src[pos]); i++, pos++ ) { - tagBuffer[i] = wxToupper(src[pos]); + tagBuffer[i] = (wxChar)wxToupper(src[pos]); } tagBuffer[i] = _T('\0'); diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index df49c91cc6..1fc6d08142 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -513,7 +513,9 @@ wxString wxListBox::GetString(int N) const // +1 for terminating NUL wxString result; - ListBox_GetText(GetHwnd(), N, wxStringBuffer(result, len + 1)); + wxChar* buffer = result.GetWriteBuf(len + 1); + ListBox_GetText(GetHwnd(), N, buffer); + result.UngetWriteBuf(); return result; } @@ -805,8 +807,9 @@ bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) wxListBoxItem *pItem = (wxListBoxItem *)data; wxDCTemp dc((WXHDC)pStruct->hDC); - wxRect rect(wxPoint(pStruct->rcItem.left, pStruct->rcItem.top), - wxPoint(pStruct->rcItem.right, pStruct->rcItem.bottom)); + wxPoint pt1(pStruct->rcItem.left, pStruct->rcItem.top); + wxPoint pt2(pStruct->rcItem.right, pStruct->rcItem.bottom); + wxRect rect(pt1, pt2); return pItem->OnDrawItem(dc, rect, (wxOwnerDrawn::wxODAction)pStruct->itemAction, diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index 9647ae1217..13f59406cd 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -151,11 +151,6 @@ wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName, } } -wxRegConfig::~wxRegConfig() -{ - // nothing to do - key will be closed in their dtors -} - // ---------------------------------------------------------------------------- // path management // ---------------------------------------------------------------------------- diff --git a/src/xml/xml.cpp b/src/xml/xml.cpp index 80c76829fc..f55ad6f7a1 100644 --- a/src/xml/xml.cpp +++ b/src/xml/xml.cpp @@ -482,7 +482,8 @@ static int UnknownEncodingHnd(void * WXUNUSED(encodingHandlerData), // We must build conversion table for expat. The easiest way to do so // is to let wxCSConv convert as string containing all characters to // wide character representation: - wxCSConv conv(wxString(name, wxConvLibc)); + wxString str(name, wxConvLibc); + wxCSConv conv(str); char mbBuf[2]; wchar_t wcBuf[10]; size_t i; @@ -499,7 +500,7 @@ static int UnknownEncodingHnd(void * WXUNUSED(encodingHandlerData), } info->map[i+1] = (int)wcBuf[0]; } - + info->data = NULL; info->convert = NULL; info->release = NULL; -- 2.45.2