]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/filefn.h
*** empty log message ***
[wxWidgets.git] / include / wx / filefn.h
index 551d9f6852c8c83a723f6320200dedaad88bf6c1..b977aaf14a5384a874d8efdf6cbab3a98e5743c3 100644 (file)
@@ -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
 
 // ----------------------------------------------------------------------------