pidgin.2.x.y: 83dd0d90: Fix the compilation of the Bonjour prpl ...
datallah at pidgin.im
datallah at pidgin.im
Tue Dec 13 10:51:26 EST 2011
----------------------------------------------------------------------
Revision: 83dd0d90742e9ccf6890fc21736440df73e48f24
Parent: 051fd526bf8c89add8c1960afd9d0c7ee77b091a
Author: Eion Robb <eion at robbmob.com>
Date: 12/13/11 10:24:16
Branch: im.pidgin.pidgin.2.x.y
URL: http://d.pidgin.im/viewmtn/revision/info/83dd0d90742e9ccf6890fc21736440df73e48f24
Changelog:
Fix the compilation of the Bonjour prpl on Windows.
Fixes #14802
Changes against parent 051fd526bf8c89add8c1960afd9d0c7ee77b091a
patched libpurple/protocols/bonjour/jabber.c
patched libpurple/protocols/bonjour/jabber.h
patched libpurple/win32/libc_interface.c
patched libpurple/win32/libc_interface.h
patched libpurple/win32/libc_internal.h
-------------- next part --------------
============================================================
--- libpurple/win32/libc_interface.c e853652c1abfe43443299a471b799dc2ef162958
+++ libpurple/win32/libc_interface.c 8f230c80b5368f0edced82642e924f4ab6699840
@@ -300,7 +300,51 @@ wpurple_inet_ntop (int af, const void *s
return (const char *) dst;
}
+int
+wpurple_inet_pton(int af, const char *src, void *dst)
+{
+ /* struct sockaddr can't accomodate struct sockaddr_in6. */
+ union {
+ struct sockaddr_in6 sin6;
+ struct sockaddr_in sin;
+ } sa;
+ size_t srcsize;
+
+ switch(af)
+ {
+ case AF_INET:
+ sa.sin.sin_family = AF_INET;
+ srcsize = sizeof (sa.sin);
+ break;
+ case AF_INET6:
+ sa.sin6.sin6_family = AF_INET6;
+ srcsize = sizeof (sa.sin6);
+ break;
+ default:
+ errno = WSAEPFNOSUPPORT;
+ return -1;
+ }
+
+ if (WSAStringToAddress(src, af, NULL, (struct sockaddr *) &sa, &srcsize) != 0)
+ {
+ errno = WSAGetLastError();
+ return -1;
+ }
+
+ switch(af)
+ {
+ case AF_INET:
+ memcpy(dst, &sa.sin.sin_addr, sizeof(sa.sin.sin_addr));
+ break;
+ case AF_INET6:
+ memcpy(dst, &sa.sin6.sin6_addr, sizeof(sa.sin6.sin6_addr));
+ break;
+ }
+
+ return 1;
+}
+
/* netdb.h */
struct hostent* wpurple_gethostbyname(const char *name) {
struct hostent *hp;
============================================================
--- libpurple/win32/libc_interface.h ea23c9702eec172f10e3e17347b8bdea325e60a2
+++ libpurple/win32/libc_interface.h b43a9cbb57aea38bc5d5252263af733aeb61c7ab
@@ -89,6 +89,9 @@ wpurple_inet_ntop( af, src, dst, cnt )
#define inet_ntop( af, src, dst, cnt ) \
wpurple_inet_ntop( af, src, dst, cnt )
+#define inet_pton( af, src, dst ) \
+wpurple_inet_pton( af, src, dst )
+
/* netdb.h */
#define gethostbyname( name ) \
wpurple_gethostbyname( name )
============================================================
--- libpurple/win32/libc_internal.h baffee0cc7987bf2a86f9e4e8df3c77f7bc31167
+++ libpurple/win32/libc_internal.h 57e32774b5c3c9de78d32215fd658b4c8384cefd
@@ -48,6 +48,7 @@ wpurple_inet_ntop (int af, const void *s
int wpurple_inet_aton(const char *name, struct in_addr *addr);
const char *
wpurple_inet_ntop (int af, const void *src, char *dst, socklen_t cnt);
+int wpurple_inet_pton(int af, const char *src, void *dst);
/* netdb.h */
struct hostent* wpurple_gethostbyname(const char *name);
============================================================
--- libpurple/protocols/bonjour/jabber.c 294ed3f158619462447e09d17b1d0f37121836e3
+++ libpurple/protocols/bonjour/jabber.c e362fc63acfcd212f6d473d288cda6b144b7d94d
@@ -1448,7 +1448,7 @@ void
}
void
-append_iface_if_linklocal(char *ip, uint32_t interface) {
+append_iface_if_linklocal(char *ip, guint32 interface_param) {
struct in6_addr in6_addr;
int len_remain = INET6_ADDRSTRLEN - strlen(ip);
@@ -1460,5 +1460,5 @@ append_iface_if_linklocal(char *ip, uint
return;
snprintf(ip + strlen(ip), len_remain, "%%%d",
- interface);
+ interface_param);
}
============================================================
--- libpurple/protocols/bonjour/jabber.h 11e281b0805e889a57abbd1552fef84f2454a3f2
+++ libpurple/protocols/bonjour/jabber.h da76d25a77cb86d6715411aa34d44a1d7a26547e
@@ -111,6 +111,6 @@ GSList * bonjour_jabber_get_local_ips(in
int xep_iq_send_and_free(XepIq *iq);
GSList * bonjour_jabber_get_local_ips(int fd);
-void append_iface_if_linklocal(char *ip, uint32_t interface);
+void append_iface_if_linklocal(char *ip, guint32 interface_param);
#endif /* _BONJOUR_JABBER_H_ */
More information about the Commits
mailing list