changeset 14058:32a71e64ceae

[gaim-migrate @ 16673] Eliminated a number of warnings. Generally, this consisted of fixing incorrectly declared data types and adding a few casts. I also moved some declarations that occurred in the middle of code. Minor formatting changes. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Tue, 08 Aug 2006 23:20:08 +0000
parents 44b42bb2c5f8
children 2d1b41e3cf0d
files src/protocols/qq/buddy_opt.c src/protocols/qq/char_conv.c src/protocols/qq/file_trans.c src/protocols/qq/group_info.c src/protocols/qq/group_network.c src/protocols/qq/keep_alive.c src/protocols/qq/recv_core.c src/protocols/qq/send_file.c src/protocols/qq/sendqueue.h src/protocols/qq/sys_msg.c
diffstat 10 files changed, 58 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/qq/buddy_opt.c	Tue Aug 08 01:12:58 2006 +0000
+++ b/src/protocols/qq/buddy_opt.c	Tue Aug 08 23:20:08 2006 +0000
@@ -64,7 +64,8 @@
 	g_return_if_fail(gc != NULL && uid > 0);
 
 	uid_str = g_strdup_printf("%d", uid);
-	qq_send_cmd(gc, QQ_CMD_DEL_FRIEND, TRUE, 0, TRUE, uid_str, strlen(uid_str));
+	qq_send_cmd(gc, QQ_CMD_DEL_FRIEND, TRUE, 0, 
+			TRUE, (guint8 *) uid_str, strlen(uid_str));
 
 	g_free(uid_str);
 }
@@ -94,7 +95,8 @@
 
 	/* we need to send the ascii code of this uid to qq server */
 	uid_str = g_strdup_printf("%d", uid);
-	qq_send_cmd(gc, QQ_CMD_ADD_FRIEND_WO_AUTH, TRUE, 0, TRUE, uid_str, strlen(uid_str));
+	qq_send_cmd(gc, QQ_CMD_ADD_FRIEND_WO_AUTH, TRUE, 0, 
+			TRUE, (guint8 *) uid_str, strlen(uid_str));
 	g_free(uid_str);
 
 	/* must be set after sending packet to get the correct send_seq */
@@ -118,14 +120,14 @@
 	raw_data = g_newa(guint8, QQ_MSG_IM_MAX);
 	cursor = raw_data;
 
-	create_packet_data(raw_data, &cursor, uid_str, strlen(uid_str));
+	create_packet_data(raw_data, &cursor, (guint8 *) uid_str, strlen(uid_str));
 	create_packet_b(raw_data, &cursor, bar);
 	create_packet_b(raw_data, &cursor, response);
 
 	if (text != NULL) {
 		text_qq = utf8_to_qq(text, QQ_CHARSET_DEFAULT);
 		create_packet_b(raw_data, &cursor, bar);
-		create_packet_data(raw_data, &cursor, text_qq, strlen(text_qq));
+		create_packet_data(raw_data, &cursor, (guint8 *) text_qq, strlen(text_qq));
 		g_free(text_qq);
 	}
 
@@ -342,7 +344,8 @@
 {
 	qq_data *qd;
 	gint len, for_uid;
-	gchar *msg, *data, **segments, *uid, *reply;
+	gchar *msg, **segments, *uid, *reply;
+	guint8 *data;
 	GList *list;
 	GaimBuddy *b;
 	gc_and_uid *g;
--- a/src/protocols/qq/char_conv.c	Tue Aug 08 01:12:58 2006 +0000
+++ b/src/protocols/qq/char_conv.c	Tue Aug 08 23:20:08 2006 +0000
@@ -114,7 +114,8 @@
 	else {			/* conversion error */
 		gaim_debug(GAIM_DEBUG_ERROR, "QQ", "%s\n", error->message);
 		gaim_debug(GAIM_DEBUG_WARNING, "QQ",
-			   "Dump failed text\n%s", hex_dump_to_str(str, (len == -1) ? strlen(str) : len));
+			   "Dump failed text\n%s", 
+			   hex_dump_to_str((guint8 *) str, (len == -1) ? strlen(str) : len));
 		g_error_free(error);
 		return g_strdup(QQ_NULL_MSG);
 	}
@@ -130,7 +131,7 @@
 	g_return_val_if_fail(data != NULL && from_charset != NULL, -1);
 
 	len = data[0];
-	*ret = _my_convert(data + 1, (gssize) len, UTF8, from_charset);
+	*ret = _my_convert((gchar *) (data + 1), (gssize) len, UTF8, from_charset);
 
 	return len + 1;
 }
@@ -154,7 +155,7 @@
 	read_packet_b(data, &cursor, len, &bar);	/* skip, not sure of its use */
 	read_packet_w(data, &cursor, len, &charset_code);
 
-	font_name = g_strndup(cursor, data + len - cursor);
+	font_name = g_strndup((gchar *) cursor, data + len - cursor);
 
 	font_size = _get_size(font_attr);
 	is_bold = _check_bold(font_attr);
@@ -223,7 +224,7 @@
 	GString *converted;
 
 	converted = g_string_new("");
-	segments = split_data(text, strlen(text), "\x14", 0);
+	segments = split_data((guint8 *) text, strlen(text), "\x14", 0);
 	g_string_append(converted, segments[0]);
 
 	while ((*(++segments)) != NULL) {
--- a/src/protocols/qq/file_trans.c	Tue Aug 08 01:12:58 2006 +0000
+++ b/src/protocols/qq/file_trans.c	Tue Aug 08 23:20:08 2006 +0000
@@ -85,7 +85,7 @@
 
 	cipher = gaim_ciphers_find_cipher("md5");
 	context = gaim_cipher_context_new(cipher, NULL);
-	gaim_cipher_context_append(context, filename, strlen(filename));
+	gaim_cipher_context_append(context, (guint8 *) filename, strlen(filename));
 	gaim_cipher_context_digest(context, 16, md5, NULL);
 	gaim_cipher_context_destroy(context);
 }
@@ -93,7 +93,7 @@
 static void _fill_file_md5(const gchar *filename, gint filelen, gchar *md5)
 {
 	FILE *fp;
-	gchar *buffer;
+	guint8 *buffer;
 	GaimCipher *cipher;
 	GaimCipherContext *context;
 
@@ -106,7 +106,7 @@
 	fp = fopen(filename, "rb");
 	g_return_if_fail(fp != NULL);
 
-	buffer = g_newa(gchar, filelen);
+	buffer = g_newa(guint8, filelen);
 	g_return_if_fail(buffer != NULL);
 	fread(buffer, filelen, 1, fp);
 
@@ -398,10 +398,11 @@
 	gchar file_md5[16], filename_md5[16], *filename;
 	gint filename_len, filesize;
 	qq_data *qd;
+	ft_info *info;
 
 	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
 	qd = (qq_data *) gc->proto_data;
-	ft_info *info = (ft_info *) qd->xfer->data;
+	info = (ft_info *) qd->xfer->data;
 
 	filename = (gchar *) gaim_xfer_get_filename(qd->xfer);
 	filesize = gaim_xfer_get_size(qd->xfer);
@@ -664,10 +665,12 @@
 
 static void _qq_update_send_progess(GaimConnection *gc, guint32 fragment_index)
 {
+	guint32 mask;
+	guint8 *buffer;
+	gint readbytes;
 	qq_data *qd = (qq_data *) gc->proto_data;
 	GaimXfer *xfer = qd->xfer;
 	ft_info *info = (ft_info *) xfer->data;
-	guint32 mask;
 
 	gaim_debug(GAIM_DEBUG_INFO, "QQ", 
 			"receiving %dth fragment ack, slide window status %o, max_fragment_index %d\n", 
@@ -698,8 +701,6 @@
 		{
 			/* move the slide window */
 			info->window &= ~mask;
-			guint8 *buffer;
-			gint readbytes;
 
 			buffer = g_newa(guint8, info->fragment_len);
 			readbytes = _qq_xfer_read_file(buffer, info->max_fragment_index + sizeof(info->window), 
--- a/src/protocols/qq/group_info.c	Tue Aug 08 01:12:58 2006 +0000
+++ b/src/protocols/qq/group_info.c	Tue Aug 08 23:20:08 2006 +0000
@@ -157,7 +157,9 @@
 void qq_process_group_cmd_get_group_info(guint8 *data, guint8 **cursor, gint len, GaimConnection *gc)
 {
 	qq_group *group;
+	qq_buddy *member;
 	qq_data *qd;
+	GaimConversation *gaim_conv;
 	guint8 orgnization, role;
 	guint16 unknown;
 	guint32 member_uid, internal_group_id;
@@ -206,7 +208,7 @@
 		if(orgnization != 0 || role != 0) {
 			gaim_debug(GAIM_DEBUG_INFO, "QQ", "group member %d: orgnizatio=%d, role=%d\n", member_uid, orgnization, role);
 		}
-		qq_buddy *member = qq_group_find_or_add_member(gc, group, member_uid);
+		member = qq_group_find_or_add_member(gc, group, member_uid);
 		member->role = role;
 	}
         if(*cursor > (data + len)) {
@@ -220,7 +222,8 @@
 
 	qq_group_refresh(gc, group);
 
-	GaimConversation *gaim_conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,group->group_name_utf8, gaim_connection_get_account(gc));
+	gaim_conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, 
+			group->group_name_utf8, gaim_connection_get_account(gc));
 	if(NULL == gaim_conv) {
                 gaim_debug(GAIM_DEBUG_WARNING, "QQ",
                            "Conv windows for \"%s\" is not on, do not set topic\n", group->group_name_utf8);
--- a/src/protocols/qq/group_network.c	Tue Aug 08 01:12:58 2006 +0000
+++ b/src/protocols/qq/group_network.c	Tue Aug 08 23:20:08 2006 +0000
@@ -81,7 +81,7 @@
 	gchar *msg, *msg_utf8;
 	g_return_if_fail(cursor != NULL && len > 0 && gc != NULL);
 
-	msg = g_strndup(cursor, len);	/* it will append 0x00 */
+	msg = g_strndup((gchar *) cursor, len);	/* it will append 0x00 */
 	msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT);
 	g_free(msg);
 	msg = g_strdup_printf(_("Code [0x%02X]: %s"), reply, msg_utf8);
--- a/src/protocols/qq/keep_alive.c	Tue Aug 08 01:12:58 2006 +0000
+++ b/src/protocols/qq/keep_alive.c	Tue Aug 08 23:20:08 2006 +0000
@@ -61,10 +61,11 @@
 }
 
 /* parse the return of keep-alive packet, it includes some system information */
-void qq_process_keep_alive_reply(guint8 * buf, gint buf_len, GaimConnection *gc) {
+void qq_process_keep_alive_reply(guint8 *buf, gint buf_len, GaimConnection *gc) {
 	qq_data *qd;
 	gint len;
-	gchar *data, **segments;	/* the returns are gchar, no need guint8 */
+	gchar **segments;
+	guint8 *data;
 
 	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
 	g_return_if_fail(buf != NULL && buf_len != 0);
@@ -125,6 +126,8 @@
 {
 	gchar *name;
 	GaimBuddy *bud;
+	gchar *status_id;
+	
 	g_return_if_fail(gc != NULL && q_bud != NULL);
 
 	name = uid_to_gaim_name(q_bud->uid);
@@ -138,7 +141,7 @@
 		/* gaim supports signon and idle time
 		 * but it is not much use for QQ, I do not use them */
 		/* serv_got_update(gc, name, online, 0, q_bud->signon, q_bud->idle, bud->uc); */
-		char *status_id = "available";
+		status_id = "available";
 		switch(q_bud->status) {
 		case QQ_BUDDY_OFFLINE:
 			status_id = "offline";
--- a/src/protocols/qq/recv_core.c	Tue Aug 08 01:12:58 2006 +0000
+++ b/src/protocols/qq/recv_core.c	Tue Aug 08 23:20:08 2006 +0000
@@ -61,7 +61,7 @@
 static gboolean _qq_check_packet_set_window(guint16 seq, GaimConnection *gc)
 {
 	qq_data *qd;
-	gchar *byte, mask;
+	guint8 *byte, mask;
 
 	g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE);
 	qd = (qq_data *) gc->proto_data;
@@ -291,7 +291,7 @@
 void qq_input_pending(gpointer data, gint source, GaimInputCondition cond)
 {
 	GaimConnection *gc;
-	qq_data *qd;;
+	qq_data *qd;
 	guint8 *buf;
 	gint len;
 
--- a/src/protocols/qq/send_file.c	Tue Aug 08 01:12:58 2006 +0000
+++ b/src/protocols/qq/send_file.c	Tue Aug 08 23:20:08 2006 +0000
@@ -77,12 +77,12 @@
 }
 
 /* these 2 functions send and recv buffer from/to UDP channel */
-static ssize_t _qq_xfer_udp_recv(char *buf, size_t len, GaimXfer *xfer)
+static ssize_t _qq_xfer_udp_recv(guint8 *buf, size_t len, GaimXfer *xfer)
 {
 	struct sockaddr_in sin;
-	int sinlen;
+	socklen_t sinlen;
 	ft_info *info;
-	int r;
+	gint r;
 
 	info = (ft_info *) xfer->data;
 	sinlen = sizeof(sin);
@@ -102,7 +102,7 @@
 	return send(info->sender_fd, buf, len, 0);
 }
 */
-static ssize_t _qq_xfer_udp_send(const char *buf, size_t len, GaimXfer *xfer)
+static ssize_t _qq_xfer_udp_send(const guint8 *buf, size_t len, GaimXfer *xfer)
 {
 	struct sockaddr_in sin;
 	ft_info *info;
@@ -140,7 +140,7 @@
 }
 */
 
-gssize _qq_xfer_write(const guchar *buf, size_t len, GaimXfer *xfer)
+gssize _qq_xfer_write(const guint8 *buf, size_t len, GaimXfer *xfer)
 {
 	return _qq_xfer_udp_send(buf, len, xfer);
 }
@@ -219,7 +219,7 @@
 	g_free(info);
 }
 
-void qq_show_conn_info(ft_info *info)
+static void qq_show_conn_info(ft_info *info)
 {
 	gchar *internet_ip_str, *real_ip_str;
 	guint32 ip;
@@ -375,7 +375,8 @@
 
 static void _qq_xfer_init_socket(GaimXfer *xfer)
 {
-	int sockfd, listen_port = 0, i, sin_len;
+	gint sockfd, listen_port = 0, i; 
+	socklen_t sin_len;
 	struct sockaddr_in sin;
 	ft_info *info;
 
@@ -446,27 +447,28 @@
 	info->conn_method = 0x00;
 	qd->xfer->data = info;
 
-	filename_len = strlen (filename);
-	filelen_str = g_strdup_printf ("%d ×Ö½Ú", filesize);
-	filelen_strlen = strlen (filelen_str);
+	filename_len = strlen(filename);
+	filelen_str = g_strdup_printf("%d ×Ö½Ú", filesize);
+	filelen_strlen = strlen(filelen_str);
 
 	packet_len = 82 + filename_len + filelen_strlen;
-	raw_data = g_newa (guint8, packet_len);
+	raw_data = g_newa(guint8, packet_len);
 	cursor = raw_data;
 
-	bytes = _qq_create_packet_file_header(raw_data, &cursor, to_uid, QQ_FILE_TRANS_REQ, qd, FALSE);
+	bytes = _qq_create_packet_file_header(raw_data, &cursor, to_uid, 
+			QQ_FILE_TRANS_REQ, qd, FALSE);
 	bytes += qq_fill_conn_info(raw_data, &cursor, info);
 	/* 079: 0x20 */
 	bytes += create_packet_b (raw_data, &cursor, 0x20);
 	/* 080: 0x1f */
 	bytes += create_packet_b (raw_data, &cursor, 0x1f);
 	/* undetermined len: filename */
-	bytes += create_packet_data (raw_data, &cursor, filename,
+	bytes += create_packet_data (raw_data, &cursor, (guint8 *) filename,
 				     filename_len);
 	/* 0x1f */
 	bytes += create_packet_b (raw_data, &cursor, 0x1f);
 	/* file length */
-	bytes += create_packet_data (raw_data, &cursor, filelen_str,
+	bytes += create_packet_data (raw_data, &cursor, (guint8 *) filelen_str,
 				     filelen_strlen);
 
 	if (packet_len == bytes)
@@ -485,6 +487,8 @@
 {
 	qq_data *qd;
 	guint8 *cursor, *raw_data;
+	guint16 minor_port;
+	guint32 real_ip;
 	gint packet_len, bytes;
 	ft_info *info;
 
@@ -494,8 +498,6 @@
 
 	gaim_debug(GAIM_DEBUG_INFO, "QQ", "I've accepted the file transfer request from %d\n", to_uid);
 	_qq_xfer_init_socket(qd->xfer);
-	guint16 minor_port;
-	guint32 real_ip;
 
 	packet_len = 79;
 	raw_data = g_newa (guint8, packet_len);
@@ -779,7 +781,7 @@
 {
 	qq_data *qd;
 	GaimXfer *xfer;
-	gchar *sender_name;
+	gchar *sender_name, **fileinfo;
 	ft_info *info;
 	GaimBuddy *b;
 	qq_buddy *q_bud;
@@ -803,8 +805,7 @@
 	*cursor = data + 18 + 12;
 	qq_get_conn_info(data, cursor, data_len, info);
 
-	gchar **fileinfo;
-	fileinfo = g_strsplit(data + 81 + 12, "\x1f", 2);
+	fileinfo = g_strsplit((gchar *) (data + 81 + 12), "\x1f", 2);
 	g_return_if_fail (fileinfo != NULL && fileinfo[0] != NULL && fileinfo[1] != NULL);
 
 	sender_name = uid_to_gaim_name(sender_uid);
--- a/src/protocols/qq/sendqueue.h	Tue Aug 08 01:12:58 2006 +0000
+++ b/src/protocols/qq/sendqueue.h	Tue Aug 08 23:20:08 2006 +0000
@@ -33,7 +33,7 @@
 struct _qq_sendpacket {
 	gint fd;
 	gint len;
-	gchar *buf;
+	guint8 *buf;
 	guint16 cmd;
 	guint16 send_seq;
 	gint resend_times;
--- a/src/protocols/qq/sys_msg.c	Tue Aug 08 01:12:58 2006 +0000
+++ b/src/protocols/qq/sys_msg.c	Tue Aug 08 23:20:08 2006 +0000
@@ -119,7 +119,7 @@
 
 	bytes += create_packet_b(ack, &cursor, code);
 	bytes += create_packet_b(ack, &cursor, bar);
-	bytes += create_packet_data(ack, &cursor, str, strlen(str));
+	bytes += create_packet_data(ack, &cursor, (guint8 *) str, strlen(str));
 	bytes += create_packet_b(ack, &cursor, bar);
 	bytes += create_packet_w(ack, &cursor, seq);
 
@@ -263,7 +263,7 @@
 
 	qd = (qq_data *) gc->proto_data;
 	len = buf_len;
-	data = g_newa(gchar, len);
+	data = g_newa(guint8, len);
 
 	if (qq_crypt(DECRYPT, buf, buf_len, qd->session_key, data, &len)) {
 		if (NULL == (segments = split_data(data, len, "\x1f", 4)))