[evolution-ews/evolution-ews-3-12] Make Evolution-EWS build under Win32



commit e994ee5219c4a7e90a220879e990b0b3cff10571
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jul 10 21:10:18 2014 +0200

    Make Evolution-EWS build under Win32

 src/camel/Makefile.am         |    2 +
 src/server/e-ews-connection.c |    4 --
 src/server/e-ews-item.c       |   64 +----------------------------------------
 src/server/e-soap-message.c   |    4 --
 4 files changed, 3 insertions(+), 71 deletions(-)
---
diff --git a/src/camel/Makefile.am b/src/camel/Makefile.am
index ee70feb..5f873d6 100644
--- a/src/camel/Makefile.am
+++ b/src/camel/Makefile.am
@@ -41,6 +41,7 @@ libcamelews_priv_la_CPPFLAGS = \
        $(LIBEDATASERVER_CFLAGS) \
        $(LIBECAL_CFLAGS) \
        $(EVOLUTION_SHELL_CFLAGS) \
+       $(EVOLUTION_MAIL_CFLAGS) \
        $(GNOME_INCLUDEDIR) \
        $(SOUP_CFLAGS) \
        $(LIBEBACKEND_CFLAGS) \
@@ -65,6 +66,7 @@ libcamelews_priv_la_LIBADD = \
        $(top_builddir)/src/utils/libewsutils.la  \
        $(CAMEL_LIBS) \
        $(EVOLUTION_SHELL_LIBS) \
+       $(EVOLUTION_MAIL_LIBS) \
        $(LIBEDATASERVER_LIBS) \
        $(LIBEBACKEND_LIBS) \
        $(LIBECAL_LIBS) \
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index eed2b8b..1e589f4 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -3438,11 +3438,7 @@ ews_soup_got_chunk (SoupMessage *msg,
                                &data->error, EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_UNKNOWN,
                                "Failed to write streaming data to file : %d ", errno);
                }
-#ifdef G_OS_WIN32
-               closesocket (fd);
-#else
                close (fd);
-#endif
        } else {
                g_set_error (
                        &data->error, EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_UNKNOWN,
diff --git a/src/server/e-ews-item.c b/src/server/e-ews-item.c
index b8dc7e7..fa118c5 100644
--- a/src/server/e-ews-item.c
+++ b/src/server/e-ews-item.c
@@ -34,68 +34,6 @@
 #include "e-ews-item.h"
 #include "e-ews-item-change.h"
 
-#ifdef G_OS_WIN32
-
-static gchar *
-g_mkdtemp (gchar *tmpl,
-           gint mode)
-{
-       static const gchar letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-       static const gint NLETTERS = sizeof (letters) - 1;
-       static gint counter = 0;
-       gchar *XXXXXX;
-       GTimeVal tv;
-       glong value;
-       gint count;
-
-       /* find the last occurrence of "XXXXXX" */
-       XXXXXX = g_strrstr (tmpl, "XXXXXX");
-
-       if (!XXXXXX || strncmp (XXXXXX, "XXXXXX", 6)) {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       /* Get some more or less random data.  */
-       g_get_current_time (&tv);
-       value = (tv.tv_usec ^ tv.tv_sec) + counter++;
-
-       for (count = 0; count < 100; value += 7777, ++count) {
-               glong v = value;
-
-               /* Fill in the random bits.  */
-               XXXXXX[0] = letters[v % NLETTERS];
-               v /= NLETTERS;
-               XXXXXX[1] = letters[v % NLETTERS];
-               v /= NLETTERS;
-               XXXXXX[2] = letters[v % NLETTERS];
-               v /= NLETTERS;
-               XXXXXX[3] = letters[v % NLETTERS];
-               v /= NLETTERS;
-               XXXXXX[4] = letters[v % NLETTERS];
-               v /= NLETTERS;
-               XXXXXX[5] = letters[v % NLETTERS];
-
-               /* tmpl is in UTF-8 on Windows, thus use g_mkdir() */
-               if (g_mkdir (tmpl, mode) == 0)
-                       return tmpl;
-
-               if (errno != EEXIST)
-                       /* Any other error will apply also to other names we might
-                        *  try, and there are 2^32 or so of them, so give up now.
-                        */
-                       return NULL;
-       }
-
-       /* We got out of the loop because we ran out of combinations to try.  */
-       errno = EEXIST;
-       return NULL;
-}
-
-#define mkdtemp(t) g_mkdtemp(t, 0700)
-
-#endif
-
 G_DEFINE_TYPE (EEwsItem, e_ews_item, G_TYPE_OBJECT)
 
 struct _EEwsContactFields {
@@ -1852,7 +1790,7 @@ e_ews_item_dump_mime_content (EEwsItem *item,
        tmpdir = g_path_get_dirname (tmpfilename);
 
        dirname = g_build_filename (tmpdir, "XXXXXX", NULL);
-       if (!mkdtemp (dirname)) {
+       if (!g_mkdtemp (dirname)) {
                g_warning ("Failed to create directory for attachment cache '%s': %s", dirname, g_strerror 
(errno));
 
                g_free (tmpdir);
diff --git a/src/server/e-soap-message.c b/src/server/e-soap-message.c
index a96a464..a39af90 100644
--- a/src/server/e-soap-message.c
+++ b/src/server/e-soap-message.c
@@ -242,11 +242,7 @@ soap_sax_endElementNs (gpointer _ctxt,
        ESoapMessagePrivate *priv = ctxt->_private;
 
        if (priv->steal_fd != -1) {
-#ifdef G_OS_WIN32
-               closesocket (priv->steal_fd);
-#else
                close (priv->steal_fd);
-#endif
                priv->steal_fd = -1;
        }
        xmlSAX2EndElementNs (ctxt, localname, prefix, uri);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]