add #ifdef HAVE_ALLOCA_H
[platform/upstream/evolution-data-server.git] / camel / camel-movemail.c
index d5cc335..a0873b2 100644 (file)
@@ -35,6 +35,9 @@
 #include <unistd.h>
 #include <string.h>
 #include <signal.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 
 #include "camel-movemail.h"
 #include "camel-exception.h"
@@ -53,8 +56,10 @@ static void movemail_external (const char *source, const char *dest,
 #endif
 
 /* these could probably be exposed as a utility? (but only mbox needs it) */
+#if 0
 static int camel_movemail_copy_filter(int fromfd, int tofd, off_t start, size_t bytes, CamelMimeFilter *filter);
 static int camel_movemail_copy(int fromfd, int tofd, off_t start, size_t bytes);
+#endif
 
 /**
  * camel_movemail: Copy an mbox file from a shared spool directory to a
@@ -91,8 +96,8 @@ camel_movemail (const char *source, const char *dest, CamelException *ex)
        if (stat (source, &st) == -1) {
                if (errno != ENOENT) {
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                             "Could not check mail file "
-                                             "%s: %s", source,
+                                             _("Could not check mail file "
+                                               "%s: %s"), source,
                                              g_strerror (errno));
                }
                return;
@@ -128,8 +133,9 @@ camel_movemail (const char *source, const char *dest, CamelException *ex)
                }
 #endif
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     "Could not create lock file "
-                                     "for %s: %s", source, g_strerror (errno));
+                                     _("Could not create lock file "
+                                       "for %s: %s"), source,
+                                     g_strerror (errno));
                return;
        }
        close (tmpfd);
@@ -137,7 +143,7 @@ camel_movemail (const char *source, const char *dest, CamelException *ex)
        sfd = open (source, O_RDWR);
        if (sfd == -1) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     "Could not open mail file %s: %s",
+                                     _("Could not open mail file %s: %s"),
                                      source, g_strerror (errno));
                unlink (locktmpfile);
                g_free (locktmpfile);
@@ -147,8 +153,9 @@ camel_movemail (const char *source, const char *dest, CamelException *ex)
        dfd = open (dest, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
        if (dfd == -1) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     "Could not open temporary mail "
-                                     "file %s: %s", dest, g_strerror (errno));
+                                     _("Could not open temporary mail "
+                                       "file %s: %s"), dest,
+                                     g_strerror (errno));
                close (sfd);
                unlink (locktmpfile);
                g_free (locktmpfile);
@@ -173,8 +180,8 @@ camel_movemail (const char *source, const char *dest, CamelException *ex)
                 */
                if (errno != EEXIST) {
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                             "Could not create lock "
-                                             "file for %s: %s", source,
+                                             _("Could not create lock "
+                                               "file for %s: %s"), source,
                                              g_strerror (errno));
                        break;
                }
@@ -187,8 +194,8 @@ camel_movemail (const char *source, const char *dest, CamelException *ex)
 
                        /* Some other error. Abort. */
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                             "Could not test lock "
-                                             "file for %s: %s", source,
+                                             _("Could not test lock "
+                                               "file for %s: %s"), source,
                                              g_strerror (errno));
                        break;
                }
@@ -207,9 +214,9 @@ camel_movemail (const char *source, const char *dest, CamelException *ex)
                /* Something has gone awry. */
                if (now >= timeout) {
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                             "Timed out trying to get "
-                                             "lock file on %s. Try again "
-                                             "later.", source);
+                                             _("Timed out trying to get "
+                                               "lock file on %s. Try again "
+                                               "later."), source);
                }
                g_free (lockfile);
                unlink (locktmpfile);
@@ -233,7 +240,7 @@ camel_movemail (const char *source, const char *dest, CamelException *ex)
                        if (errno == EINTR)
                                continue;
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                             "Error reading mail file: %s",
+                                             _("Error reading mail file: %s"),
                                              g_strerror (errno));
                        break;
                }
@@ -244,8 +251,8 @@ camel_movemail (const char *source, const char *dest, CamelException *ex)
                                if (errno == EINTR)
                                        continue; /* continues inner loop */
                                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                                     "Error writing "
-                                                     "mail temp file: %s",
+                                                     _("Error writing "
+                                                       "mail temp file: %s"),
                                                      g_strerror (errno));
                                break;
                        }
@@ -262,8 +269,8 @@ camel_movemail (const char *source, const char *dest, CamelException *ex)
                        ftruncate (sfd, 0);
                else {
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                             "Failed to store mail in "
-                                             "temp file %s: %s", dest,
+                                             _("Failed to store mail in "
+                                               "temp file %s: %s"), dest,
                                              g_strerror (errno));
                }
        } else
@@ -294,7 +301,7 @@ movemail_external (const char *source, const char *dest, CamelException *ex)
        if (pipe (fd) == -1) {
                sigprocmask (SIG_SETMASK, &omask, NULL);
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     "Could not create pipe: %s",
+                                     _("Could not create pipe: %s"),
                                      g_strerror (errno));
                return;
        }
@@ -306,7 +313,7 @@ movemail_external (const char *source, const char *dest, CamelException *ex)
                close (fd[1]);
                sigprocmask (SIG_SETMASK, &omask, NULL);
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     "Could not fork: %s",
+                                     _("Could not fork: %s"),
                                      g_strerror (errno));
                return;
 
@@ -344,14 +351,15 @@ movemail_external (const char *source, const char *dest, CamelException *ex)
 
        if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     "Movemail program failed: %s",
-                                     output ? output : "(Unknown error)");
+                                     _("Movemail program failed: %s"),
+                                     output ? output : _("(Unknown error)"));
        }
        g_free (output);
 }
 #endif
 
 
+#if 0
 static int
 camel_movemail_copy(int fromfd, int tofd, off_t start, size_t bytes)
 {
@@ -399,9 +407,11 @@ camel_movemail_copy(int fromfd, int tofd, off_t start, size_t bytes)
 
         return written;
 }
+#endif
 
 #define PRE_SIZE (32)
 
+#if 0
 static int
 camel_movemail_copy_filter(int fromfd, int tofd, off_t start, size_t bytes, CamelMimeFilter *filter)
 {
@@ -565,8 +575,8 @@ camel_movemail_solaris (int sfd, int dfd, CamelException *ex)
                }
        }
 
-       gtk_object_unref((GtkObject *)mp);
-       gtk_object_unref((GtkObject *)ffrom);
+       camel_object_unref((CamelObject *)mp);
+       camel_object_unref((CamelObject *)ffrom);
 
        return ret;
 
@@ -577,9 +587,10 @@ fail:
                              g_strerror (errno));
 
 
-       gtk_object_unref((GtkObject *)mp);
-       gtk_object_unref((GtkObject *)ffrom);
+       camel_object_unref((CamelObject *)mp);
+       camel_object_unref((CamelObject *)ffrom);
 
        return -1;
 }
+#endif