/pidgin/main: e85b5b8a4087: Merge release-2.x.y

Richard Laager rlaager at pidgin.im
Sun Jan 13 17:02:40 EST 2013


Changeset: e85b5b8a4087029ee168eb18fdc6fbd13fb327da
Author:	 Richard Laager <rlaager at pidgin.im>
Date:	 2013-01-13 15:55 -0600
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/e85b5b8a4087

Description:

Merge release-2.x.y

diffstat:

 ChangeLog                             |   3 +++
 Makefile.am                           |   4 ++--
 libpurple/log.c                       |  12 +++++-------
 libpurple/plugins/log_reader.c        |   3 +--
 libpurple/plugins/tcl/signal-test.tcl |   2 +-
 libpurple/plugins/tcl/tcl.c           |  34 +++++++---------------------------
 libpurple/stringref.c                 |   4 +++-
 libpurple/upnp.c                      |   1 +
 8 files changed, 23 insertions(+), 40 deletions(-)

diffs (195 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -70,6 +70,9 @@ version 2.10.7:
 	  (Bartosz Brachaczek) (#15329)
 	* Fix UPNP mappings on routers that return empty <URLBase/> elements
 	  in their response. (Ferdinand Stehle) (#15373)
+	* Tcl plugin uses saner, race-free plugin loading.
+	* Fix the Tcl signals-test plugin for savedstatus-changed.
+          (Andrew Shadura) (#15443)
 
 	Pidgin:
 	* Make Pidgin more friendly to non-X11 GTK+, such as MacPorts' +no_x11
diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,13 +54,13 @@ version-check:
 # ... and have no changes in the working copy. (this isn't really necessary with hg because hg id appends a "+")
 	test "x`hg st -mard`" = x
 
-packages:
+sign-packages: dist
 	gpg -ab pidgin-$(PACKAGE_VERSION).tar.gz
 	gpg -ab pidgin-$(PACKAGE_VERSION).tar.bz2
 	gpg --verify pidgin-$(PACKAGE_VERSION).tar.gz.asc pidgin-$(PACKAGE_VERSION).tar.gz
 	gpg --verify pidgin-$(PACKAGE_VERSION).tar.bz2.asc pidgin-$(PACKAGE_VERSION).tar.bz2
 
-release: commit-check version-check distcheck packages
+release: commit-check version-check distcheck sign-packages
 
 if INSTALL_I18N
 PO_DIR=po
diff --git a/libpurple/log.c b/libpurple/log.c
--- a/libpurple/log.c
+++ b/libpurple/log.c
@@ -1766,7 +1766,7 @@ static GList *old_logger_list(PurpleLogT
 	index_tmp = g_strdup_printf("%s.XXXXXX", pathstr);
 	if ((index_fd = g_mkstemp(index_tmp)) == -1) {
 		purple_debug_error("log", "Failed to open index temp file: %s\n",
-		                 g_strerror(errno));
+		                   g_strerror(errno));
 		g_free(pathstr);
 		g_free(index_tmp);
 		index = NULL;
@@ -1774,7 +1774,7 @@ static GList *old_logger_list(PurpleLogT
 		if ((index = fdopen(index_fd, "wb")) == NULL)
 		{
 			purple_debug_error("log", "Failed to fdopen() index temp file: %s\n",
-			                 g_strerror(errno));
+			                   g_strerror(errno));
 			close(index_fd);
 			if (index_tmp != NULL)
 			{
@@ -1830,7 +1830,6 @@ static GList *old_logger_list(PurpleLogT
 					log->logger_data = data;
 					list = g_list_prepend(list, log);
 
-					/* XXX: There is apparently Is there a proper way to print a time_t? */
 					if (index != NULL)
 						fprintf(index, "%d\t%d\t%lu\n", data->offset, data->length, (unsigned long)log->time);
 				}
@@ -1890,9 +1889,8 @@ static GList *old_logger_list(PurpleLogT
 			log->logger_data = data;
 			list = g_list_prepend(list, log);
 
-			/* XXX: Is there a proper way to print a time_t? */
 			if (index != NULL)
-				fprintf(index, "%d\t%d\t%d\n", data->offset, data->length, (int)log->time);
+				fprintf(index, "%d\t%d\t%lu\n", data->offset, data->length, (unsigned long)log->time);
 		}
 	}
 
@@ -2025,7 +2023,7 @@ static void old_logger_get_log_sets(Purp
 		/* Search the buddy list to find the account and to determine if this is a buddy. */
 		for (gnode = purple_blist_get_root();
 		     !found && gnode != NULL;
-			 gnode = purple_blist_node_get_sibling_next(gnode))
+		     gnode = purple_blist_node_get_sibling_next(gnode))
 		{
 			if (!PURPLE_BLIST_NODE_IS_GROUP(gnode))
 				continue;
@@ -2039,7 +2037,7 @@ static void old_logger_get_log_sets(Purp
 
 				for (bnode = purple_blist_node_get_first_child(cnode);
 				     !found && bnode != NULL;
-					 bnode = purple_blist_node_get_sibling_next(bnode))
+				     bnode = purple_blist_node_get_sibling_next(bnode))
 				{
 					PurpleBuddy *buddy = (PurpleBuddy *)bnode;
 
diff --git a/libpurple/plugins/log_reader.c b/libpurple/plugins/log_reader.c
--- a/libpurple/plugins/log_reader.c
+++ b/libpurple/plugins/log_reader.c
@@ -921,7 +921,6 @@ static char * msn_logger_read (PurpleLog
 		xmlnode *to;
 		enum name_guesses name_guessed = NAME_GUESS_UNKNOWN;
 		const char *their_name;
-		time_t time_unix;
 		struct tm *tm;
 		char *timestamp;
 		char *tmp;
@@ -1101,7 +1100,7 @@ static char * msn_logger_read (PurpleLog
 			text = g_string_append(text, ";\">");
 		}
 
-		time_unix = msn_logger_parse_timestamp(message, &tm);
+		msn_logger_parse_timestamp(message, &tm);
 
 		timestamp = g_strdup_printf("<font size=\"2\">(%02u:%02u:%02u)</font> ",
 				tm->tm_hour, tm->tm_min, tm->tm_sec);
diff --git a/libpurple/plugins/tcl/signal-test.tcl b/libpurple/plugins/tcl/signal-test.tcl
--- a/libpurple/plugins/tcl/signal-test.tcl
+++ b/libpurple/plugins/tcl/signal-test.tcl
@@ -108,7 +108,7 @@ purple::signal connect [purple::plugins 
 	purple::debug -info "tcl signal" "plugin-unload [list $args]"
 }
 
-purple::signal connect [purple::savedstatuses handle] savedstatus-changed args {
+purple::signal connect [purple::savedstatus handle] savedstatus-changed args {
 	purple::debug -info "tcl signal" "savedstatus-changed [list $args]"
 	purple::debug -info "tcl signal" "purple::savedstatus current = [purple::savedstatus current]"
 }
diff --git a/libpurple/plugins/tcl/tcl.c b/libpurple/plugins/tcl/tcl.c
--- a/libpurple/plugins/tcl/tcl.c
+++ b/libpurple/plugins/tcl/tcl.c
@@ -174,37 +174,17 @@ static gboolean tcl_probe_plugin(PurpleP
 	Tcl_Interp *interp;
 	Tcl_Parse parse;
 	Tcl_Obj *result, **listitems;
-	struct stat st;
-	FILE *fp;
-	char *buf, *cur;
+	char *buf;
 	const char *next;
-	int len, found = 0, err = 0, nelems;
+	int found = 0, err = 0, nelems;
+	gsize len;
 	gboolean status = FALSE;
-	if ((fp = g_fopen(plugin->path, "r")) == NULL)
-		return FALSE;
-	if (fstat(fileno(fp), &st)) {
-		fclose(fp);
+
+	if (!g_file_get_contents(plugin->path, &buf, &len, NULL)) {
+		purple_debug(PURPLE_DEBUG_INFO, "tcl", "Error opening plugin %s\n",
+			     plugin->path);
 		return FALSE;
 	}
-	len = st.st_size;
-
-	buf = g_malloc(len + 1);
-
-	cur = buf;
-	while (fgets(cur, GPOINTER_TO_INT(buf) - (buf - cur), fp)) {
-		cur += strlen(cur);
-		if (feof(fp))
-			break;
-	}
-
-	if (ferror(fp)) {
-		purple_debug(PURPLE_DEBUG_ERROR, "tcl", "error reading %s (%s)\n", plugin->path, g_strerror(errno));
-		g_free(buf);
-		fclose(fp);
-		return FALSE;
-	}
-
-	fclose(fp);
 
 	if ((interp = tcl_create_interp()) == NULL) {
 		return FALSE;
diff --git a/libpurple/stringref.c b/libpurple/stringref.c
--- a/libpurple/stringref.c
+++ b/libpurple/stringref.c
@@ -73,7 +73,9 @@ PurpleStringref *purple_stringref_new(co
 	len = strlen(value);
 
 	newref = g_malloc(sizeof(PurpleStringref) + len);
-	g_strlcpy(newref->value, value, len);
+	/* g_strlcpy() takes the size of the buffer, including the NUL.
+	   strlen() returns the length of the string, without the NUL. */
+	g_strlcpy(newref->value, value, len + 1);
 	newref->ref = 1;
 
 	return newref;
diff --git a/libpurple/upnp.c b/libpurple/upnp.c
--- a/libpurple/upnp.c
+++ b/libpurple/upnp.c
@@ -257,6 +257,7 @@ purple_upnp_parse_description_response(c
 	}
 
 	/* get the baseURL of the device */
+	baseURL = NULL;
 	if((baseURLNode = xmlnode_get_child(xmlRootNode, "URLBase")) != NULL) {
 		baseURL = xmlnode_get_data(baseURLNode);
 	}



More information about the Commits mailing list