]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/wince/filefnwce.cpp
Fixed undo batching
[wxWidgets.git] / src / msw / wince / filefnwce.cpp
index c9bce9c17dff9dda2fd432723c40eb86c0f97a71..c96cc14f9054476356335c9c8081fee619773dba 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        filefn.cpp
+// Name:        src/msw/wince/filefn.cpp
 // Purpose:     File- and directory-related functions
 // Author:      Julian Smart
 // Modified by:
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
-#include "wx/defs.h"
-#include "wx/file.h"
 
 #ifdef __BORLANDC__
     #pragma hdrstop
 #endif
 
+#include "wx/file.h"
+
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -34,7 +34,7 @@
 #ifdef __WXWINCE__
 #include "wx/msw/wince/missing.h"
 
-int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode))
+int wxCRT_Open(const wxChar *filename, int oflag, int WXUNUSED(pmode))
 {
     DWORD access = 0;
     DWORD shareMode = 0;
@@ -44,16 +44,19 @@ int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode))
     {
         access = GENERIC_READ;
         shareMode = FILE_SHARE_READ|FILE_SHARE_WRITE;
-        disposition |= OPEN_EXISTING;
+        disposition = OPEN_EXISTING;
     }
     else if ((oflag & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY)
     {
         access = GENERIC_WRITE;
+        disposition = OPEN_ALWAYS;
     }
     else if ((oflag & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDWR)
     {
         access = GENERIC_READ|GENERIC_WRITE;
+        disposition = OPEN_ALWAYS;
     }
+
     if (oflag & O_APPEND)
     {
         if ( wxFile::Exists(filename) )
@@ -62,16 +65,16 @@ int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode))
             shareMode = FILE_SHARE_READ;
             disposition = OPEN_EXISTING;
         }
-        //else: fall through as write_append is the same as write if the
-        //      file doesn't exist
         else
+        {
             oflag |= O_TRUNC;
+        }
     }
     if (oflag & O_TRUNC)
     {
         access |= GENERIC_WRITE;
         shareMode = 0;
-        disposition = (oflag & O_CREAT) ? CREATE_ALWAYS : TRUNCATE_EXISTING;
+        disposition = oflag & O_CREAT ? CREATE_ALWAYS : TRUNCATE_EXISTING;
     }
     else if (oflag & O_CREAT)
     {
@@ -97,7 +100,7 @@ int wxOpen(const wxChar *filename, int oflag, int WXUNUSED(pmode))
     return fd;
 }
 
-int wxAccess(const wxChar *name, int WXUNUSED(how))
+int wxCRT_Access(const wxChar *name, int WXUNUSED(how))
 {
     HANDLE fileHandle = ::CreateFile(name, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
         OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
@@ -123,12 +126,12 @@ int wxEof(int fd)
     DWORD off0 = SetFilePointer((HANDLE) fd, 0, &high0, FILE_CURRENT);
     if (off0 == 0xFFFFFFFF && GetLastError() != NO_ERROR)
         return -1;
-    
+
     LONG high1 = 0;
     DWORD off1 = SetFilePointer((HANDLE) fd, 0, &high0, FILE_END);
     if (off1 == 0xFFFFFFFF && GetLastError() != NO_ERROR)
         return -1;
-    
+
     if (off0 == off1 && high0 == high1)
         return 1;
     else