From 4a10ea8b13fd0851e71e6fa5ebbe5b93933be11e Mon Sep 17 00:00:00 2001 From: Michael Wetherell Date: Mon, 17 Oct 2005 22:08:05 +0000 Subject: [PATCH] Warning fixes for win64 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35921 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/dnd/dnd.cpp | 2 +- src/common/docview.cpp | 20 ++++++++++---------- src/common/imagtiff.cpp | 4 ++-- src/common/intl.cpp | 4 ++-- src/common/mstream.cpp | 2 +- src/common/sizer.cpp | 6 ++++-- src/common/stream.cpp | 2 +- src/generic/calctrl.cpp | 4 ++-- src/generic/choicbkg.cpp | 2 +- src/generic/gridctrl.cpp | 2 +- src/generic/listbkg.cpp | 2 +- src/generic/tipwin.cpp | 2 +- src/msw/listbox.cpp | 2 +- src/msw/ole/dataobj.cpp | 2 +- src/msw/tbar95.cpp | 3 ++- 15 files changed, 31 insertions(+), 28 deletions(-) diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index acc50c0..5b82178 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -522,7 +522,7 @@ public: virtual size_t GetFormatCount(Direction dir) const { // our custom format is supported by both GetData() and SetData() - size_t nFormats = 1; + ULONG nFormats = 1; if ( dir == Get ) { // but the bitmap format(s) are only supported for output diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 152b810..5e2cada 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -2193,20 +2193,20 @@ void wxFileHistory::RemoveFileFromHistory(size_t i) wxList::compatibility_iterator node = m_fileMenus.GetFirst(); while ( node ) { - wxMenu* menu = (wxMenu*) node->GetData(); + wxMenu* menu = (wxMenu*) node->GetData(); - // shuffle filenames up - wxString buf; - for ( j = i; j < m_fileHistoryN - 1; j++ ) - { - buf.Printf(s_MRUEntryFormat, j + 1, m_fileHistory[j]); - menu->SetLabel(m_idBase + j, buf); - } + // shuffle filenames up + wxString buf; + for ( j = i; j < m_fileHistoryN - 1; j++ ) + { + buf.Printf(s_MRUEntryFormat, j + 1, m_fileHistory[j]); + menu->SetLabel(m_idBase + j, buf); + } - node = node->GetNext(); + node = node->GetNext(); // delete the last menu item which is unused now - wxWindowID lastItemId = m_idBase + m_fileHistoryN - 1; + wxWindowID lastItemId = m_idBase + wx_truncate_cast(wxWindowID, m_fileHistoryN) - 1; if (menu->FindItem(lastItemId)) { menu->Delete(lastItemId); diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index 07202e5..8c7d45a 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -94,7 +94,7 @@ _tiffReadProc(thandle_t handle, tdata_t buf, tsize_t size) { wxInputStream *stream = (wxInputStream*) handle; stream->Read( (void*) buf, (size_t) size ); - return stream->LastRead(); + return wx_truncate_cast(tsize_t, stream->LastRead()); } tsize_t TIFFLINKAGEMODE @@ -102,7 +102,7 @@ _tiffWriteProc(thandle_t handle, tdata_t buf, tsize_t size) { wxOutputStream *stream = (wxOutputStream*) handle; stream->Write( (void*) buf, (size_t) size ); - return stream->LastWrite(); + return wx_truncate_cast(tsize_t, stream->LastWrite()); } toff_t TIFFLINKAGEMODE diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 05dfb36..548776f 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1137,7 +1137,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName, return false; size_t nSize = wx_truncate_cast(size_t, lenFile); - wxASSERT_MSG( nSize == lenFile, _T("message catalog bigger than 4GB?") ); + wxASSERT_MSG( nSize == lenFile + size_t(0), _T("message catalog bigger than 4GB?") ); // read the whole file in memory m_pData = new size_t8[nSize]; @@ -1317,7 +1317,7 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T (void)convertEncoding; // get rid of warnings about unused parameter - for (size_t i = 0; i < m_numStrings; i++) + for (size_t32 i = 0; i < m_numStrings; i++) { const char *data = StringAtOfs(m_pOrigTable, i); #if wxUSE_UNICODE diff --git a/src/common/mstream.cpp b/src/common/mstream.cpp index 4f1886e..ce78979 100644 --- a/src/common/mstream.cpp +++ b/src/common/mstream.cpp @@ -59,7 +59,7 @@ wxMemoryInputStream::wxMemoryInputStream(const wxMemoryOutputStream& stream) } const size_t len = wx_truncate_cast(size_t, lenFile); - wxASSERT_MSG( len == lenFile, _T("huge files not supported") ); + wxASSERT_MSG( len == lenFile + size_t(0), _T("huge files not supported") ); m_i_streambuf = new wxStreamBuffer(wxStreamBuffer::read); m_i_streambuf->SetBufferIO(len); // create buffer diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index a2218c3..5db2c30 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -1324,10 +1324,12 @@ void wxFlexGridSizer::AdjustForFlexDirection() wxArrayInt& array = m_flexDirection == wxVERTICAL ? m_colWidths : m_rowHeights; - const int count = array.GetCount(); + const size_t count = array.GetCount(); // find the largest value in this array - int n, largest = 0; + size_t n; + int largest = 0; + for ( n = 0; n < count; ++n ) { if ( array[n] > largest ) diff --git a/src/common/stream.cpp b/src/common/stream.cpp index 0798461..435b60f 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -664,7 +664,7 @@ size_t wxStreamBase::GetSize() const return 0; const size_t len = wx_truncate_cast(size_t, length); - wxASSERT_MSG( len == length, _T("large files not supported") ); + wxASSERT_MSG( len == length + size_t(0), _T("large files not supported") ); return len; } diff --git a/src/generic/calctrl.cpp b/src/generic/calctrl.cpp index 7adb122..854e28e 100644 --- a/src/generic/calctrl.cpp +++ b/src/generic/calctrl.cpp @@ -974,7 +974,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) dc.DrawRectangle(0, y, GetClientSize().x, m_heightRow); bool startOnMonday = (GetWindowStyle() & wxCAL_MONDAY_FIRST) != 0; - for ( size_t wd = 0; wd < 7; wd++ ) + for ( int wd = 0; wd < 7; wd++ ) { size_t n; if ( startOnMonday ) @@ -1014,7 +1014,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) wxLogDebug("painting week %d at y = %d\n", nWeek, y); #endif - for ( size_t wd = 0; wd < 7; wd++ ) + for ( int wd = 0; wd < 7; wd++ ) { if ( IsDateShown(date) ) { diff --git a/src/generic/choicbkg.cpp b/src/generic/choicbkg.cpp index db4b2f1..930a5b3 100644 --- a/src/generic/choicbkg.cpp +++ b/src/generic/choicbkg.cpp @@ -364,7 +364,7 @@ wxChoicebook::InsertPage(size_t n, wxWindow *wxChoicebook::DoRemovePage(size_t page) { - const int page_count = GetPageCount(); + const size_t page_count = GetPageCount(); wxWindow *win = wxBookCtrlBase::DoRemovePage(page); if ( win ) diff --git a/src/generic/gridctrl.cpp b/src/generic/gridctrl.cpp index 2fcacdf..1f1fd61 100644 --- a/src/generic/gridctrl.cpp +++ b/src/generic/gridctrl.cpp @@ -390,7 +390,7 @@ wxGridCellAutoWrapStringRenderer::GetBestSize(wxGrid& grid, { width+=10; rect.SetWidth(width); - height = y *( GetTextLines(grid,dc,attr,rect,row,col).GetCount()); + height = y * (wx_truncate_cast(wxCoord, GetTextLines(grid,dc,attr,rect,row,col).GetCount())); count--; // Search for a shape no taller than the golden ratio. } while (count && (width < (height*1.68)) ); diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index dac6330..ea064e2 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -437,7 +437,7 @@ wxListbook::InsertPage(size_t n, wxWindow *wxListbook::DoRemovePage(size_t page) { - const int page_count = GetPageCount(); + const size_t page_count = GetPageCount(); wxWindow *win = wxBookCtrlBase::DoRemovePage(page); if ( win ) diff --git a/src/generic/tipwin.cpp b/src/generic/tipwin.cpp index 2eba71e..9749b8a 100644 --- a/src/generic/tipwin.cpp +++ b/src/generic/tipwin.cpp @@ -315,7 +315,7 @@ void wxTipWindowView::Adjust(const wxString& text, wxCoord maxLength) // take into account the border size and the margins width = 2*(TEXT_MARGIN_X + 1) + widthMax; - height = 2*(TEXT_MARGIN_Y + 1) + m_parent->m_textLines.GetCount()*m_parent->m_heightLine; + height = 2*(TEXT_MARGIN_Y + 1) + wx_truncate_cast(wxCoord, m_parent->m_textLines.GetCount())*m_parent->m_heightLine; m_parent->SetClientSize(width, height); SetSize(0, 0, width, height); } diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index e8bfb9b..71cc9a4 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -354,7 +354,7 @@ int wxListBox::FindString(const wxString& s, bool bCase) const if (bCase) return wxItemContainerImmutable::FindString( s, bCase ); - int pos = ListBox_FindStringExact(GetHwnd(), (WPARAM)-1, s); + int pos = ListBox_FindStringExact(GetHwnd(), -1, s); if (pos == LB_ERR) return wxNOT_FOUND; else diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index a0eafe5..b6da92a 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -620,7 +620,7 @@ STDMETHODIMP wxIDataObject::EnumFormatEtc(DWORD dwDir, wxDataObject::Direction dir = dwDir == DATADIR_GET ? wxDataObject::Get : wxDataObject::Set; - size_t nFormatCount = m_pDataObject->GetFormatCount(dir); + ULONG nFormatCount = wx_truncate_cast(ULONG, m_pDataObject->GetFormatCount(dir)); wxDataFormat format; wxDataFormat *formats; formats = nFormatCount == 1 ? &format : new wxDataFormat[nFormatCount]; diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 1fce389d..754543b 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -599,7 +599,8 @@ bool wxToolBar::Realize() sizeBmp.x = m_defaultWidth; sizeBmp.y = m_defaultHeight; - const wxCoord totalBitmapWidth = m_defaultWidth * nTools, + const wxCoord totalBitmapWidth = m_defaultWidth * + wx_truncate_cast(wxCoord, nTools), totalBitmapHeight = m_defaultHeight; // Create a bitmap and copy all the tool bitmaps to it -- 2.7.4