/pidgin/main: 0143226782bb: Update libgadu to the current versio...

Tomasz Wasilczyk twasilczyk at pidgin.im
Fri Mar 21 19:42:16 EDT 2014


Changeset: 0143226782bb4dcfeae89b519bc4dcaf48fd9adb
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-03-22 00:42 +0100
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/0143226782bb

Description:

Update libgadu to the current version from repo

diffstat:

 libpurple/protocols/gg/lib/common.c     |  26 ++++++++++++++++----------
 libpurple/protocols/gg/lib/dcc7.c       |   5 ++++-
 libpurple/protocols/gg/lib/events.c     |   4 ++++
 libpurple/protocols/gg/lib/handlers.c   |   6 ++----
 libpurple/protocols/gg/lib/internal.h   |   4 ++++
 libpurple/protocols/gg/lib/protobuf-c.c |   2 --
 libpurple/protocols/gg/lib/resolver.c   |  15 ++++++++-------
 7 files changed, 38 insertions(+), 24 deletions(-)

diffs (210 lines):

diff --git a/libpurple/protocols/gg/lib/common.c b/libpurple/protocols/gg/lib/common.c
--- a/libpurple/protocols/gg/lib/common.c
+++ b/libpurple/protocols/gg/lib/common.c
@@ -27,9 +27,7 @@
 
 #include "network.h"
 #include "strman.h"
-#ifdef sun
-#  include <sys/filio.h>
-#endif
+#include "fileio.h"
 
 #include <errno.h>
 #include <stdarg.h>
@@ -253,10 +251,12 @@ int gg_connect(void *addr, int port, int
 	struct in_addr *a = addr;
 	struct sockaddr_in myaddr;
 
-	gg_debug(GG_DEBUG_FUNCTION, "** gg_connect(%s, %d, %d);\n", inet_ntoa(*a), port, async);
+	gg_debug(GG_DEBUG_FUNCTION, "** gg_connect(%s, %d, %d);\n",
+		inet_ntoa(*a), port, async);
 
 	if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
-		gg_debug(GG_DEBUG_MISC, "// gg_connect() socket() failed (errno=%d, %s)\n", errno, strerror(errno));
+		gg_debug(GG_DEBUG_MISC, "// gg_connect() socket() failed "
+			"(errno=%d, %s)\n", errno, strerror(errno));
 		return -1;
 	}
 
@@ -266,7 +266,8 @@ int gg_connect(void *addr, int port, int
 	myaddr.sin_addr.s_addr = gg_local_ip;
 
 	if (bind(sock, (struct sockaddr *) &myaddr, sizeof(myaddr)) == -1) {
-		gg_debug(GG_DEBUG_MISC, "// gg_connect() bind() failed (errno=%d, %s)\n", errno, strerror(errno));
+		gg_debug(GG_DEBUG_MISC, "// gg_connect() bind() failed "
+			"(errno=%d, %s)\n", errno, strerror(errno));
 		errno2 = errno;
 		close(sock);
 		errno = errno2;
@@ -300,7 +301,8 @@ int gg_connect(void *addr, int port, int
 			errno = errno2;
 			return -1;
 		}
-		gg_debug(GG_DEBUG_MISC, "// gg_connect() connect() in progress\n");
+		gg_debug(GG_DEBUG_MISC,
+			"// gg_connect() connect() in progress\n");
 	}
 
 	return sock;
@@ -575,19 +577,23 @@ char *gg_proxy_auth(void)
 	if (!gg_proxy_enabled || !gg_proxy_username || !gg_proxy_password)
 		return NULL;
 
-	if (!(tmp = malloc((tmp_size = strlen(gg_proxy_username) + strlen(gg_proxy_password) + 2))))
+	tmp_size = strlen(gg_proxy_username) + strlen(gg_proxy_password) + 2;
+	tmp = malloc(tmp_size);
+	if (!tmp)
 		return NULL;
 
 	snprintf(tmp, tmp_size, "%s:%s", gg_proxy_username, gg_proxy_password);
 
-	if (!(enc = gg_base64_encode(tmp))) {
+	enc = gg_base64_encode(tmp);
+	if (!enc) {
 		free(tmp);
 		return NULL;
 	}
 
 	free(tmp);
 
-	if (!(out = malloc(strlen(enc) + 40))) {
+	out = malloc(strlen(enc) + 40);
+	if (!out) {
 		free(enc);
 		return NULL;
 	}
diff --git a/libpurple/protocols/gg/lib/dcc7.c b/libpurple/protocols/gg/lib/dcc7.c
--- a/libpurple/protocols/gg/lib/dcc7.c
+++ b/libpurple/protocols/gg/lib/dcc7.c
@@ -664,7 +664,10 @@ int gg_dcc7_handle_id(struct gg_session 
 
 				/* Uwaga: To nie jest ciÄ
g kończony zerem.
 				 * Note: This is not a null-terminated string. */
-				strncpy((char*) s.filename, (char*) tmp->filename, sizeof(s.filename));
+				GG_STATIC_ASSERT(
+					sizeof(s.filename) == sizeof(tmp->filename) - 1,
+					filename_sizes_does_not_match);
+				memcpy((char*)s.filename, (char*)tmp->filename, sizeof(s.filename));
 
 				tmp->state = GG_STATE_WAITING_FOR_ACCEPT;
 				tmp->timeout = GG_DCC7_TIMEOUT_FILE_ACK;
diff --git a/libpurple/protocols/gg/lib/events.c b/libpurple/protocols/gg/lib/events.c
--- a/libpurple/protocols/gg/lib/events.c
+++ b/libpurple/protocols/gg/lib/events.c
@@ -1239,7 +1239,9 @@ static gg_action_t gg_handle_tls_negotia
 	struct gg_event *e, enum gg_state_t next_state,
 	enum gg_state_t alt_state, enum gg_state_t alt2_state)
 {
+#if defined(GG_CONFIG_HAVE_GNUTLS) || defined(GG_CONFIG_HAVE_OPENSSL)
 	int valid_hostname = 0;
+#endif
 
 #ifdef GG_CONFIG_HAVE_GNUTLS
 	unsigned int status;
@@ -1436,6 +1438,7 @@ static gg_action_t gg_handle_tls_negotia
 
 #endif
 
+#if defined(GG_CONFIG_HAVE_GNUTLS) || defined(GG_CONFIG_HAVE_OPENSSL)
 	if (!valid_hostname) {
 		gg_debug_session(sess, GG_DEBUG_MISC, "//   WARNING!  unable to verify hostname\n");
 
@@ -1450,6 +1453,7 @@ static gg_action_t gg_handle_tls_negotia
 	sess->timeout = GG_DEFAULT_TIMEOUT;
 
 	return GG_ACTION_WAIT;
+#endif
 }
 
 static gg_action_t gg_handle_reading_proxy_gg(struct gg_session *sess,
diff --git a/libpurple/protocols/gg/lib/handlers.c b/libpurple/protocols/gg/lib/handlers.c
--- a/libpurple/protocols/gg/lib/handlers.c
+++ b/libpurple/protocols/gg/lib/handlers.c
@@ -27,10 +27,8 @@
  */
 
 #include <ctype.h>
-#ifdef sun
-#  include <sys/filio.h>
-#endif
-
+
+#include "fileio.h"
 #include "network.h"
 #include "strman.h"
 #include "libgadu.h"
diff --git a/libpurple/protocols/gg/lib/internal.h b/libpurple/protocols/gg/lib/internal.h
--- a/libpurple/protocols/gg/lib/internal.h
+++ b/libpurple/protocols/gg/lib/internal.h
@@ -55,6 +55,10 @@
 #  define GG_CDECL
 #endif
 
+#define GG_STATIC_ASSERT(condition, message) \
+	{ typedef char static_assertion_failed_ ## message \
+	[(condition) ? 1 : -1]; }
+
 struct gg_dcc7_relay {
 	uint32_t addr;
 	uint16_t port;
diff --git a/libpurple/protocols/gg/lib/protobuf-c.c b/libpurple/protocols/gg/lib/protobuf-c.c
--- a/libpurple/protocols/gg/lib/protobuf-c.c
+++ b/libpurple/protocols/gg/lib/protobuf-c.c
@@ -1363,7 +1363,6 @@ pack_buffer_packed_payload (const Protob
     }
   return rv;
 
-goto no_packing_needed;
 no_packing_needed:
   buffer->append (buffer, rv, array);
   return rv;
@@ -2028,7 +2027,6 @@ parse_packed_repeated_member (ScannedMem
   *p_n += count;
   return TRUE;
 
-goto no_unpacking_needed;
 no_unpacking_needed:
   memcpy (array, at, count * siz);
   *p_n += count;
diff --git a/libpurple/protocols/gg/lib/resolver.c b/libpurple/protocols/gg/lib/resolver.c
--- a/libpurple/protocols/gg/lib/resolver.c
+++ b/libpurple/protocols/gg/lib/resolver.c
@@ -474,7 +474,8 @@ static void gg_resolver_fork_cleanup(voi
 	if (force)
 		kill(data->pid, SIGKILL);
 
-	waitpid(data->pid, NULL, WNOHANG);
+	/* we don't care about child's exit status, just want to clean it up */
+	(void)waitpid(data->pid, NULL, WNOHANG);
 
 	free(data);
 }
@@ -817,10 +818,10 @@ int gg_session_set_resolver(struct gg_se
 			return 0;
 		}
 
-#ifdef _WIN32
+#ifdef GG_CONFIG_HAVE_PTHREAD
+		type = GG_RESOLVER_PTHREAD;
+#elif defined(_WIN32)
 		type = GG_RESOLVER_WIN32;
-#elif defined(GG_CONFIG_HAVE_PTHREAD) && defined(GG_CONFIG_PTHREAD_DEFAULT)
-		type = GG_RESOLVER_PTHREAD;
 #elif defined(GG_CONFIG_HAVE_FORK)
 		type = GG_RESOLVER_FORK;
 #endif
@@ -944,10 +945,10 @@ int gg_http_set_resolver(struct gg_http 
 			return 0;
 		}
 
-#ifdef _WIN32
+#ifdef GG_CONFIG_HAVE_PTHREAD
+		type = GG_RESOLVER_PTHREAD;
+#elif defined(_WIN32)
 		type = GG_RESOLVER_WIN32;
-#elif defined(GG_CONFIG_HAVE_PTHREAD) && defined(GG_CONFIG_PTHREAD_DEFAULT)
-		type = GG_RESOLVER_PTHREAD;
 #elif defined(GG_CONFIG_HAVE_FORK)
 		type = GG_RESOLVER_FORK;
 #endif



More information about the Commits mailing list