# HG changeset patch # User Richard Laager # Date 1227734068 0 # Node ID 4777c46817760127074727277f648a081a93fc4e # Parent bec26d0c153d0097c1279fdb5534c69b562858ce Remove the length parameter from zephyr_recv_convert(), because we were always passing it strlen(string) anyway. strlen() stops at the first NUL, so if we're assuming the string is NUL-terminated, we can just pass -1 as the length to g_convert(). diff -r bec26d0c153d -r 4777c4681776 libpurple/protocols/zephyr/zephyr.c --- a/libpurple/protocols/zephyr/zephyr.c Wed Nov 26 21:11:05 2008 +0000 +++ b/libpurple/protocols/zephyr/zephyr.c Wed Nov 26 21:14:28 2008 +0000 @@ -343,7 +343,7 @@ Converts strings to utf-8 if necessary using user specified encoding */ -static gchar *zephyr_recv_convert(PurpleConnection *gc,gchar *string, int len) +static gchar *zephyr_recv_convert(PurpleConnection *gc, gchar *string) { gchar *utf8; GError *err = NULL; @@ -351,7 +351,7 @@ if (g_utf8_validate(string, len, NULL)) { return g_strdup(string); } else { - utf8 = g_convert(string, len, "UTF-8", zephyr->encoding, NULL, NULL, &err); + utf8 = g_convert(string, -1, "UTF-8", zephyr->encoding, NULL, NULL, &err); if (err) { purple_debug_error("zephyr", "recv conversion error: %s\n", err->message); utf8 = g_strdup(_("(There was an error converting this message. Check the 'Encoding' option in the Account Editor)")); @@ -843,7 +843,7 @@ tmpescape = g_markup_escape_text(buf, -1); g_free(buf); buf2 = zephyr_to_html(tmpescape); - buf3 = zephyr_recv_convert(gc,buf2, strlen(buf2)); + buf3 = zephyr_recv_convert(gc, buf2); g_free(buf2); g_free(tmpescape); } @@ -883,7 +883,7 @@ Realm from the sender field */ sendertmp = zephyr_strip_local_realm(zephyr,notice.z_sender); send_inst = g_strdup_printf("%s %s",sendertmp,notice.z_class_inst); - send_inst_utf8 = zephyr_recv_convert(gc,send_inst, strlen(send_inst)); + send_inst_utf8 = zephyr_recv_convert(gc,send_inst); if (!send_inst_utf8) { purple_debug_error("zephyr","send_inst %s became null\n", send_inst); send_inst_utf8 = "malformed instance"; @@ -2580,7 +2580,7 @@ gc->account); gcc = purple_conversation_get_chat_data(gconv); - topic_utf8 = zephyr_recv_convert(gc,(gchar *)topic,strlen(topic)); + topic_utf8 = zephyr_recv_convert(gc,(gchar *)topic); purple_conv_chat_set_topic(gcc,sender,topic_utf8); g_free(topic_utf8); return;