summaryrefslogtreecommitdiff
path: root/libpurple/protocols/qq/im.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpurple/protocols/qq/im.c')
-rw-r--r--libpurple/protocols/qq/im.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/libpurple/protocols/qq/im.c b/libpurple/protocols/qq/im.c
index c4363bf826..32684174ae 100644
--- a/libpurple/protocols/qq/im.c
+++ b/libpurple/protocols/qq/im.c
@@ -547,7 +547,6 @@ qq_im_format *qq_im_fmt_new_by_purple(const gchar *msg)
const gchar *start, *end, *last;
GData *attribs;
gchar *tmp;
- unsigned char *rgb;
g_return_val_if_fail(msg != NULL, NULL);
@@ -570,8 +569,11 @@ qq_im_format *qq_im_fmt_new_by_purple(const gchar *msg)
tmp = g_datalist_get_data(&attribs, "color");
if (tmp && strlen(tmp) > 1) {
- rgb = purple_base16_decode(tmp + 1, NULL);
- g_memmove(fmt->rgb, rgb, 3);
+ unsigned char *rgb;
+ gsize rgb_len;
+ rgb = purple_base16_decode(tmp + 1, &rgb_len);
+ if (rgb != NULL && rgb_len >= 3)
+ g_memmove(fmt->rgb, rgb, 3);
g_free(rgb);
}
@@ -725,7 +727,6 @@ void qq_got_message(PurpleConnection *gc, const gchar *msg)
/* process received normal text IM */
static void process_im_text(PurpleConnection *gc, guint8 *data, gint len, qq_im_header *im_header)
{
- qq_data *qd;
guint16 purple_msg_type;
gchar *who;
gchar *msg_smiley, *msg_fmt, *msg_utf8;
@@ -749,10 +750,9 @@ static void process_im_text(PurpleConnection *gc, guint8 *data, gint len, qq_im_
gchar *msg; /* no fixed length, ends with 0x00 */
} im_text;
- g_return_if_fail (data != NULL && len > 0);
+ g_return_if_fail(data != NULL && len > 0);
g_return_if_fail(im_header != NULL);
- qd = (qq_data *) gc->proto_data;
memset(&im_text, 0, sizeof(im_text));
/* qq_show_packet("IM text", data, len); */
@@ -823,7 +823,6 @@ static void process_im_text(PurpleConnection *gc, guint8 *data, gint len, qq_im_
/* process received extended (2007) text IM */
static void process_extend_im_text(PurpleConnection *gc, guint8 *data, gint len, qq_im_header *im_header)
{
- qq_data *qd;
guint16 purple_msg_type;
gchar *who;
gchar *msg_smiley, *msg_fmt, *msg_utf8;
@@ -848,10 +847,9 @@ static void process_extend_im_text(PurpleConnection *gc, guint8 *data, gint len,
guint8 fromMobileQQ;
} im_text;
- g_return_if_fail (data != NULL && len > 0);
+ g_return_if_fail(data != NULL && len > 0);
g_return_if_fail(im_header != NULL);
- qd = (qq_data *) gc->proto_data;
memset(&im_text, 0, sizeof(im_text));
/* qq_show_packet("Extend IM text", data, len); */
@@ -1043,12 +1041,10 @@ static void request_send_im(PurpleConnection *gc, guint32 uid_to, gint type,
{
qq_data *qd;
guint8 raw_data[MAX_PACKET_SIZE - 16];
- guint16 im_type;
gint bytes;
time_t now;
qd = (qq_data *) gc->proto_data;
- im_type = QQ_NORMAL_IM_TEXT;
/* purple_debug_info("QQ", "Send IM %d-%d\n", frag_count, frag_index); */
bytes = 0;
@@ -1118,13 +1114,12 @@ GSList *qq_im_get_segments(gchar *msg_stripped, gboolean is_smiley_none)
GString *new_string;
GString *append_utf8;
gchar *start, *p;
- gint count, len;
+ gint len;
qq_emoticon *emoticon;
g_return_val_if_fail(msg_stripped != NULL, NULL);
start = msg_stripped;
- count = 0;
new_string = g_string_new("");
append_utf8 = g_string_new("");
while (*start) {