X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4ae9be50fdfe9129525dba37f6982fcaf1db8b95..8c985698885689f9e60b0d03f469e3a566fc7410:/include/wx/filefn.h diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 551d9f6852..b977aaf14a 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -131,6 +131,7 @@ enum wxSeekMode // Implemented in filefnwce.cpp #if defined( __WXWINCE__) typedef __int64 wxFileOffset; + typedef unsigned __int64 wxFileSize_t; #define wxFileOffsetFmtSpec _("I64") int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode)); int wxAccess(const wxChar *name, int WXUNUSED(how)); @@ -173,7 +174,9 @@ enum wxSeekMode // detect compilers which have support for huge files (currently only // Digital Mars doesn't) + #ifndef __PALMOS__ #include "wx/msw/private.h" + #endif #undef wxHAS_HUGE_FILES #if defined(__MINGW32__) @@ -195,10 +198,11 @@ enum wxSeekMode #if wxHAS_HUGE_FILES typedef wxLongLong_t wxFileOffset; + typedef unsigned wxLongLong_t wxFileSize_t; #define wxFileOffsetFmtSpec wxLongLongFmtSpec #else typedef off_t wxFileOffset; - #define wxFileOffsetFmtSpec _("") + typedef unsigned long wxFileSize_t; #endif #define wxClose _close @@ -214,7 +218,12 @@ enum wxSeekMode _write(fd, (const char *)buf, nCount) #endif #else - #if defined(__DMC__) || defined(__WATCOMC__) + #if defined(__WATCOMC__) + inline wxFileSize_t wxRead( int handle, void *buffer, wxFileSize_t len ) + { return ::read( handle, buffer, (unsigned int)len ); } + inline wxFileSize_t wxWrite( int handle, const void *buffer, wxFileSize_t len ) + { return ::write( handle, buffer, (unsigned int)len ); } + #elif defined(__DMC__) #define wxRead ::read #define wxWrite ::write #else @@ -298,20 +307,22 @@ enum wxSeekMode #endif // constants (unless already defined by the user code) - #if !defined(O_RDONLY) && !defined(__BORLANDC__) && !defined(__WATCOMC__) - #define O_RDONLY _O_RDONLY - #define O_WRONLY _O_WRONLY - #define O_RDWR _O_RDWR - #define O_EXCL _O_EXCL - #define O_CREAT _O_CREAT - #define O_BINARY _O_BINARY - #endif + #if !defined(__BORLANDC__) && !defined(__WATCOMC__) && !defined(__PALMOS__) + #ifndef O_RDONLY + #define O_RDONLY _O_RDONLY + #define O_WRONLY _O_WRONLY + #define O_RDWR _O_RDWR + #define O_EXCL _O_EXCL + #define O_CREAT _O_CREAT + #define O_BINARY _O_BINARY + #endif - #if !defined(__BORLANDC__) && !defined(__WATCOMC__) - #define S_IFMT _S_IFMT - #define S_IFDIR _S_IFDIR - #define S_IFREG _S_IFREG - #endif // O_RDONLY + #ifndef S_IFMT + #define S_IFMT _S_IFMT + #define S_IFDIR _S_IFDIR + #define S_IFREG _S_IFREG + #endif + #endif // It's a private define, undefine it so nobody gets tempted to use it #undef wxHAS_HUGE_FILES @@ -319,8 +330,12 @@ enum wxSeekMode typedef off_t wxFileOffset; #ifdef _LARGE_FILES #define wxFileOffsetFmtSpec wxLongLongFmtSpec + wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t), + BadFileSizeType ); + typedef unsigned wxLongLong_t wxFileSize_t; #else #define wxFileOffsetFmtSpec _T("") + typedef unsigned long wxFileSize_t; #endif // functions #define wxClose close @@ -358,9 +373,9 @@ enum wxSeekMode // VisualAge C++ V4.0 cannot have any external linkage const decs // in headers included by more than one primary source // -extern const wxFileOffset wxInvalidOffset; +extern const wxFileSize_t wxInvalidOffset; #else -const wxFileOffset wxInvalidOffset = (wxFileOffset)-1; +const wxFileSize_t wxInvalidOffset = (wxFileSize_t)-1; #endif // ----------------------------------------------------------------------------