pidgin: bf1a6512: g_strsplit_set is new in glib 2.4
nosnilmot at pidgin.im
nosnilmot at pidgin.im
Tue Jan 6 20:25:39 EST 2009
-----------------------------------------------------------------
Revision: bf1a6512656e8ca55b15aa2d47f380b190ba359c
Ancestor: 5c8115315c3a1b870f0ce704838abc529b3d9a22
Author: nosnilmot at pidgin.im
Date: 2009-01-07T01:15:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/bf1a6512656e8ca55b15aa2d47f380b190ba359c
Modified files:
libpurple/protocols/qq/im.c
libpurple/protocols/qq/qq_network.c
libpurple/protocols/qq/qq_process.c
libpurple/protocols/qq/utils.c
ChangeLog:
g_strsplit_set is new in glib 2.4
g_strv_length is new in glib 2.6
This is one reason I didn't get around to making RPMs for 2.5.3, I don't
(yet) know if there are other glib version dependencies to deal with...
-------------- next part --------------
============================================================
--- libpurple/protocols/qq/im.c 013035d827433e67384c935dd3ed0ef769a563f6
+++ libpurple/protocols/qq/im.c 082271123ef86ac720a377c680bdfaf3848c8ad5
@@ -467,7 +467,10 @@ gchar *qq_emoticon_to_purple(gchar *text
/* qq_show_packet("text", (guint8 *)text, strlen(text)); */
g_return_val_if_fail(text != NULL && strlen(text) != 0, g_strdup(""));
- segments = g_strsplit_set(text, "\x14\x15", 0);
+ while ((cur = strchr(text, '\x14')) != NULL)
+ *cur = '\x15';
+
+ segments = g_strsplit(text, "\x15", 0);
if(segments == NULL) {
return g_strdup("");
}
============================================================
--- libpurple/protocols/qq/qq_network.c 7efc1ba7cf25c27c33c635663af8fbf9cc2cff3f
+++ libpurple/protocols/qq/qq_network.c babc5c7f8dea3dc9e2671df1c33c5f5af09018a5
@@ -214,7 +214,7 @@ gboolean qq_connect_later(gpointer data)
qd->connect_retry = QQ_CONNECT_MAX;
}
- segments = g_strsplit_set(qd->curr_server, ":", 0);
+ segments = g_strsplit(qd->curr_server, ":", 0);
tmp_server = g_strdup(segments[0]);
if (NULL != segments[1]) {
port = atoi(segments[1]);
============================================================
--- libpurple/protocols/qq/qq_process.c 7f3ccc2fd1731393f4f618090c7865fa3d1b54ca
+++ libpurple/protocols/qq/qq_process.c 8705ec2183ad1d7ac08cb90fe9f23216c7c05ace
@@ -435,8 +435,8 @@ static void process_server_msg(PurpleCon
static void process_server_msg(PurpleConnection *gc, guint8 *data, gint data_len, guint16 seq)
{
qq_data *qd;
- guint8 *data_str;
- gchar **segments;
+ guint8 *data_str, i = 0;
+ gchar **segments, **seg;
gchar *funct_str, *from, *to;
gint bytes, funct;
@@ -448,9 +448,11 @@ static void process_server_msg(PurpleCon
g_memmove(data_str, data, data_len);
data_str[data_len] = 0x00;
- segments = g_strsplit_set((gchar *) data_str, "\x1f", 0);
+ segments = g_strsplit((gchar *) data_str, "\x1f", 0);
g_return_if_fail(segments != NULL);
- if (g_strv_length(segments) < 3) {
+ for (seg = segments; *seg != NULL; seg++)
+ i++;
+ if (i < 3) {
purple_debug_warning("QQ", "Server message segments is less than 3\n");
g_strfreev(segments);
return;
============================================================
--- libpurple/protocols/qq/utils.c a4ed4e9518bdaa2a6c4bf677519366b9ab5a015b
+++ libpurple/protocols/qq/utils.c 72dee5ecaa368cfff52f6850e79cfd32cdb62a63
@@ -95,8 +95,8 @@ gchar **split_data(guint8 *data, gint le
gchar **split_data(guint8 *data, gint len, const gchar *delimit, gint expected_fields)
{
guint8 *input;
- gchar **segments;
- gint count, j;
+ gchar **segments, **seg;
+ gint count = 0, j;
g_return_val_if_fail(data != NULL && len != 0 && delimit != 0, NULL);
@@ -106,11 +106,12 @@ gchar **split_data(guint8 *data, gint le
g_memmove(input, data, len);
input[len] = 0x00;
- segments = g_strsplit_set((gchar *) input, delimit, 0);
+ segments = g_strsplit((gchar *) input, delimit, 0);
if (expected_fields <= 0)
return segments;
- count = g_strv_length(segments);
+ for (seg = segments; *seg != NULL; seg++)
+ count++;
if (count < expected_fields) { /* not enough fields */
purple_debug_error("QQ", "Less fields %d then %d\n", count, expected_fields);
return NULL;
More information about the Commits
mailing list