/pidgin/main: 0e2608c5682d: Backport some warning fixes from def...

Tomasz Wasilczyk twasilczyk at pidgin.im
Mon Feb 10 10:58:12 EST 2014


Changeset: 0e2608c5682da4830cfcba95e344a5475a99901a
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-02-10 16:58 +0100
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/0e2608c5682d

Description:

Backport some warning fixes from default branch

diffstat:

 libpurple/plugins/perl/common/BuddyList.xs |   3 ++-
 libpurple/plugins/perl/common/Util.xs      |   3 ++-
 libpurple/protocols/irc/msgs.c             |   2 +-
 libpurple/protocols/novell/nmrtf.c         |  23 ++++++++++++-----------
 libpurple/protocols/zephyr/zephyr.c        |  16 ++++++++++++----
 5 files changed, 29 insertions(+), 18 deletions(-)

diffs (145 lines):

diff --git a/libpurple/plugins/perl/common/BuddyList.xs b/libpurple/plugins/perl/common/BuddyList.xs
--- a/libpurple/plugins/perl/common/BuddyList.xs
+++ b/libpurple/plugins/perl/common/BuddyList.xs
@@ -6,7 +6,8 @@ static void
 chat_components_foreach(gpointer key, gpointer value, gpointer user_data)
 {
 	HV *hv = user_data;
-	hv_store(hv, key, strlen(key), newSVpv(value, 0), 0);
+	if (hv_store(hv, key, strlen(key), newSVpv(value, 0), 0) == NULL)
+		purple_debug_error("perl", "hv_store failed\n");
 }
 
 MODULE = Purple::BuddyList  PACKAGE = Purple  PREFIX = purple_
diff --git a/libpurple/plugins/perl/common/Util.xs b/libpurple/plugins/perl/common/Util.xs
--- a/libpurple/plugins/perl/common/Util.xs
+++ b/libpurple/plugins/perl/common/Util.xs
@@ -29,7 +29,8 @@ purple_perl_util_url_cb(PurpleUtilFetchU
 static void markup_find_tag_foreach(GQuark key_id, char *data, HV *hv) {
 	const char *key = NULL;
 	key = g_quark_to_string(key_id);
-	hv_store(hv, key, strlen(key), newSVpv(data, 0), 0);
+	if (hv_store(hv, key, strlen(key), newSVpv(data, 0), 0) == NULL)
+		purple_debug_error("perl", "hv_store failed\n");
 }
 
 MODULE = Purple::Util  PACKAGE = Purple::Util  PREFIX = purple_
diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c
--- a/libpurple/protocols/irc/msgs.c
+++ b/libpurple/protocols/irc/msgs.c
@@ -105,7 +105,7 @@ static void irc_connected(struct irc_con
 
 	/* If we're away then set our away message */
 	status = purple_account_get_active_status(irc->account);
-	if (purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) {
+	if (purple_status_type_get_primitive(purple_status_get_type(status)) != PURPLE_STATUS_AVAILABLE) {
 		PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
 		prpl_info->set_status(irc->account, status);
 	}
diff --git a/libpurple/protocols/novell/nmrtf.c b/libpurple/protocols/novell/nmrtf.c
--- a/libpurple/protocols/novell/nmrtf.c
+++ b/libpurple/protocols/novell/nmrtf.c
@@ -132,7 +132,8 @@ struct _NMRtfContext
 	int depth;				/* how many groups deep are we */
 	gboolean skip_unknown;	/* if true, skip any unknown destinations (this is set after encountering '\*') */
 	char *input;			/* input string */
-	char nextch;			/* next char in input */
+	guchar nextch;			/* next char in input */
+	gboolean nextch_available;	/* nextch value is set */
 	GString *ansi;   		/* Temporary ansi text, will be convert/flushed to the output string */
 	GString *output; 		/* The plain text UTF8 string */
 };
@@ -217,7 +218,7 @@ NMRtfContext *
 nm_rtf_init()
 {
 	NMRtfContext *ctx = g_new0(NMRtfContext, 1);
-	ctx->nextch = -1;
+	ctx->nextch_available = FALSE;
 	ctx->ansi = g_string_new("");
 	ctx->output = g_string_new("");
 	return ctx;
@@ -507,7 +508,7 @@ rtf_parse_keyword(NMRtfContext *ctx)
     int param = 0;
     char keyword[30];
     char parameter[20];
-	int i;
+	gsize i;
 
     keyword[0] = '\0';
     parameter[0] = '\0';
@@ -802,14 +803,13 @@ rtf_dispatch_special(NMRtfContext *ctx, 
 static int
 rtf_get_char(NMRtfContext *ctx, guchar *ch)
 {
-    if (ctx->nextch >= 0) {
-        *ch = ctx->nextch;
-        ctx->nextch = -1;
-    }
-    else {
+	if (ctx->nextch_available) {
+		*ch = ctx->nextch;
+		ctx->nextch_available = FALSE;
+	} else {
 		*ch = *(ctx->input);
 		ctx->input++;
-    }
+	}
 
 	if (*ch)
 		return NMRTF_OK;
@@ -823,6 +823,7 @@ rtf_get_char(NMRtfContext *ctx, guchar *
 static int
 rtf_unget_char(NMRtfContext *ctx, guchar ch)
 {
-    ctx->nextch = ch;
-    return NMRTF_OK;
+	ctx->nextch = ch;
+	ctx->nextch_available = TRUE;
+	return NMRTF_OK;
 }
diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c
--- a/libpurple/protocols/zephyr/zephyr.c
+++ b/libpurple/protocols/zephyr/zephyr.c
@@ -828,14 +828,12 @@ static void handle_message(PurpleConnect
 		int len;
 		char *stripped_sender;
 		int signature_length = strlen(notice.z_message);
-		int message_has_no_body = 0;
 		PurpleMessageFlags flags = 0;
 		gchar *tmpescape;
 
 		/* Need to deal with 0 length  messages to handle typing notification (OPCODE) ping messages */
 		/* One field zephyrs would have caused purple to crash */
 		if ( (notice.z_message_len == 0) || (signature_length >= notice.z_message_len - 1)) {
-			message_has_no_body = 1;
 			len = 0;
 			purple_debug_info("zephyr","message_size %d %d %d\n",len,notice.z_message_len,signature_length);
 			buf3 = g_strdup("");
@@ -1080,7 +1078,12 @@ static parse_tree  *read_from_tzc(zephyr
 
 	while (select(zephyr->fromtzc[ZEPHYR_FD_READ] + 1, &rfds, NULL, NULL, &tv)) {
 		selected = 1;
-		read(zephyr->fromtzc[ZEPHYR_FD_READ], bufcur, 1);
+		if (read(zephyr->fromtzc[ZEPHYR_FD_READ], bufcur, 1) != 1) {
+			purple_debug_error("zephyr", "couldn't read\n");
+			purple_connection_error(purple_account_get_connection(zephyr->account), "couldn't read");
+			free(buf);
+			return NULL;
+		}
 		bufcur++;
 		if ((bufcur - buf) > (bufsize - 1)) {
 			if ((buf = realloc(buf, bufsize * 2)) == NULL) {
@@ -1679,7 +1682,12 @@ static void zephyr_login(PurpleAccount *
 			FD_SET(zephyr->fromtzc[ZEPHYR_FD_READ], &rfds);
 			while (select_status > 0 &&
 			       select(zephyr->fromtzc[ZEPHYR_FD_READ] + 1, &rfds, NULL, NULL, &tv) > 0) {
-				read(zephyr->fromtzc[ZEPHYR_FD_READ], bufcur, 1);
+				if (read(zephyr->fromtzc[ZEPHYR_FD_READ], bufcur, 1) != 1) {
+					purple_debug_error("zephyr", "couldn't read\n");
+					purple_connection_error(gc, "couldn't read");
+					free(buf);
+					return;
+				}
 				bufcur++;
 				if ((bufcur - buf) > (bufsize - 1)) {
 					if ((buf = realloc(buf, bufsize * 2)) == NULL) {



More information about the Commits mailing list