Mercurial > pidgin
comparison src/protocols/qq/utils.c @ 14017:39d6d4128599
[gaim-migrate @ 16610]
Silenced a few warnings.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Huetsch <markhuetsch> |
|---|---|
| date | Tue, 01 Aug 2006 19:52:51 +0000 |
| parents | 9516a796ed5f |
| children | ef8490f9e823 |
comparison
equal
deleted
inserted
replaced
| 14016:a4aee1adefcf | 14017:39d6d4128599 |
|---|---|
| 90 // we have to duplicate the data and append a 0x00 at the end | 90 // we have to duplicate the data and append a 0x00 at the end |
| 91 input = g_newa(guint8, len + 1); | 91 input = g_newa(guint8, len + 1); |
| 92 g_memmove(input, data, len); | 92 g_memmove(input, data, len); |
| 93 input[len] = 0x00; | 93 input[len] = 0x00; |
| 94 | 94 |
| 95 segments = g_strsplit(input, delimit, 0); | 95 segments = g_strsplit((gchar *) input, delimit, 0); |
| 96 if (expected_fields <= 0) | 96 if (expected_fields <= 0) |
| 97 return segments; | 97 return segments; |
| 98 | 98 |
| 99 for (i = 0; segments[i] != NULL; i++) {; | 99 for (i = 0; segments[i] != NULL; i++) {; |
| 100 } | 100 } |
| 121 /*****************************************************************************/ | 121 /*****************************************************************************/ |
| 122 // given a four-byte ip data, convert it into a human readable ip string | 122 // given a four-byte ip data, convert it into a human readable ip string |
| 123 // the return needs to be freed | 123 // the return needs to be freed |
| 124 gchar *gen_ip_str(guint8 *ip) | 124 gchar *gen_ip_str(guint8 *ip) |
| 125 { | 125 { |
| 126 if (ip == NULL || ip[0] == 0) | 126 gchar *ret; |
| 127 return g_strdup_printf(""); | 127 if (ip == NULL || ip[0] == 0) { |
| 128 else | 128 ret = g_new(gchar, 1); |
| 129 *ret = '\0'; | |
| 130 return ret; | |
| 131 } else | |
| 129 return g_strdup_printf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); | 132 return g_strdup_printf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); |
| 130 } | 133 } |
| 131 | 134 |
| 132 guint8 *str_ip_gen(gchar *str) { | 135 guint8 *str_ip_gen(gchar *str) { |
| 133 guint8 *ip = g_new(guint8, 4); | 136 guint8 *ip = g_new(guint8, 4); |
| 187 // GBK second byte range: 0x40-0x7E and 0x80-0xFE | 190 // GBK second byte range: 0x40-0x7E and 0x80-0xFE |
| 188 for (i = 0; i < len; i++) | 191 for (i = 0; i < len; i++) |
| 189 if (incoming[i] >= 0x81) | 192 if (incoming[i] >= 0x81) |
| 190 break; | 193 break; |
| 191 | 194 |
| 192 msg_utf8 = i < len ? qq_to_utf8(&incoming[i], QQ_CHARSET_DEFAULT) : NULL; | 195 msg_utf8 = i < len ? qq_to_utf8((gchar *) &incoming[i], QQ_CHARSET_DEFAULT) : NULL; |
| 193 | 196 |
| 194 if (msg_utf8 != NULL) { | 197 if (msg_utf8 != NULL) { |
| 195 gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Try extract GB msg: %s\n", msg_utf8); | 198 gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Try extract GB msg: %s\n", msg_utf8); |
| 196 g_free(msg_utf8); | 199 g_free(msg_utf8); |
| 197 } // msg_utf8 != NULL | 200 } // msg_utf8 != NULL |
