Mercurial > pidgin.yaz
changeset 18141:833f7cbe4f12
A patch from o_sukhodolsky to fix a compiler warning in the QQ code. I've
modified this patch so it actually compiles, then used the new function to
fix the other warning in the same file.
Fixes #1566
References #1344
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 17 Jun 2007 01:11:45 +0000 |
parents | 00cec200ec58 |
children | eec2b191ef71 |
files | libpurple/protocols/qq/group_im.c libpurple/protocols/qq/login_logout.c libpurple/protocols/qq/packet_parse.c libpurple/protocols/qq/packet_parse.h |
diffstat | 4 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/qq/group_im.c Sun Jun 17 00:19:12 2007 +0000 +++ b/libpurple/protocols/qq/group_im.c Sun Jun 17 01:11:45 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 00:19:12 2007 +0000 +++ b/libpurple/protocols/qq/login_logout.c Sun Jun 17 01:11:45 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 00:19:12 2007 +0000 +++ b/libpurple/protocols/qq/packet_parse.c Sun Jun 17 01:11:45 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 00:19:12 2007 +0000 +++ b/libpurple/protocols/qq/packet_parse.h Sun Jun 17 01:11:45 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);