diff src/protocols/oscar/oscar.c @ 11159:bd8ac1d4b2f2

[gaim-migrate @ 13246] Get rid of a bunch of gcc4 compile warnings in oscar. Here's what I'm doing: -For random bits of binary data, use guchar * -For textual data (not necessarily utf8), use gchar * This seems to be what glib and gtk do committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 26 Jul 2005 04:34:37 +0000
parents 92453bf9b86b
children ccb38cf22483
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Mon Jul 25 23:46:34 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Tue Jul 26 04:34:37 2005 +0000
@@ -297,7 +297,7 @@
 
 static gboolean gaim_icon_timerfunc(gpointer data);
 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition);
-static void oscar_direct_im_initiate(GaimConnection *gc, const char *who, const char *cookie);
+static void oscar_direct_im_initiate(GaimConnection *gc, const char *who, const guchar *cookie);
 static void oscar_set_info(GaimConnection *gc, const char *text);
 static void recent_buddies_cb(const char *name, GaimPrefType type, gpointer value, gpointer data);
 static void oscar_xfer_init_recv(GaimXfer *xfer);
@@ -415,7 +415,7 @@
 }
 
 static gchar *
-gaim_plugin_oscar_convert_to_utf8(const fu8_t *data, fu16_t datalen, const char *charsetstr, gboolean fallback)
+gaim_plugin_oscar_convert_to_utf8(const gchar *data, gsize datalen, const char *charsetstr, gboolean fallback)
 {
 	gchar *ret = NULL;
 	GError *err = NULL;
@@ -454,7 +454,7 @@
  * charsetstr1 is always set to what the correct encoding should be.
  */
 static gchar *
-gaim_plugin_oscar_decode_im_part(GaimAccount *account, const char *sourcesn, fu16_t charset, fu16_t charsubset, fu8_t *data, fu16_t datalen)
+gaim_plugin_oscar_decode_im_part(GaimAccount *account, const char *sourcesn, fu16_t charset, fu16_t charsubset, const gchar *data, gsize datalen)
 {
 	gchar *ret = NULL;
 	const gchar *charsetstr1, *charsetstr2;
@@ -1009,9 +1009,9 @@
 			oscar_direct_im_disconnect(od, dim);
 			return;
 		} else {
-			fu8_t cookie[8];
+			guchar cookie[8];
 			char *who = g_strdup(dim->name);
-			const char *tmp = aim_odc_getcookie(dim->conn);
+			const guchar *tmp = aim_odc_getcookie(dim->conn);
 
 			memcpy(cookie, tmp, 8);
 			oscar_direct_im_destroy(od, dim);
@@ -1038,9 +1038,9 @@
 			oscar_direct_im_disconnect(od, dim);
 			return;
 		} else {
-			fu8_t cookie[8];
+			guchar cookie[8];
 			char *who = g_strdup(dim->name);
-			const char *tmp = aim_odc_getcookie(dim->conn);
+			const guchar *tmp = aim_odc_getcookie(dim->conn);
 
 			memcpy(cookie, tmp, 8);
 			oscar_direct_im_destroy(od, dim);
@@ -1498,7 +1498,7 @@
  *
  * note that cookie is an 8 byte string that isn't NULL terminated
  */
-static void oscar_direct_im_initiate(GaimConnection *gc, const char *who, const char *cookie) {
+static void oscar_direct_im_initiate(GaimConnection *gc, const char *who, const guchar *cookie) {
 	OscarData *od;
 	struct oscar_direct_im *dim;
 	int listenfd;
@@ -2141,7 +2141,7 @@
 	od->file_transfers = g_slist_remove(od->file_transfers, xfer);
 }
 
-static void oscar_xfer_ack_recv(GaimXfer *xfer, const char *buffer, size_t size)
+static void oscar_xfer_ack_recv(GaimXfer *xfer, const guchar *buffer, size_t size)
 {
 	struct aim_oft_info *oft_info = xfer->data;
 
@@ -2211,7 +2211,7 @@
 	od->file_transfers = g_slist_remove(od->file_transfers, xfer);
 }
 
-static void oscar_xfer_ack_send(GaimXfer *xfer, const char *buffer, size_t size)
+static void oscar_xfer_ack_send(GaimXfer *xfer, const guchar *buffer, size_t size)
 {
 	struct aim_oft_info *oft_info = xfer->data;
 
@@ -3188,7 +3188,7 @@
 }
 
 static void gaim_check_comment(OscarData *od, const char *str) {
-	if ((str == NULL) || strcmp(str, ck))
+	if ((str == NULL) || strcmp(str, (const char *)ck))
 		aim_locate_setcaps(od->sess, caps_aim);
 	else
 		aim_locate_setcaps(od->sess, caps_aim | AIM_CAPS_SECUREIM);
@@ -3443,7 +3443,7 @@
 		struct stat st;
 
 		if (!g_stat(iconfile, &st)) {
-			char *buf = g_malloc(st.st_size);
+			guchar *buf = g_malloc(st.st_size);
 			file = g_fopen(iconfile, "rb");
 			if (file) {
 				/* XXX - Use g_file_get_contents() */
@@ -3467,8 +3467,8 @@
 	message = g_string_new("");
 	curpart = args->mpmsg.parts;
 	while (curpart != NULL) {
-		tmp = gaim_plugin_oscar_decode_im_part(account, userinfo->sn, curpart->charset, curpart->charsubset,
-											curpart->data, curpart->datalen);
+		tmp = gaim_plugin_oscar_decode_im_part(account, userinfo->sn, curpart->charset,
+				curpart->charsubset, curpart->data, curpart->datalen);
 		if (tmp != NULL) {
 			g_string_append(message, tmp);
 			g_free(tmp);
@@ -4162,7 +4162,7 @@
 	return 1;
 }
 
-static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) {
+static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const guchar *cookie) {
 	GaimConnection *gc = sess->aux_data;
 	OscarData *od = gc->proto_data;
 
@@ -4237,7 +4237,7 @@
 	reason = (fu16_t)va_arg(ap, unsigned int);
 
 	if (chan == 0x0002) { /* File transfer declined */
-		char *cookie = va_arg(ap, char *);
+		guchar *cookie = va_arg(ap, guchar *);
 		return gaim_parse_clientauto_ch2(sess, who, reason, cookie);
 	} else if (chan == 0x0004) { /* ICQ message */
 		fu32_t state = 0;
@@ -4799,7 +4799,7 @@
 		if (iconfile == NULL) {
 			aim_ssi_delicon(od->sess);
 		} else if (!g_stat(iconfile, &st)) {
-			char *buf = g_malloc(st.st_size);
+			guchar *buf = g_malloc(st.st_size);
 			FILE *file = g_fopen(iconfile, "rb");
 			if (file) {
 				/* XXX - Use g_file_get_contents()? */
@@ -5645,7 +5645,7 @@
 		if (iconfile && !g_stat(iconfile, &st)) {
 			FILE *file = g_fopen(iconfile, "rb");
 			if (file) {
-				char *buf = g_malloc(st.st_size);
+				guchar *buf = g_malloc(st.st_size);
 				/* XXX - Use g_file_get_contents()? */
 				fread(buf, 1, st.st_size, file);
 				fclose(file);
@@ -6872,7 +6872,7 @@
 	va_list ap;
 	fu16_t type;
 	fu8_t flags = 0, length = 0;
-	char *md5 = NULL;
+	guchar *md5 = NULL;
 
 
 	va_start(ap, fr);
@@ -6883,7 +6883,7 @@
 		case 0x0001: {
 			flags = va_arg(ap, int);
 			length = va_arg(ap, int);
-			md5 = va_arg(ap, char *);
+			md5 = va_arg(ap, guchar *);
 
 			if (flags == 0x41) {
 				if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) {
@@ -6896,7 +6896,7 @@
 					if (iconfile == NULL) {
 						aim_ssi_delicon(od->sess);
 					} else if (!g_stat(iconfile, &st)) {
-						char *buf = g_malloc(st.st_size);
+						guchar *buf = g_malloc(st.st_size);
 						FILE *file = g_fopen(iconfile, "rb");
 						if (file) {
 							/* XXX - Use g_file_get_contents()? */
@@ -7427,11 +7427,11 @@
 	if (iconfile == NULL) {
 		aim_ssi_delicon(od->sess);
 	} else if (!g_stat(iconfile, &st)) {
-		char *buf = g_malloc(st.st_size);
+		guchar *buf = g_malloc(st.st_size);
 		file = g_fopen(iconfile, "rb");
 		if (file) {
 			md5_state_t *state;
-			char md5[16];
+			guchar md5[16];
 			/* XXX - Use g_file_get_contents()? */
 			int len = fread(buf, 1, st.st_size, file);
 			fclose(file);