// 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"
}
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;
}
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;
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))
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
// ----------------------------------------------------------------------------
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 )
{