[evolution-ews] Fix build on Windows



commit bd00e2942eb4b1c4c703cd5bc8d844a3cd06dc04
Author: Fridrich Å trba <fridrich strba bluewin ch>
Date:   Thu May 5 18:28:28 2011 +0200

    Fix build on Windows

 src/addressbook/Makefile.am |    1 +
 src/server/Makefile.am      |    2 ++
 src/server/e-ews-item.c     |    5 +++--
 src/server/e-soap-message.c |   12 ++++++++++--
 4 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/addressbook/Makefile.am b/src/addressbook/Makefile.am
index e460ed3..28f05f4 100644
--- a/src/addressbook/Makefile.am
+++ b/src/addressbook/Makefile.am
@@ -26,6 +26,7 @@ libebookbackendews_la_SOURCES =			\
 
 libebookbackendews_la_LIBADD =				\
 	$(top_builddir)/src/server/libeews-1.2.la		\
+	$(top_builddir)/src/utils/libewsutils.la		\
 	$(LIBEBACKEND_LIBS)					\
 	$(LIBEDATASERVER_LIBS)					\
 	$(LIBEDATABOOK_LIBS) \
diff --git a/src/server/Makefile.am b/src/server/Makefile.am
index 2632e53..32ec9d9 100644
--- a/src/server/Makefile.am
+++ b/src/server/Makefile.am
@@ -26,6 +26,7 @@ libeews_1_2_la_CPPFLAGS = \
 	$(LIBEBACKEND_CFLAGS)				\
 	$(LIBEDATASERVER_CFLAGS)			\
 	$(E_DATA_SERVER_CFLAGS)				\
+	$(EVOLUTION_PLUGIN_CFLAGS)				\
 	$(DEBUG_CFLAGS)
 
 libeews_1_2_la_SOURCES =		\
@@ -49,6 +50,7 @@ libeews_1_2_la_LIBADD =						\
 	$(LIBEBACKEND_LIBS)						\
 	$(LIBEDATASERVER_LIBS)						\
 	$(E_DATA_SERVER_LIBS)						\
+	$(EVOLUTION_PLUGIN_LIBS)				\
 	$(SOUP_LIBS)						\
 	$(SOCKET_LIBS)
 
diff --git a/src/server/e-ews-item.c b/src/server/e-ews-item.c
index 4c74cad..26cc9b7 100644
--- a/src/server/e-ews-item.c
+++ b/src/server/e-ews-item.c
@@ -30,6 +30,7 @@
 #include <glib/gstdio.h>
 #include <glib/gprintf.h>
 #include <libsoup/soup-misc.h>
+#include <e-util/e-mktemp.h>
 #include "e-ews-item.h"
 #include "e-ews-connection.h"
 #include "e-ews-message.h"
@@ -853,7 +854,7 @@ e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param, const gch
 	tmpdir = g_strndup(tmpfilename, g_strrstr (tmpfilename, "/") - tmpfilename);
 
 	snprintf(dirname, 350, "%s/XXXXXX", tmpdir);
-	if (!mkdtemp(dirname))
+	if (!e_mkdtemp(dirname))
 		g_warning ("Failed to create directory for attachment cache");
 	surename = g_uri_escape_string(name, "", TRUE);
 	snprintf(filename, 350, "%s/%s", dirname, surename);
@@ -882,7 +883,7 @@ e_ews_item_dump_mime_content(EEwsItem *item, const gchar *cache) {
 	tmpdir = g_strndup(tmpfilename, g_strrstr (tmpfilename, "/") - tmpfilename);
 
 	snprintf(dirname, 350, "%s/XXXXXX", tmpdir);
-	if (!mkdtemp(dirname))
+	if (!e_mkdtemp(dirname))
 		g_warning ("Failed to create directory for attachment cache");
 
 	surename = g_uri_escape_string(item->priv->subject, "", TRUE);
diff --git a/src/server/e-soap-message.c b/src/server/e-soap-message.c
index 39b6ff6..59c7a7b 100644
--- a/src/server/e-soap-message.c
+++ b/src/server/e-soap-message.c
@@ -63,7 +63,11 @@ finalize (GObject *object)
 	g_free (priv->steal_node);
 	g_free (priv->steal_dir);
 	if (priv->steal_fd != -1)
+#ifdef G_OS_WIN32
+		closesocket (priv->steal_fd);
+#else
 		close (priv->steal_fd);
+#endif
 	G_OBJECT_CLASS (e_soap_message_parent_class)->finalize (object);
 }
 
@@ -193,7 +197,11 @@ static void soap_sax_endElementNs (void *_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);
@@ -207,7 +215,7 @@ static void soap_sax_characters (void *_ctxt, const xmlChar *ch, int len)
 	if (priv->steal_fd == -1)
 		xmlSAX2Characters (ctxt, ch, len);
 	else if (!priv->steal_base64) {
-		if (write (priv->steal_fd, ch, len) != len) {
+		if (send (priv->steal_fd, (const gchar*)ch, len, 0) != len) {
 		write_err:
 			/* Handle error better */
 			g_warning ("Failed to write streaming data to file");
@@ -219,7 +227,7 @@ static void soap_sax_characters (void *_ctxt, const xmlChar *ch, int len)
 		blen = g_base64_decode_step ((const gchar *)ch, len,
 					     bdata, &priv->steal_b64_state,
 					     &priv->steal_b64_save);
-		if (write (priv->steal_fd, bdata, blen) != blen) {
+		if (send (priv->steal_fd, (const gchar*)bdata, blen, 0) != blen) {
 			g_free (bdata);
 			goto write_err;
 		}



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