libpurple/protocols/qq/im.c

changeset 16271
9605b8b1c673
parent 15884
4de1981757fc
child 18068
b6554e3c8224
child 18273
e61c53184c52
equal deleted inserted replaced
16270:1c8f9f57aa8d 16271:9605b8b1c673
121 guint8 *qq_get_send_im_tail(const gchar *font_color, 121 guint8 *qq_get_send_im_tail(const gchar *font_color,
122 const gchar *font_size, 122 const gchar *font_size,
123 const gchar *font_name, 123 const gchar *font_name,
124 gboolean is_bold, gboolean is_italic, gboolean is_underline, gint tail_len) 124 gboolean is_bold, gboolean is_italic, gboolean is_underline, gint tail_len)
125 { 125 {
126 gchar *s1, *s2; 126 gchar *s1;
127 unsigned char *rgb; 127 unsigned char *rgb;
128 gint font_name_len; 128 gint font_name_len;
129 guint8 *send_im_tail; 129 guint8 *send_im_tail;
130 const guint8 simsun[] = { 0xcb, 0xce, 0xcc, 0xe5 }; 130 const guint8 simsun[] = { 0xcb, 0xce, 0xcc, 0xe5 };
131 131
157 157
158 if (font_color) { 158 if (font_color) {
159 s1 = g_strndup(font_color + 1, 6); 159 s1 = g_strndup(font_color + 1, 6);
160 /* Henry: maybe this is a bug of purple, the string should have 160 /* Henry: maybe this is a bug of purple, the string should have
161 * the length of odd number @_@ 161 * the length of odd number @_@
162 * George Ang: This BUG maybe fixed by Purple. adding new byte
163 * would cause a crash.
162 */ 164 */
163 s2 = g_strdup_printf("%sH", s1); 165 /* s2 = g_strdup_printf("%sH", s1); */
164 rgb = purple_base16_decode(s2, NULL); 166 rgb = purple_base16_decode(s1, NULL);
165 g_free(s1); 167 g_free(s1);
166 g_free(s2); 168 /* g_free(s2); */
167 memcpy(send_im_tail + 2, rgb, 3); 169 if (rgb)
168 g_free(rgb); 170 {
171 memcpy(send_im_tail + 2, rgb, 3);
172 g_free(rgb);
173 } else {
174 send_im_tail[2] = send_im_tail[3] = send_im_tail[4] = 0;
175 }
169 } else { 176 } else {
170 send_im_tail[2] = send_im_tail[3] = send_im_tail[4] = 0; 177 send_im_tail[2] = send_im_tail[3] = send_im_tail[4] = 0;
171 } 178 }
172 179
173 send_im_tail[5] = 0x00; 180 send_im_tail[5] = 0x00;

mercurial