libpurple/protocols/qq/char_conv.c

branch
release-2.4.3
changeset 23213
7aaa8e8233bc
parent 23212
a39a33c79a3f
equal deleted inserted replaced
23212:a39a33c79a3f 23213:7aaa8e8233bc
121 121
122 g_error_free(error); 122 g_error_free(error);
123 return g_strdup(QQ_NULL_MSG); 123 return g_strdup(QQ_NULL_MSG);
124 } 124 }
125 125
126 /* 126 /**
127 * @brief 把输入作为一个pascal字符串并返回一个用UFT-8转换的c-字符串.\n
128 * 返回已读入的字节数,或者当遇到错误时返回-1.该完成转换的UTF-8字符串被保存到ret中
129 *
127 * take the input as a pascal string and return a converted c-string in UTF-8 130 * take the input as a pascal string and return a converted c-string in UTF-8
128 * returns the number of bytes read, return -1 if fatal error 131 * returns the number of bytes read, return -1 if fatal error
129 * the converted UTF-8 will be saved in ret 132 * the converted UTF-8 will be saved in ret
130 */ 133 */
131 gint convert_as_pascal_string(guint8 *data, gchar **ret, const gchar *from_charset) 134 gint convert_as_pascal_string(guint8 *data, gchar **ret, const gchar *from_charset)
276 279
277 ret = converted->str; 280 ret = converted->str;
278 g_string_free(converted, FALSE); 281 g_string_free(converted, FALSE);
279 return ret; 282 return ret;
280 } 283 }
281
282 void qq_filter_str(gchar *str) {
283 gchar *temp;
284 if (str == NULL) {
285 return;
286 }
287
288 for (temp = str; *temp != 0; temp++) {
289 if (*temp == '\r' || *temp == '\n') *temp = 0x20;
290 }
291 g_strstrip(str);
292 }
293
294

mercurial