Just #define O_BINARY as 0 on Unix, less ifdefs that way. Should really do
authorTor Lillqvist <tml@novell.com>
Fri, 9 Dec 2005 07:57:08 +0000 (07:57 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Fri, 9 Dec 2005 07:57:08 +0000 (07:57 +0000)
2005-12-09  Tor Lillqvist  <tml@novell.com>

* camel-mbox-folder.c: Just #define O_BINARY as 0 on Unix, less
ifdefs that way. Should really do this in some suitable header, of
course, and not duplicate here and there.

camel/providers/local/ChangeLog
camel/providers/local/camel-mbox-folder.c

index d5018e8..8545055 100644 (file)
@@ -1,3 +1,9 @@
+2005-12-09  Tor Lillqvist  <tml@novell.com>
+
+       * camel-mbox-folder.c: Just #define O_BINARY as 0 on Unix, less
+       ifdefs that way. Should really do this in some suitable header, of
+       course, and not duplicate here and there.
+
 2005-12-09  David Malcolm  <dmalcolm@redhat.com>
 
        * camel-local-folder.c: restore missing declarations for non-Win32 
index 415eb39..d4ad3aa 100644 (file)
 #include "camel-mbox-store.h"
 #include "camel-mbox-summary.h"
 
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
 
 static CamelLocalFolderClass *parent_class = NULL;
@@ -185,7 +189,6 @@ mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const Camel
        char *fromline = NULL;
        int fd, retval;
        struct stat st;
-       int mode;
 #if 0
        char *xev;
 #endif
@@ -288,12 +291,7 @@ fail_write:
        g_free(fromline);
 
        /* reset the file to original size */
-#ifdef G_OS_WIN32
-       mode = O_WRONLY | O_BINARY;
-#else
-       mode = O_WRONLY;
-#endif
-       fd = g_open(lf->folder_path, mode, 0600);
+       fd = g_open(lf->folder_path, O_WRONLY | O_BINARY, 0600);
        if (fd != -1) {
                ftruncate(fd, mbs->folder_size);
                close(fd);
@@ -329,7 +327,6 @@ mbox_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex)
        int fd, retval;
        int retried = FALSE;
        off_t frompos;
-       int mode;
 
        d(printf("Getting message %s\n", uid));
 
@@ -365,13 +362,7 @@ retry:
           with no stream).  This means we dont have to lock the mbox for the life of the message, but only
           while it is being created. */
 
-#ifdef G_OS_WIN32
-       mode = O_RDONLY | O_BINARY;
-#else
-       mode = O_RDONLY;
-#endif
-
-       fd = g_open(lf->folder_path, mode, 0);
+       fd = g_open(lf->folder_path, O_RDONLY | O_BINARY, 0);
        if (fd == -1) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
                                      _("Cannot get message: %s from folder %s\n  %s"),