cpw.rekkanoryo.ggupdate: 6f6e595b: Partially fix libgadu build on Win32. R...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sun Feb 21 19:40:43 EST 2010


-----------------------------------------------------------------
Revision: 6f6e595b90a5219711898b80e49ca2ee8f781ed3
Ancestor: 3e11646a9e21dbb7eae8d07d2782cac0c85fa2c0
Author: rekkanoryo at pidgin.im
Date: 2010-02-22T00:36:15
Branch: im.pidgin.cpw.rekkanoryo.ggupdate
URL: http://d.pidgin.im/viewmtn/revision/info/6f6e595b90a5219711898b80e49ca2ee8f781ed3

Modified files:
        libpurple/protocols/gg/lib/common.c
        libpurple/protocols/gg/lib/dcc.c
        libpurple/protocols/gg/lib/dcc7.c
        libpurple/protocols/gg/lib/events.c
        libpurple/protocols/gg/lib/http.c
        libpurple/protocols/gg/lib/libgadu.c
        libpurple/protocols/gg/lib/pubdir.c
        libpurple/protocols/gg/lib/resolver.c
        libpurple/protocols/gg/lib/resolver.h

ChangeLog: 

Partially fix libgadu build on Win32.  Refs #10542.  I'm still not sure how to
handle all the stuff in resolver.c for DNS resolution.  I couldn't quite see how
to reconcile our earlier stuff with this new code.  Hopefully a more skilled
Win32 developer can finish this.

-------------- next part --------------
============================================================
--- libpurple/protocols/gg/lib/common.c	a333f8fc06cb82eb7ddf704db071f4b13af7ad70
+++ libpurple/protocols/gg/lib/common.c	665a2a017a163a481f8c5527e08fde52ca82fb45
@@ -47,27 +47,34 @@
  *
  * \brief Funkcje wykorzystywane przez r??ne modu?y biblioteki
  */
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#ifdef sun
-#  include <sys/filio.h>
+
+#include "libgadu.h"
+#include "libgadu-internal.h"
+
+#ifndef _WIN32
+#  include <sys/types.h>
+#  include <sys/ioctl.h>
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <arpa/inet.h>
+#  ifdef sun
+#    include <sys/filio.h>
+#  endif
 #endif
 
 #include <errno.h>
 #include <fcntl.h>
-#include <netdb.h>
+
+#ifndef _WIN32
+# include <netdb.h>
+#endif
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
-#include "libgadu.h"
-#include "libgadu-internal.h"
-
 /**
  * Plik, do kt?rego b?d? przekazywane informacje odpluskwiania.
  *
============================================================
--- libpurple/protocols/gg/lib/dcc.c	c7ac957798f90e5ac8b8ccd1a43ecb9656d8cff1
+++ libpurple/protocols/gg/lib/dcc.c	f99696afc880d8895d8fc08e525e7f6f978f7559
@@ -25,15 +25,19 @@
  *
  * \brief Obs?uga po??cze? bezpo?rednich do wersji Gadu-Gadu 6.x
  */
+#include "libgadu.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#ifdef sun
-#  include <sys/filio.h>
+
+#ifndef _WIN32
+#  include <sys/ioctl.h>
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <arpa/inet.h>
+#  ifdef sun
+#    include <sys/filio.h>
+#  endif
 #endif
 
 #include <ctype.h>
@@ -46,7 +50,6 @@
 #include <unistd.h>
 
 #include "compat.h"
-#include "libgadu.h"
 
 #ifndef GG_DEBUG_DISABLE
 
============================================================
--- libpurple/protocols/gg/lib/dcc7.c	7e301bb7bd0d1c4a4ee8a627590a1d8b4b50aaad
+++ libpurple/protocols/gg/lib/dcc7.c	ce8661d817dd5e93633c54b7defee710c5eb5fe6
@@ -28,15 +28,21 @@
  * \brief Obs?uga po??cze? bezpo?rednich od wersji Gadu-Gadu 7.x
  */
 
+#include "libgadu.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#ifdef sun
-#  include <sys/filio.h>
+
+#ifndef _WIN32
+#  include <sys/ioctl.h>
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <arpa/inet.h>
+#  ifdef sun
+#    include <sys/filio.h>
+#  endif
 #endif
+
 #include <time.h>
 
 #include <ctype.h>
@@ -49,7 +55,6 @@
 #include <unistd.h>
 
 #include "compat.h"
-#include "libgadu.h"
 
 #define gg_debug_dcc(dcc, fmt...) \
 	gg_debug_session((dcc) ? (dcc)->sess : NULL, fmt)
@@ -942,7 +947,7 @@ struct gg_event *gg_dcc7_watch_fd(struct
 		{
 			struct sockaddr_in sin;
 			int fd, one = 1;
-			unsigned int sin_len = sizeof(sin);
+			socklen_t sin_len = sizeof(sin);
 
 			gg_debug_dcc(dcc, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() GG_STATE_LISTENING\n");
 
============================================================
--- libpurple/protocols/gg/lib/events.c	fdb0fc390bc39635a6393ac441b5971c397f94d4
+++ libpurple/protocols/gg/lib/events.c	3f3a5185e1aa3d9949d496d301ae2352f8a2e211
@@ -27,16 +27,20 @@
  * \brief Obs?uga zdarze?
  */
 
+#include "libgadu.h"
+#include "libgadu-internal.h"
+
 #include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
 
+#ifndef _WIN32
+#  include <sys/ioctl.h>
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <arpa/inet.h>
+#endif
+
 #include "compat.h"
-#include "libgadu.h"
 #include "protocol.h"
-#include "libgadu-internal.h"
 
 #include <errno.h>
 #include <stdio.h>
@@ -1534,7 +1538,7 @@ struct gg_event *gg_watch_fd(struct gg_s
 		{
 			char buf[1024], *client, *auth;
 			int res = 0;
-			unsigned int res_size = sizeof(res);
+			socklen_t res_size = sizeof(res);
 			const char *host;
 
 			gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_HUB\n");
@@ -1752,7 +1756,7 @@ struct gg_event *gg_watch_fd(struct gg_s
 		case GG_STATE_CONNECTING_GG:
 		{
 			int res = 0;
-			unsigned int res_size = sizeof(res);
+			socklen_t res_size = sizeof(res);
 
 			gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_GG\n");
 
@@ -2054,7 +2058,7 @@ struct gg_event *gg_watch_fd(struct gg_s
 
 			if (gg_dcc_ip == (unsigned long) inet_addr("255.255.255.255")) {
 				struct sockaddr_in sin;
-				unsigned int sin_len = sizeof(sin);
+				socklen_t sin_len = sizeof(sin);
 
 				gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() detecting address\n");
 
============================================================
--- libpurple/protocols/gg/lib/http.c	7846a9ed5275969a45c31e2ccdabae2ea9e29569
+++ libpurple/protocols/gg/lib/http.c	882d007b9c52dbbfa77b6a55fce3568428927425
@@ -24,18 +24,26 @@
  * \brief Obs?uga po??cze? HTTP
  */
 
+#include "libgadu.h"
+
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
 
+#ifndef _WIN32
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <arpa/inet.h>
+#endif
+
 #include "compat.h"
-#include "libgadu.h"
 #include "resolver.h"
 
 #include <ctype.h>
 #include <errno.h>
-#include <netdb.h>
+
+#ifndef _WIN32
+#  include <netdb.h>
+#endif
+
 #include <signal.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -230,7 +238,7 @@ int gg_http_watch_fd(struct gg_http *h)
 
 	if (h->state == GG_STATE_CONNECTING) {
 		int res = 0;
-		unsigned int res_size = sizeof(res);
+		socklen_t res_size = sizeof(res);
 
 		if (h->async && (getsockopt(h->fd, SOL_SOCKET, SO_ERROR, &res, &res_size) || res)) {
 			gg_debug(GG_DEBUG_MISC, "=> http, async connection failed (errno=%d, %s)\n", (res) ? res : errno , strerror((res) ? res : errno));
@@ -249,7 +257,7 @@ int gg_http_watch_fd(struct gg_http *h)
 	}
 
 	if (h->state == GG_STATE_SENDING_QUERY) {
-		int res;
+		ssize_t res;
 
 		if ((res = write(h->fd, h->query, strlen(h->query))) < 1) {
 			gg_debug(GG_DEBUG_MISC, "=> http, write() failed (len=%d, res=%d, errno=%d)\n", strlen(h->query), res, errno);
============================================================
--- libpurple/protocols/gg/lib/libgadu.c	bd29701f580355495b583cdaff5d7d9837e0bb51
+++ libpurple/protocols/gg/lib/libgadu.c	6901519a21b177aa3396771a6b2e88e88e468726
@@ -28,22 +28,34 @@
  * \brief G??wny modu? biblioteki
  */
 
+#include "libgadu.h"
+#include "libgadu-internal.h"
+
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#ifdef sun
-#  include <sys/filio.h>
+
+#ifdef _WIN32
+#  include <io.h>
+#  include <fcntl.h>
+#  include <errno.h>
+#  define SHUT_RDWR SD_BOTH
+#else
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <arpa/inet.h>
+#  ifdef sun
+#    include <sys/filio.h>
+#  endif
 #endif
 
 #include "compat.h"
-#include "libgadu.h"
 #include "protocol.h"
 #include "resolver.h"
-#include "libgadu-internal.h"
 
-#include <errno.h>
-#include <netdb.h>
+#ifndef _WIN32
+#  include <errno.h> /* on Win32 this is included above */
+#  include <netdb.h>
+#endif
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
============================================================
--- libpurple/protocols/gg/lib/pubdir.c	28a76bb68aa2380804d02e89c6c83485eb23d487
+++ libpurple/protocols/gg/lib/pubdir.c	acbb640332cb13edd6a5ace8ce907236657e089c
@@ -26,6 +26,9 @@
  * \brief Obs?uga katalogu publicznego
  */
 
+#include "libgadu.h"
+#include "libgadu-config.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <stdarg.h>
@@ -34,8 +37,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "libgadu.h"
-
 /**
  * Rejestruje nowego u?ytkownika.
  *
============================================================
--- libpurple/protocols/gg/lib/resolver.c	48326d4fd8687a81f7ab4ca06866c7d4d644b14a
+++ libpurple/protocols/gg/lib/resolver.c	1b505b501f3574d7a2a213c8a09c849f8d7b8b1c
@@ -28,15 +28,18 @@
  * \brief Funkcje rozwi?zywania nazw
  */
 
-#include <sys/wait.h>
-#include <netdb.h>
+#ifndef _WIN32
+#  include <sys/wait.h>
+#  include <netdb.h>
+#  include <signal.h>
+#  include <netinet/in.h>
+#  include <arpa/inet.h>
+#endif
+
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <signal.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
 
 #include "libgadu.h"
 #include "resolver.h"
============================================================
--- libpurple/protocols/gg/lib/resolver.h	a02b61e069991489c5f0b2804ef8bf3708e198a4
+++ libpurple/protocols/gg/lib/resolver.h	57a6c4768ba359942b87bbd010aee3ab9f1a8c1f
@@ -21,7 +21,9 @@
 #ifndef LIBGADU_RESOLVER_H
 #define LIBGADU_RESOLVER_H
 
-#include <arpa/inet.h>
+#ifndef _WIN32
+#  include <arpa/inet.h>
+#endif
 
 int gg_gethostbyname_real(const char *hostname, struct in_addr *result, int pthread);
 


More information about the Commits mailing list