changeset 18143:695cb303f688

merge of 'caa48886aab8c94b98936accf9932e04b9864341' and 'f5f51a0bec6148b7230865032d262150af12f625'
author Richard Laager <rlaager@wiktel.com>
date Sun, 17 Jun 2007 02:35:55 +0000
parents 12ab14848af4 (current diff) eec2b191ef71 (diff)
children 1a282f3d8057
files
diffstat 5 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/blist.c	Sun Jun 17 02:36:57 2007 +0000
+++ b/libpurple/blist.c	Sun Jun 17 02:35:55 2007 +0000
@@ -35,8 +35,6 @@
 #include "value.h"
 #include "xmlnode.h"
 
-#define PATHSIZE 1024
-
 static PurpleBlistUiOps *blist_ui_ops = NULL;
 
 static PurpleBuddyList *purplebuddylist = NULL;
--- a/libpurple/protocols/qq/group_im.c	Sun Jun 17 02:36:57 2007 +0000
+++ b/libpurple/protocols/qq/group_im.c	Sun Jun 17 02:35:55 2007 +0000
@@ -341,7 +341,7 @@
 	read_packet_dw(data, cursor, data_len, &(im_group->member_uid));
 	read_packet_w(data, cursor, data_len, &unknown);	/* 0x0001? */
 	read_packet_w(data, cursor, data_len, &(im_group->msg_seq));
-	read_packet_dw(data, cursor, data_len, (guint32 *) & (im_group->send_time));
+	read_packet_time(data, cursor, data_len, &im_group->send_time);
 	read_packet_dw(data, cursor, data_len, &unknown4);	/* versionID */
 	/*
 	 * length includes font_attr
--- a/libpurple/protocols/qq/login_logout.c	Sun Jun 17 02:36:57 2007 +0000
+++ b/libpurple/protocols/qq/login_logout.c	Sun Jun 17 02:35:55 2007 +0000
@@ -181,7 +181,7 @@
 	/* 031-032: server listening port */
 	bytes += read_packet_w(data, &cursor, len, &lrop.server_port);
 	/* 033-036: login time for current session */
-	bytes += read_packet_dw(data, &cursor, len, (guint32 *) &lrop.login_time);
+	bytes += read_packet_time(data, &cursor, len, &lrop.login_time);
 	/* 037-062: 26 bytes, unknown */
 	bytes += read_packet_data(data, &cursor, len, (guint8 *) &lrop.unknown1, 26);
 	/* 063-066: unknown server1 ip address */
@@ -203,7 +203,7 @@
 	/* 123-126: login IP of last session */
 	bytes += read_packet_data(data, &cursor, len, (guint8 *) &lrop.last_client_ip, 4);
 	/* 127-130: login time of last session */
-	bytes += read_packet_dw(data, &cursor, len, (guint32 *) &lrop.last_login_time);
+	bytes += read_packet_time(data, &cursor, len, &lrop.last_login_time);
 	/* 131-138: 8 bytes unknown */
 	bytes += read_packet_data(data, &cursor, len, (guint8 *) &lrop.unknown6, 8);
 
--- a/libpurple/protocols/qq/packet_parse.c	Sun Jun 17 02:36:57 2007 +0000
+++ b/libpurple/protocols/qq/packet_parse.c	Sun Jun 17 02:35:55 2007 +0000
@@ -65,6 +65,19 @@
 	}
 }
 
+/* read four bytes as "time_t" from buf,
+ * return the number of bytes read if succeeds, otherwise return -1
+ * This function is a wrapper around read_packet_dw() to avoid casting. */
+gint read_packet_time(guint8 *buf, guint8 **cursor, gint buflen, time_t *t)
+{
+	guint32 time;
+	gint ret = read_packet_dw(buf, cursor, buflen, &time);
+	if (ret != -1 ) {
+		*t = time;
+	}
+	return ret;
+}
+
 /* read datalen bytes from buf, 
  * return the number of bytes read if succeeds, otherwise return -1 */
 gint read_packet_data(guint8 *buf, guint8 **cursor, gint buflen, guint8 *data, gint datalen) {
--- a/libpurple/protocols/qq/packet_parse.h	Sun Jun 17 02:36:57 2007 +0000
+++ b/libpurple/protocols/qq/packet_parse.h	Sun Jun 17 02:35:55 2007 +0000
@@ -39,6 +39,7 @@
 gint read_packet_b(guint8 *buf, guint8 **cursor, gint buflen, guint8 *b);
 gint read_packet_w(guint8 *buf, guint8 **cursor, gint buflen, guint16 *w);
 gint read_packet_dw(guint8 *buf, guint8 **cursor, gint buflen, guint32 *dw);
+gint read_packet_time(guint8 *buf, guint8 **cursor, gint buflen, time_t *t);
 gint read_packet_data(guint8 *buf, guint8 **cursor, gint buflen, guint8 *data, gint datalen);
 gint create_packet_b(guint8 *buf, guint8 **cursor, guint8 b);
 gint create_packet_w(guint8 *buf, guint8 **cursor, guint16 w);