/pidgin/main: 9b7b48f446f4: Backport warning fixes from default
Tomasz Wasilczyk
twasilczyk at pidgin.im
Tue May 6 06:43:41 EDT 2014
Changeset: 9b7b48f446f479d1c10c44c377211a1d7adf5934
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-05-06 12:43 +0200
Branch: release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/9b7b48f446f4
Description:
Backport warning fixes from default
diffstat:
libpurple/internal.h | 13 +++++++++++++
libpurple/protocols/jabber/jingle/jingle.c | 8 +++++++-
libpurple/protocols/jabber/si.c | 6 +++---
libpurple/protocols/msn/msnutils.c | 5 +++--
libpurple/protocols/mxit/chunk.c | 2 +-
libpurple/protocols/myspace/myspace.c | 4 ++--
libpurple/protocols/oscar/family_feedbag.c | 4 ++--
libpurple/protocols/oscar/oscar.c | 6 +++---
libpurple/protocols/oscar/tlv.c | 10 +++++-----
libpurple/protocols/oscar/userinfo.c | 20 ++++++++++----------
10 files changed, 49 insertions(+), 29 deletions(-)
diffs (261 lines):
diff --git a/libpurple/internal.h b/libpurple/internal.h
--- a/libpurple/internal.h
+++ b/libpurple/internal.h
@@ -154,6 +154,19 @@
#include <glib-object.h>
+#ifdef __clang__
+
+#undef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ _Pragma ("clang diagnostic push") \
+ _Pragma ("clang diagnostic ignored \"-Wdeprecated-declarations\"")
+
+#undef G_GNUC_END_IGNORE_DEPRECATIONS
+#define G_GNUC_END_IGNORE_DEPRECATIONS \
+ _Pragma ("clang diagnostic pop")
+
+#endif /* __clang__ */
+
/* Safer ways to work with static buffers. When using non-static
* buffers, either use g_strdup_* functions (preferred) or use
* g_strlcpy/g_strlcpy directly. */
diff --git a/libpurple/protocols/jabber/jingle/jingle.c b/libpurple/protocols/jabber/jingle/jingle.c
--- a/libpurple/protocols/jabber/jingle/jingle.c
+++ b/libpurple/protocols/jabber/jingle/jingle.c
@@ -456,13 +456,15 @@ jingle_create_relay_info(const gchar *ip
"password", G_TYPE_STRING, password,
"relay-type", G_TYPE_STRING, relay_type,
NULL);
- purple_debug_info("jabber", "created gst_structure %" GST_PTR_FORMAT "\n",
+ purple_debug_info("jabber", "created gst_structure %p\n",
turn_setup);
if (turn_setup) {
memset(&value, 0, sizeof(GValue));
g_value_init(&value, GST_TYPE_STRUCTURE);
gst_value_set_structure(&value, turn_setup);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
relay_info = g_value_array_append(relay_info, &value);
+G_GNUC_END_IGNORE_DEPRECATIONS
gst_structure_free(turn_setup);
}
return relay_info;
@@ -502,7 +504,9 @@ jingle_get_params(JabberStream *js, cons
}
if (relay_ip) {
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GValueArray *relay_info = g_value_array_new(0);
+G_GNUC_END_IGNORE_DEPRECATIONS
if (relay_udp) {
relay_info =
@@ -520,9 +524,11 @@ jingle_get_params(JabberStream *js, cons
relay_password, "tls", relay_info);
}
params[next_index].name = "relay-info";
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_value_init(¶ms[next_index].value, G_TYPE_VALUE_ARRAY);
g_value_set_boxed(¶ms[next_index].value, relay_info);
g_value_array_free(relay_info);
+G_GNUC_END_IGNORE_DEPRECATIONS
}
}
diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c
--- a/libpurple/protocols/jabber/si.c
+++ b/libpurple/protocols/jabber/si.c
@@ -58,7 +58,7 @@ typedef struct _JabberSIXfer {
STREAM_METHOD_UNKNOWN = 0,
STREAM_METHOD_BYTESTREAMS = 2 << 1,
STREAM_METHOD_IBB = 2 << 2,
- STREAM_METHOD_UNSUPPORTED = 2 << 31
+ STREAM_METHOD_UNSUPPORTED = 2 << 30
} stream_method;
GList *streamhosts;
@@ -866,7 +866,7 @@ jabber_si_xfer_bytestreams_listen_cb(int
jid = g_strdup_printf("%s@%s/%s", jsx->js->user->node,
jsx->js->user->domain, jsx->js->user->resource);
xfer->local_port = purple_network_get_port_from_fd(sock);
- g_snprintf(port, sizeof(port), "%hu", xfer->local_port);
+ g_snprintf(port, sizeof(port), "%hu", (guint16)xfer->local_port);
public_ip = purple_network_get_my_ip(jsx->js->fd);
@@ -917,7 +917,7 @@ jabber_si_xfer_bytestreams_listen_cb(int
streamhost = xmlnode_new_child(query, "streamhost");
xmlnode_set_attrib(streamhost, "jid", sh->jid);
xmlnode_set_attrib(streamhost, "host", sh->host);
- g_snprintf(port, sizeof(port), "%hu", sh->port);
+ g_snprintf(port, sizeof(port), "%hu", (guint16)sh->port);
xmlnode_set_attrib(streamhost, "port", port);
sh2 = g_new0(JabberBytestreamsStreamhost, 1);
diff --git a/libpurple/protocols/msn/msnutils.c b/libpurple/protocols/msn/msnutils.c
--- a/libpurple/protocols/msn/msnutils.c
+++ b/libpurple/protocols/msn/msnutils.c
@@ -124,8 +124,9 @@ msn_parse_format(const char *mime, char
}
g_snprintf(tag, sizeof(tag),
- "<FONT COLOR=\"#%02hhx%02hhx%02hhx\">",
- colors[0], colors[1], colors[2]);
+ "<FONT COLOR=\"#%02x%02x%02x\">",
+ colors[0] & 0xFF, colors[1] & 0xFF,
+ colors[2] & 0xFF);
pre = g_string_append(pre, tag);
post = g_string_prepend(post, "</FONT>");
diff --git a/libpurple/protocols/mxit/chunk.c b/libpurple/protocols/mxit/chunk.c
--- a/libpurple/protocols/mxit/chunk.c
+++ b/libpurple/protocols/mxit/chunk.c
@@ -382,7 +382,7 @@ int mxit_chunk_create_senddirect( char*
*/
int mxit_chunk_create_set_avatar( char* chunkdata, const unsigned char* data, int datalen )
{
- const char fileid[MXIT_CHUNK_FILEID_LEN];
+ char fileid[MXIT_CHUNK_FILEID_LEN];
int pos = 0;
/* id [8 bytes] */
diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c
--- a/libpurple/protocols/myspace/myspace.c
+++ b/libpurple/protocols/myspace/myspace.c
@@ -634,11 +634,11 @@ msim_compute_login_response(const gchar
#ifdef SEND_OUR_IP_ADDRESSES
/* TODO: Obtain IPs of network interfaces instead of using this hardcoded value */
g_string_set_size(data, data->len + 4);
- msim_put32(data->str + data->len - 4, MSIM_LOGIN_IP_LIST_LEN);
+ (void)msim_put32(data->str + data->len - 4, MSIM_LOGIN_IP_LIST_LEN);
g_string_append_len(data, MSIM_LOGIN_IP_LIST, MSIM_LOGIN_IP_LIST_LEN);
#else
g_string_set_size(data, data->len + 4);
- msim_put32(data->str + data->len - 4, 0);
+ (void)msim_put32(data->str + data->len - 4, 0);
#endif /* !SEND_OUR_IP_ADDRESSES */
data_out = g_new0(guchar, data->len);
diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c
--- a/libpurple/protocols/oscar/family_feedbag.c
+++ b/libpurple/protocols/oscar/family_feedbag.c
@@ -1089,8 +1089,8 @@ int aim_ssi_seticon(OscarData *od, const
/* Need to add the 0x00d5 TLV to the TLV chain */
csumdata = (guint8 *)g_malloc((iconsumlen+2)*sizeof(guint8));
- aimutil_put8(&csumdata[0], 0x00);
- aimutil_put8(&csumdata[1], iconsumlen);
+ (void)aimutil_put8(&csumdata[0], 0x00);
+ (void)aimutil_put8(&csumdata[1], iconsumlen);
memcpy(&csumdata[2], iconsum, iconsumlen);
aim_tlvlist_replace_raw(&tmp->data, 0x00d5, (iconsumlen+2) * sizeof(guint8), csumdata);
g_free(csumdata);
diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c
--- a/libpurple/protocols/oscar/oscar.c
+++ b/libpurple/protocols/oscar/oscar.c
@@ -1871,8 +1871,8 @@ incomingim_chan4(OscarData *od, FlapConn
return 1;
purple_debug_info("oscar",
- "Received a channel 4 message of type 0x%02hx.\n",
- args->type);
+ "Received a channel 4 message of type 0x%02hx.\n",
+ (guint16)args->type);
/*
* Split up the message at the delimeter character, then convert each
@@ -3999,7 +3999,7 @@ static int purple_ssi_parselist(OscarDat
if (curitem->name && !g_utf8_validate(curitem->name, -1, NULL)) {
/* Got node with invalid UTF-8 in the name. Skip it. */
purple_debug_warning("oscar", "ssi: server list contains item of "
- "type 0x%04hhx with a non-utf8 name\n", curitem->type);
+ "type 0x%04hx with a non-utf8 name\n", curitem->type);
continue;
}
diff --git a/libpurple/protocols/oscar/tlv.c b/libpurple/protocols/oscar/tlv.c
--- a/libpurple/protocols/oscar/tlv.c
+++ b/libpurple/protocols/oscar/tlv.c
@@ -319,7 +319,7 @@ int aim_tlvlist_add_8(GSList **list, con
{
guint8 v8[1];
- aimutil_put8(v8, value);
+ (void)aimutil_put8(v8, value);
return aim_tlvlist_add_raw(list, type, 1, v8);
}
@@ -336,7 +336,7 @@ int aim_tlvlist_add_16(GSList **list, co
{
guint8 v16[2];
- aimutil_put16(v16, value);
+ (void)aimutil_put16(v16, value);
return aim_tlvlist_add_raw(list, type, 2, v16);
}
@@ -353,7 +353,7 @@ int aim_tlvlist_add_32(GSList **list, co
{
guint8 v32[4];
- aimutil_put32(v32, value);
+ (void)aimutil_put32(v32, value);
return aim_tlvlist_add_raw(list, type, 4, v32);
}
@@ -585,7 +585,7 @@ int aim_tlvlist_replace_8(GSList **list,
{
guint8 v8[1];
- aimutil_put8(v8, value);
+ (void)aimutil_put8(v8, value);
return aim_tlvlist_replace_raw(list, type, 1, v8);
}
@@ -604,7 +604,7 @@ int aim_tlvlist_replace_32(GSList **list
{
guint8 v32[4];
- aimutil_put32(v32, value);
+ (void)aimutil_put32(v32, value);
return aim_tlvlist_replace_raw(list, type, 4, v32);
}
diff --git a/libpurple/protocols/oscar/userinfo.c b/libpurple/protocols/oscar/userinfo.c
--- a/libpurple/protocols/oscar/userinfo.c
+++ b/libpurple/protocols/oscar/userinfo.c
@@ -336,11 +336,11 @@ oscar_user_info_append_extra_info(Purple
bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, userinfo->bn));
if ((bi != NULL) && (bi->ipaddr != 0)) {
- tmp = g_strdup_printf("%hhu.%hhu.%hhu.%hhu",
- (bi->ipaddr & 0xff000000) >> 24,
- (bi->ipaddr & 0x00ff0000) >> 16,
- (bi->ipaddr & 0x0000ff00) >> 8,
- (bi->ipaddr & 0x000000ff));
+ tmp = g_strdup_printf("%u.%u.%u.%u",
+ 0xFF & (bi->ipaddr & 0xff000000) >> 24,
+ 0xFF & (bi->ipaddr & 0x00ff0000) >> 16,
+ 0xFF & (bi->ipaddr & 0x0000ff00) >> 8,
+ 0xFF & (bi->ipaddr & 0x000000ff));
oscar_user_info_add_pair(user_info, _("IP Address"), tmp);
g_free(tmp);
}
@@ -400,11 +400,11 @@ oscar_user_info_display_icq(OscarData *o
purple_notify_user_info_add_pair(user_info, _("UIN"), who);
oscar_user_info_convert_and_add(account, od, user_info, _("Nick"), info->nick);
if ((bi != NULL) && (bi->ipaddr != 0)) {
- char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu",
- (bi->ipaddr & 0xff000000) >> 24,
- (bi->ipaddr & 0x00ff0000) >> 16,
- (bi->ipaddr & 0x0000ff00) >> 8,
- (bi->ipaddr & 0x000000ff));
+ char *tstr = g_strdup_printf("%u.%u.%u.%u",
+ 0xFF & (bi->ipaddr & 0xff000000) >> 24,
+ 0xFF & (bi->ipaddr & 0x00ff0000) >> 16,
+ 0xFF & (bi->ipaddr & 0x0000ff00) >> 8,
+ 0xFF & (bi->ipaddr & 0x000000ff));
purple_notify_user_info_add_pair(user_info, _("IP Address"), tstr);
g_free(tstr);
}
More information about the Commits
mailing list