X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/30984deafc05d7c6f88db736336fe73d23a08e19..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/common/file.cpp?ds=sidebyside diff --git a/src/common/file.cpp b/src/common/file.cpp index 55d70d03db..9985b9d448 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -144,14 +144,6 @@ #include "wx/msw/private.h" #endif -#if !defined __UNIX__ && !defined __DJGPP__ - #ifdef __WXWINCE__ - typedef int ssize_t; - #else - typedef ptrdiff_t ssize_t; - #endif -#endif -wxCOMPILE_TIME_ASSERT(sizeof(ssize_t) == sizeof(size_t), ssize_t_wrong_size); // ============================================================================ // implementation of wxFile @@ -307,7 +299,7 @@ bool wxFile::Close() // ---------------------------------------------------------------------------- // read -size_t wxFile::Read(void *pBuf, size_t nCount) +ssize_t wxFile::Read(void *pBuf, size_t nCount) { wxCHECK( (pBuf != NULL) && IsOpened(), 0 ); @@ -316,7 +308,7 @@ size_t wxFile::Read(void *pBuf, size_t nCount) if ( iRc == -1 ) { wxLogSysError(_("can't read from file descriptor %d"), m_fd); - return (size_t)wxInvalidOffset; + return wxInvalidOffset; } return iRc; @@ -364,7 +356,10 @@ bool wxFile::Flush() // seek wxFileOffset wxFile::Seek(wxFileOffset ofs, wxSeekMode mode) { - wxASSERT( IsOpened() ); + wxASSERT_MSG( IsOpened(), _T("can't seek on closed file") ); + wxCHECK_MSG( ofs != wxInvalidOffset || mode != wxFromStart, + wxInvalidOffset, + _T("invalid absolute file offset") ); int origin; switch ( mode ) { @@ -384,11 +379,6 @@ wxFileOffset wxFile::Seek(wxFileOffset ofs, wxSeekMode mode) break; } - if (ofs == wxInvalidOffset) - { - wxLogSysError(_("can't seek on file descriptor %d, large files support is not enabled."), m_fd); - return wxInvalidOffset; - } wxFileOffset iRc = wxSeek(m_fd, ofs, origin); if ( iRc == wxInvalidOffset ) {