Mon, 10 Feb 2014 16:58:03 +0100
Backport some warning fixes from default branch
--- a/libpurple/plugins/perl/common/BuddyList.xs Thu Feb 06 00:43:23 2014 -0800 +++ b/libpurple/plugins/perl/common/BuddyList.xs Mon Feb 10 16:58:03 2014 +0100 @@ -6,7 +6,8 @@ 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_
--- a/libpurple/plugins/perl/common/Util.xs Thu Feb 06 00:43:23 2014 -0800 +++ b/libpurple/plugins/perl/common/Util.xs Mon Feb 10 16:58:03 2014 +0100 @@ -29,7 +29,8 @@ 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_
--- a/libpurple/protocols/irc/msgs.c Thu Feb 06 00:43:23 2014 -0800 +++ b/libpurple/protocols/irc/msgs.c Mon Feb 10 16:58:03 2014 +0100 @@ -105,7 +105,7 @@ /* 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); }
--- a/libpurple/protocols/novell/nmrtf.c Thu Feb 06 00:43:23 2014 -0800 +++ b/libpurple/protocols/novell/nmrtf.c Mon Feb 10 16:58:03 2014 +0100 @@ -132,7 +132,8 @@ 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 @@ 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 @@ int param = 0; char keyword[30]; char parameter[20]; - int i; + gsize i; keyword[0] = '\0'; parameter[0] = '\0'; @@ -802,14 +803,13 @@ 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 @@ 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; }
--- a/libpurple/protocols/zephyr/zephyr.c Thu Feb 06 00:43:23 2014 -0800 +++ b/libpurple/protocols/zephyr/zephyr.c Mon Feb 10 16:58:03 2014 +0100 @@ -828,14 +828,12 @@ 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 @@ 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 @@ 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) {