]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/stream.cpp
added GetWindowSizeForVirtualSize() virtual hook for wxScrolledWindow (cuts down...
[wxWidgets.git] / src / common / stream.cpp
index 347b46ee8b2ee865594e709292fc8df4fc26f132..07984617d2d268365da5c4367ecb73f733024165 100644 (file)
 // 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 )
     {