X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/15dc68b6b8e726c5fc6addfe7247b90fe7c9ce31..ee146bca1b2d76b3e486c66a2d5ad15e44f2cbd0:/src/common/stream.cpp diff --git a/src/common/stream.cpp b/src/common/stream.cpp index 347b46ee8b..07984617d2 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -18,10 +18,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "stream.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -580,7 +576,7 @@ wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode) } if (diff < 0 || diff > last_access) return wxInvalidOffset; - size_t int_diff = (size_t)diff; + size_t int_diff = wx_truncate_cast(size_t, diff); wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") ); SetIntPosition(int_diff); return diff; @@ -607,7 +603,7 @@ wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode) } else { - size_t int_diff = (size_t)diff; + size_t int_diff = wx_truncate_cast(size_t, diff); wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") ); SetIntPosition(int_diff); return pos; @@ -664,7 +660,13 @@ wxStreamBase::~wxStreamBase() size_t wxStreamBase::GetSize() const { wxFileOffset length = GetLength(); - return length == wxInvalidOffset ? 0 : (size_t)length; + if ( length == wxInvalidOffset ) + return 0; + + const size_t len = wx_truncate_cast(size_t, length); + wxASSERT_MSG( len == length, _T("large files not supported") ); + + return len; } wxFileOffset wxStreamBase::OnSysSeek(wxFileOffset WXUNUSED(seek), wxSeekMode WXUNUSED(mode)) @@ -677,20 +679,6 @@ wxFileOffset wxStreamBase::OnSysTell() const return wxInvalidOffset; } -#if WXWIN_COMPATIBILITY_2_2 - -wxStreamError wxStreamBase::LastError() const -{ - return m_lasterror; -} - -size_t wxStreamBase::StreamSize() const -{ - return GetSize(); -} - -#endif // WXWIN_COMPATIBILITY_2_2 - // ---------------------------------------------------------------------------- // wxInputStream // ---------------------------------------------------------------------------- @@ -998,7 +986,7 @@ size_t wxCountingOutputStream::OnSysWrite(const void *WXUNUSED(buffer), wxFileOffset wxCountingOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode) { - ssize_t new_pos = (ssize_t)pos; + ssize_t new_pos = wx_truncate_cast(ssize_t, pos); switch ( mode ) {