/pidgin/main: 72fe8d31bad3: win32: get rid of printf's hh modifi...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Wed Apr 17 14:16:56 EDT 2013


Changeset: 72fe8d31bad36513cfd16fb7a8940c25dedf6c94
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2013-04-17 20:16 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/72fe8d31bad3

Description:

win32: get rid of printf's hh modifier (compatibility)

diffstat:

 libpurple/protocols/jabber/si.c    |   4 ++--
 libpurple/protocols/msn/msnutils.c |   5 +++--
 libpurple/protocols/oscar/oscar.c  |  14 +++++++-------
 libpurple/util.c                   |   6 +++---
 4 files changed, 15 insertions(+), 14 deletions(-)

diffs (128 lines):

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
@@ -616,11 +616,11 @@ jabber_si_xfer_bytestreams_send_read_cb(
 		return;
 	}
 
-	purple_debug_info("jabber", "going to test %hhu different methods\n", jsx->rxqueue[1]);
+	purple_debug_info("jabber", "going to test %hu different methods\n", jsx->rxqueue[1]);
 
 	for(i=0; i<jsx->rxqueue[1]; i++) {
 
-		purple_debug_info("jabber", "testing %hhu\n", jsx->rxqueue[i+2]);
+		purple_debug_info("jabber", "testing %hu\n", jsx->rxqueue[i+2]);
 		if(jsx->rxqueue[i+2] == 0x00) {
 			g_free(jsx->rxqueue);
 			jsx->rxlen = 0;
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=\"#%02hx%02hx%02hx\">",
+				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/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c
--- a/libpurple/protocols/oscar/oscar.c
+++ b/libpurple/protocols/oscar/oscar.c
@@ -898,7 +898,7 @@ static void damn_you(gpointer data, gint
 
 	msg = g_string_new("Sending hash: ");
 	for (x = 0; x < 16; x++)
-		g_string_append_printf(msg, "%02hhx ", (unsigned char)m[x]);
+		g_string_append_printf(msg, "%02hx ", m[x] & 0xFF);
 	g_string_append(msg, "\n");
 	purple_debug_misc("oscar", "%s", msg->str);
 	g_string_free(msg, TRUE);
@@ -2072,7 +2072,7 @@ incomingim_chan4(OscarData *od, FlapConn
 		default: {
 			purple_debug_info("oscar",
 					   "Received a channel 4 message of unknown type "
-					   "(type 0x%02hhx).\n", args->type);
+					   "(type 0x%02hx).\n", args->type & 0xFF);
 		} break;
 	}
 
@@ -2418,7 +2418,7 @@ static int purple_chatnav_info(OscarData
 			exchangecount = va_arg(ap, int);
 			exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
 
-			g_string_append_printf(msg, "chat info: Max Concurrent Rooms: %hhd, Exchange List (%d total): ", maxrooms, exchangecount);
+			g_string_append_printf(msg, "chat info: Max Concurrent Rooms: %hd, Exchange List (%d total): ", maxrooms, exchangecount);
 			for (i = 0; i < exchangecount; i++) {
 				g_string_append_printf(msg, "%hu", exchanges[i].number);
 				if (exchanges[i].name) {
@@ -2459,7 +2459,7 @@ static int purple_chatnav_info(OscarData
 			ck = va_arg(ap, char *);
 
 			purple_debug_misc("oscar",
-					"created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n",
+					"created room: %s %hu %hu %hu %u %hu %hu %hu %hu %s %s\n",
 					fqcn ? fqcn : "(null)", exchange, instance, flags, createtime,
 					maxmsglen, maxoccupancy, createperms, unknown,
 					name ? name : "(null)", ck);
@@ -3956,7 +3956,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;
 		}
 
@@ -4049,7 +4049,7 @@ static int purple_ssi_parselist(OscarDat
 					if (perm_deny != 0 && perm_deny != purple_account_get_privacy_type(account))
 					{
 						purple_debug_info("oscar",
-								   "ssi: changing permdeny from %d to %hhu\n", purple_account_get_privacy_type(account), perm_deny);
+								   "ssi: changing permdeny from %d to %hu\n", purple_account_get_privacy_type(account), perm_deny);
 						purple_account_set_privacy_type(account, perm_deny);
 					}
 				}
@@ -4313,7 +4313,7 @@ static int purple_ssi_authreply(OscarDat
 	va_end(ap);
 
 	purple_debug_info("oscar",
-			   "ssi: received authorization reply from %s.  Reply is 0x%04hhx\n", bn, reply);
+			   "ssi: received authorization reply from %s.  Reply is 0x%04hx\n", bn, reply);
 
 	buddy = purple_find_buddy(purple_connection_get_account(gc), bn);
 	if (buddy && (purple_buddy_get_alias_only(buddy)))
diff --git a/libpurple/util.c b/libpurple/util.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -166,7 +166,7 @@ purple_base16_encode(const guchar *data,
 	ascii = g_malloc(len * 2 + 1);
 
 	for (i = 0; i < len; i++)
-		g_snprintf(&ascii[i * 2], 3, "%02hhx", data[i]);
+		g_snprintf(&ascii[i * 2], 3, "%02hx", data[i] & 0xFF);
 
 	return ascii;
 }
@@ -234,7 +234,7 @@ purple_base16_encode_chunked(const gucha
 	ascii = g_malloc(len * 3 + 1);
 
 	for (i = 0; i < len; i++)
-		g_snprintf(&ascii[i * 3], 4, "%02hhx:", data[i]);
+		g_snprintf(&ascii[i * 3], 4, "%02hx:", data[i] & 0xFF);
 
 	/* Replace the final colon with NULL */
 	ascii[len * 3 - 1] = 0;
@@ -3753,7 +3753,7 @@ purple_str_binary_to_ascii(const unsigne
 
 	for (i = 0; i < len; i++)
 		if (binary[i] < 32 || binary[i] > 126)
-			g_string_append_printf(ret, "\\x%02hhx", binary[i]);
+			g_string_append_printf(ret, "\\x%02hx", binary[i] & 0xFF);
 		else if (binary[i] == '\\')
 			g_string_append(ret, "\\\\");
 		else



More information about the Commits mailing list