[Unison-hackers] [unison-svn] r422 - in trunk/src: . lwt system

vouillon@seas.upenn.edu vouillon at seas.upenn.edu
Tue Mar 23 11:07:14 EDT 2010


Author: vouillon
Date: 2010-03-23 11:07:12 -0400 (Tue, 23 Mar 2010)
New Revision: 422

Modified:
   trunk/src/RECENTNEWS
   trunk/src/lwt/lwt_unix_stubs.c
   trunk/src/mkProjectInfo.ml
   trunk/src/system/system_win_stubs.c
Log:
* Windows: fix C includes for compilation with MSVC
* Windows: implement somewhat the O_APPEND flag, so that appending
  lines to a profile (ignored files, for instance) works instead of
  overwriting the beginning of the file (the file pointer is moved to
  the end when the file is opened, rather that each time something is
  written, which is good enough here)


Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS	2010-03-17 22:34:35 UTC (rev 421)
+++ trunk/src/RECENTNEWS	2010-03-23 15:07:12 UTC (rev 422)
@@ -1,5 +1,15 @@
 CHANGES FROM VERSION 2.40.1
 
+* Windows: fix C includes for compilation with MSVC
+* Windows: implement somewhat the O_APPEND flag, so that appending
+  lines to a profile (ignored files, for instance) works instead of
+  overwriting the beginning of the file (the file pointer is moved to
+  the end when the file is opened, rather that each time something is
+  written, which is good enough here)
+
+-------------------------------
+CHANGES FROM VERSION 2.40.1
+
 * Added a "fat" preference that makes Unison use the right options
   when one of the replica is on a FAT filesystem.
 * Allow "prefer/force=newer" even when not synchronizing modification

Modified: trunk/src/lwt/lwt_unix_stubs.c
===================================================================
--- trunk/src/lwt/lwt_unix_stubs.c	2010-03-17 22:34:35 UTC (rev 421)
+++ trunk/src/lwt/lwt_unix_stubs.c	2010-03-23 15:07:12 UTC (rev 422)
@@ -1,7 +1,5 @@
-#include <wtypes.h>
-#include <winbase.h>
-#include <mswsock.h>
 #include <winsock2.h>
+#include <windows.h>
 #include <errno.h>
 #include <stdio.h>
 
@@ -113,10 +111,10 @@
   D(printf("Queueing action %s: id %ld -> len %ld / err %d (errCode %ld)\n",
            action_name[action], id, len, errno, errCode));
   if (compN + 1 > complQueueSize) {
+    completionInfo * queue;
     int n = complQueueSize * 2 + 1;
     D(printf("Resizing queue to %d\n", n));
-    completionInfo * queue =
-      (completionInfo *) GlobalAlloc(GPTR, n * sizeof(completionInfo));
+    queue = (completionInfo *) GlobalAlloc(GPTR, n * sizeof(completionInfo));
     if (complQueue != NULL)
       CopyMemory (queue, complQueue, complQueueSize * sizeof(completionInfo));
     complQueue = queue;

Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml	2010-03-17 22:34:35 UTC (rev 421)
+++ trunk/src/mkProjectInfo.ml	2010-03-23 15:07:12 UTC (rev 422)
@@ -100,3 +100,4 @@
 
 
 
+

Modified: trunk/src/system/system_win_stubs.c
===================================================================
--- trunk/src/system/system_win_stubs.c	2010-03-17 22:34:35 UTC (rev 421)
+++ trunk/src/system/system_win_stubs.c	2010-03-23 15:07:12 UTC (rev 422)
@@ -5,23 +5,9 @@
 
 #define WINVER 0x0500
 
-#include <wtypes.h>
-#include <winbase.h>
+#include <windows.h>
 #include <fcntl.h>
-#include <io.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <share.h>
-#include <errno.h>
-#include <utime.h>
-#include <wchar.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <time.h>
-#include <ctype.h>
-#include <direct.h>
-#include <stdio.h>
-#include <windows.h>
 
 #define NT_MAX_PATH 32768
 
@@ -62,11 +48,6 @@
   0, 0, 0, 0, 0, O_CREAT, O_TRUNC, O_EXCL, 0, 0, 0, 0
 };
 
-static int open_flag_table[12] = {
-  _O_RDONLY, _O_WRONLY, _O_RDWR, 0, _O_APPEND, _O_CREAT, _O_TRUNC,
-  _O_EXCL, 0, 0, 0, 0
-};
-
 /****/
 
 CAMLprim value win_rmdir(value path, value wpath)
@@ -244,6 +225,8 @@
     uerror("open", path);
   }
 
+  if (createflags & O_APPEND) SetFilePointer (h, 0, NULL, FILE_END);
+
   CAMLreturn(win_alloc_handle(h));
 }
 



More information about the Unison-hackers mailing list