Making e-d-s build on Windows and also build on other platforms :)
authorFridrich Štrba <fridrich.strba@bluewin.ch>
Thu, 3 Jun 2010 07:05:17 +0000 (09:05 +0200)
committerFridrich Štrba <fridrich.strba@bluewin.ch>
Thu, 3 Jun 2010 07:05:17 +0000 (09:05 +0200)
camel/camel-tcp-stream-raw.c
camel/camel-tcp-stream-ssl.c
camel/camel-tcp-stream.c

index 333cf31..a41156f 100644 (file)
@@ -397,7 +397,11 @@ connect_to_socks4_proxy (const gchar *proxy_host, gint proxy_port, struct addrin
 
        ai = camel_getaddrinfo (proxy_host, serv, &hints, NULL); /* NULL-CamelException */
        if (!ai) {
+#ifdef G_OS_WIN32
+               errno = WSAEHOSTUNREACH;
+#else
                errno = EHOSTUNREACH; /* FIXME: this is not an accurate error; we should translate the CamelException to an errno */
+#endif
                return -1;
        }
 
@@ -428,7 +432,11 @@ connect_to_socks4_proxy (const gchar *proxy_host, gint proxy_port, struct addrin
 
        if (!(reply[0] == 0             /* first byte of reply is 0 */
              && reply[1] == 90)) {     /* 90 means "request granted" */
+#ifdef G_OS_WIN32
+               errno = WSAECONNREFUSED;
+#else
                errno = ECONNREFUSED;
+#endif
                goto error;
        }
 
index 24db04d..366c289 100644 (file)
@@ -215,7 +215,7 @@ read_from_prfd (PRFileDesc *fd, gchar *buffer, gsize n)
                sockopts.value.non_blocking = TRUE;
                PR_SetSocketOption (fd, &sockopts);
 
-               pollfds[0].fd = fd
+               pollfds[0].fd = fd;
                pollfds[0].in_flags = PR_POLL_READ;
                pollfds[1].fd = cancel_fd;
                pollfds[1].in_flags = PR_POLL_READ;
@@ -1148,7 +1148,11 @@ connect_to_socks4_proxy (CamelTcpStreamSSL *ssl, const gchar *proxy_host, gint p
 
        ai = camel_getaddrinfo (proxy_host, serv, &hints, NULL);  /* NULL-CamelException */
        if (!ai) {
+#ifdef G_OS_WIN32
+               errno = WSAEHOSTUNREACH;
+#else
                errno = EHOSTUNREACH; /* FIXME: this is not an accurate error; we should translate the CamelException to an errno */
+#endif
                d (g_print ("  camel_getaddrinfo() for the proxy failed\n}\n"));
                return NULL;
        }
@@ -1189,7 +1193,11 @@ connect_to_socks4_proxy (CamelTcpStreamSSL *ssl, const gchar *proxy_host, gint p
 
        if (!(reply[0] == 0             /* first byte of reply is 0 */
              && reply[1] == 90)) {     /* 90 means "request granted" */
+#ifdef G_OS_WIN32
+               errno = WSAECONNREFUSED;
+#else
                errno = ECONNREFUSED;
+#endif
                d (g_print ("  proxy replied with code %d\n", reply[1]));
                goto error;
        }
index c66cc8b..47f1f5c 100644 (file)
@@ -73,7 +73,7 @@ camel_tcp_stream_class_init (CamelTcpStreamClass *class)
 static void
 camel_tcp_stream_init (CamelTcpStream *tcp_stream)
 {
-       tcp_stream->priv = CAMEL_TCP_STREAM_GET_PRIVATE (cpi);
+       tcp_stream->priv = CAMEL_TCP_STREAM_GET_PRIVATE (tcp_stream);
        tcp_stream->priv->socks_host = NULL;
        tcp_stream->priv->socks_port = 0;
 }