changeset 11137:096020ae09a9

[gaim-migrate @ 13201] Some more deworming. I mean, dewarning. I also realized that lots of glib uses guchar* instead of guint* for passing around bits of binary data, so I changed some stuff in util.c that I'd already changed. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 21 Jul 2005 05:49:48 +0000
parents 6270b6ad69a2
children 834a40ddab95
files src/buddyicon.c src/buddyicon.h src/conversation.c src/conversation.h src/gtkaccount.c src/gtkblist.c src/gtkconv.c src/gtkpounce.c src/gtkprefs.c src/internal.h src/mime.c src/protocols/jabber/auth.c src/protocols/jabber/buddy.c src/protocols/jabber/presence.c src/protocols/msn/httpconn.c src/protocols/msn/slp.c src/protocols/msn/slpcall.h src/protocols/rendezvous/rendezvous.c src/protocols/trepia/trepia.c src/protocols/yahoo/yahoo.c src/util.c src/util.h
diffstat 22 files changed, 69 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddyicon.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/buddyicon.c	Thu Jul 21 05:49:48 2005 +0000
@@ -218,7 +218,7 @@
 void
 gaim_buddy_icon_cache(GaimBuddyIcon *icon, GaimBuddy *buddy)
 {
-	const void *data;
+	const guchar *data;
 	const char *dirname;
 	char *random;
 	char *filename;
@@ -357,7 +357,7 @@
 	return icon->username;
 }
 
-const void *
+const guchar *
 gaim_buddy_icon_get_data(const GaimBuddyIcon *icon, size_t *len)
 {
 	g_return_val_if_fail(icon != NULL, NULL);
--- a/src/buddyicon.h	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/buddyicon.h	Thu Jul 21 05:49:48 2005 +0000
@@ -163,7 +163,7 @@
  *
  * @return The icon data.
  */
-const void *gaim_buddy_icon_get_data(const GaimBuddyIcon *icon, size_t *len);
+const guchar *gaim_buddy_icon_get_data(const GaimBuddyIcon *icon, size_t *len);
 
 /**
  * Returns an extension corresponding to the buddy icon's file type.
--- a/src/conversation.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/conversation.c	Thu Jul 21 05:49:48 2005 +0000
@@ -1674,7 +1674,7 @@
 
 void
 gaim_conv_custom_smiley_write(GaimConversation *conv, const char *smile,
-                                   const char * data, gint64 size)
+                                   const guchar *data, gsize size)
 {
 	g_return_if_fail(conv != NULL);
 	g_return_if_fail(smile != NULL && *smile);
--- a/src/conversation.h	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/conversation.h	Thu Jul 21 05:49:48 2005 +0000
@@ -203,7 +203,7 @@
 	/* Custom Smileys */
 	gboolean (*custom_smiley_add)(GaimConversation *conv, const char *smile);
 	void (*custom_smiley_write)(GaimConversation *conv, const char *smile,
-	                            const char * data, gint64 size);
+	                            const guchar *data, gsize size);
 	void (*custom_smiley_close)(GaimConversation *conv, const char *smile);
 
 
@@ -1017,8 +1017,9 @@
  */
 
 void gaim_conv_custom_smiley_write(GaimConversation *conv,
-                                   const char *smile, const char * data,
-                                   gint64 size);
+                                   const char *smile,
+                                   const guchar *data,
+                                   gsize size);
 
 /**
  * Close the custom smiley, all data has been written with
--- a/src/gtkaccount.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/gtkaccount.c	Thu Jul 21 05:49:48 2005 +0000
@@ -465,7 +465,7 @@
 account_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
 		 GtkSelectionData *sd, guint info, guint t, AccountPrefsDialog *dialog)
 {
-	gchar *name = sd->data;
+	gchar *name = (gchar *)sd->data;
 
 	if ((sd->length >= 0) && (sd->format == 8)) {
 		/* Well, it looks like the drag event was cool.
--- a/src/gtkblist.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/gtkblist.c	Thu Jul 21 05:49:48 2005 +0000
@@ -1913,7 +1913,7 @@
 		gtk_selection_data_set(data,
 					gdk_atom_intern("application/x-im-contact", FALSE),
 					8, /* bits */
-					mime_str,
+					(const guchar *)mime_str,
 					strlen(mime_str) + 1);
 
 		g_free(mime_str);
@@ -2111,7 +2111,7 @@
 			}
 		}
 
-		if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account,
+		if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account,
 										&protocol, &username, &alias))
 		{
 			if (account == NULL)
@@ -2172,7 +2172,7 @@
 			}
 		}
 
-		result = parse_vcard(sd->data, group);
+		result = parse_vcard((const gchar *)sd->data, group);
 
 		gtk_drag_finish(dc, result, (dc->action == GDK_ACTION_MOVE), t);
 	} else if (sd->target == gdk_atom_intern("text/uri-list", FALSE) && sd->data) {
@@ -2209,8 +2209,8 @@
 	GdkPixbuf *buf, *ret = NULL;
 	GdkPixbufLoader *loader;
 	GaimBuddyIcon *icon;
-	const char *data;
-	size_t len;
+	const guchar *data;
+	gsize len;
 	GaimBuddy *buddy = (GaimBuddy *)node;
 
 	if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
--- a/src/gtkconv.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/gtkconv.c	Thu Jul 21 05:49:48 2005 +0000
@@ -703,7 +703,7 @@
 		char *username = NULL;
 		GaimAccount *account;
 
-		if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account,
+		if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account,
 										&protocol, &username, NULL))
 		{
 			if (account == NULL)
@@ -4156,7 +4156,7 @@
 		char *username = NULL;
 		GaimAccount *account;
 
-		if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account,
+		if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account,
 						&protocol, &username, NULL))
 		{
 			if (account == NULL)
@@ -5365,7 +5365,7 @@
 
 static void
 gaim_gtkconv_custom_smiley_write(GaimConversation *conv, const char *smile,
-                                      const char * data, gint64 size)
+                                      const guchar *data, gsize size)
 {
 	GaimGtkConversation *gtkconv;
 	GtkIMHtmlSmiley *smiley;
--- a/src/gtkpounce.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/gtkpounce.c	Thu Jul 21 05:49:48 2005 +0000
@@ -305,7 +305,7 @@
 		char *username = NULL;
 		GaimAccount *account;
 
-		if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account,
+		if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account,
 										&protocol, &username, NULL))
 		{
 			if (account == NULL)
--- a/src/gtkprefs.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/gtkprefs.c	Thu Jul 21 05:49:48 2005 +0000
@@ -585,18 +585,18 @@
 	g_free(path);
 }
 
-static void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, 
+static void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd,
 				guint info, guint t, gpointer data) {
-	gchar *name = sd->data;
+	gchar *name = (gchar *)sd->data;
 
 	if ((sd->length >= 0) && (sd->format == 8)) {
-		/* Well, it looks like the drag event was cool. 
+		/* Well, it looks like the drag event was cool.
 		 * Let's do something with it */
 
 		if (!g_ascii_strncasecmp(name, "file://", 7)) {
 			GError *converr = NULL;
 			gchar *tmp;
-			/* It looks like we're dealing with a local file. Let's 
+			/* It looks like we're dealing with a local file. Let's
 			 * just untar it in the right place */
 			if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
 				gaim_debug(GAIM_DEBUG_ERROR, "theme dnd", "%s\n",
--- a/src/internal.h	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/internal.h	Thu Jul 21 05:49:48 2005 +0000
@@ -7,7 +7,7 @@
  * Gaim is the legal property of its developers, whose names are too numerous
  * to list here.  Please refer to the COPYRIGHT file distributed with this
  * source distribution.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
--- a/src/mime.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/mime.c	Thu Jul 21 05:49:48 2005 +0000
@@ -304,7 +304,7 @@
 
 
 void gaim_mime_part_get_data_decoded(GaimMimePart *part,
-				     guint8 **data, gsize *len) {
+				     guchar **data, gsize *len) {
   const char *enc;
 
   g_return_if_fail(part != NULL);
@@ -316,15 +316,15 @@
   enc = gaim_mime_part_get_field(part, "content-transfer-encoding");
 
   if(! enc) {
-    *data = (guint8 *)g_strdup(part->data->str);
+    *data = (guchar *)g_strdup(part->data->str);
     *len = part->data->len;
 
   } else if(! g_ascii_strcasecmp(enc, "7bit")) {
-    *data = (guint8 *)g_strdup(part->data->str);
+    *data = (guchar *)g_strdup(part->data->str);
     *len = part->data->len;
 
   } else if(! g_ascii_strcasecmp(enc, "8bit")) {
-    *data = (guint8 *)g_strdup(part->data->str);
+    *data = (guchar *)g_strdup(part->data->str);
     *len = part->data->len;
 
   } else if(! g_ascii_strcasecmp(enc, "base16")) {
--- a/src/protocols/jabber/auth.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/protocols/jabber/auth.c	Thu Jul 21 05:49:48 2005 +0000
@@ -76,7 +76,7 @@
 		response = g_string_append(response,
 				gaim_connection_get_password(js->gc));
 
-		enc_out = gaim_base64_encode((guint8 *)response->str, response->len);
+		enc_out = gaim_base64_encode((guchar *)response->str, response->len);
 
 		xmlnode_set_attrib(auth, "mechanism", "PLAIN");
 		xmlnode_insert_data(auth, enc_out, -1);
@@ -304,7 +304,7 @@
 {
 	GaimCipher *cipher;
 	GaimCipherContext *context;
-	guint8 result[16];
+	guchar result[16];
 	size_t a1len;
 
 	unsigned char *x, *a1, *kd, *convnode, *convpasswd;
@@ -445,7 +445,7 @@
 			g_free(auth_resp);
 			g_free(cnonce);
 
-			enc_out = gaim_base64_encode((guint8 *)response->str, response->len);
+			enc_out = gaim_base64_encode((guchar *)response->str, response->len);
 
 			gaim_debug(GAIM_DEBUG_MISC, "jabber", "decoded response (%d): %s\n", response->len, response->str);
 
--- a/src/protocols/jabber/buddy.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/protocols/jabber/buddy.c	Thu Jul 21 05:49:48 2005 +0000
@@ -810,7 +810,7 @@
 				if((binval = xmlnode_get_child(child, "BINVAL")) &&
 						(bintext = xmlnode_get_data(binval))) {
 					gsize size;
-					guint8 *data;
+					guchar *data;
 					int i;
 					unsigned char hashval[20];
 					char *p, hash[41];
--- a/src/protocols/jabber/presence.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/protocols/jabber/presence.c	Thu Jul 21 05:49:48 2005 +0000
@@ -207,7 +207,7 @@
 	GaimBuddy *b = NULL;
 	xmlnode *vcard, *photo, *binval;
 	char *text;
-	guint8 *data;
+	guchar *data;
 	gsize size;
 	const char *from = xmlnode_get_attrib(packet, "from");
 
--- a/src/protocols/msn/httpconn.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/protocols/msn/httpconn.c	Thu Jul 21 05:49:48 2005 +0000
@@ -105,7 +105,7 @@
 	if (username != NULL) {
 		char *tmp;
 		auth = g_strdup_printf("%s:%s", username, password ? password : "");
-		tmp = gaim_base64_encode(auth, strlen(auth));
+		tmp = gaim_base64_encode((const guchar *)auth, strlen(auth));
 		g_free(auth);
 		auth = g_strdup_printf("Proxy-Authorization: Basic %s\r\n", tmp);
 		g_free(tmp);
--- a/src/protocols/msn/slp.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/protocols/msn/slp.c	Thu Jul 21 05:49:48 2005 +0000
@@ -152,8 +152,8 @@
 }
 
 void
-msn_xfer_completed_cb(MsnSlpCall *slpcall, const char *body,
-					  long long size)
+msn_xfer_completed_cb(MsnSlpCall *slpcall, guchar *body,
+					  gsize size)
 {
 	gaim_xfer_set_completed(slpcall->xfer, TRUE);
 }
@@ -755,9 +755,9 @@
 	msn_slplink_process_msg(slplink, msg);
 }
 
-void
+static void
 got_emoticon(MsnSlpCall *slpcall,
-			 const char *data, long long size)
+			 const guchar *data, gsize size)
 {
 
 	GaimConversation *conv;
@@ -945,7 +945,7 @@
 
 void
 got_user_display(MsnSlpCall *slpcall,
-				 const char *data, long long size)
+				 const guchar *data, gsize size)
 {
 	MsnUserList *userlist;
 	const char *info;
--- a/src/protocols/msn/slpcall.h	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/protocols/msn/slpcall.h	Thu Jul 21 05:49:48 2005 +0000
@@ -24,10 +24,12 @@
 #ifndef _MSN_SLPCALL_H_
 #define _MSN_SLPCALL_H_
 
+#include "internal.h"
+
 typedef struct _MsnSlpCall MsnSlpCall;
 
 typedef void (*MsnSlpCb)(MsnSlpCall *slpcall,
-						 const char *data, long long size);
+						 const guchar *data, gsize size);
 typedef void (*MsnSlpEndCb)(MsnSlpCall *slpcall);
 
 #include "slplink.h"
--- a/src/protocols/rendezvous/rendezvous.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/protocols/rendezvous/rendezvous.c	Thu Jul 21 05:49:48 2005 +0000
@@ -484,7 +484,7 @@
 {
 	guchar *icondata;
 	unsigned short iconlength;
-	unsigned char hash[20];
+	guchar hash[20];
 	gchar *base16;
 
 	g_return_if_fail(rd != NULL);
--- a/src/protocols/trepia/trepia.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/protocols/trepia/trepia.c	Thu Jul 21 05:49:48 2005 +0000
@@ -848,8 +848,8 @@
 
 				/* Buddy Icon */
 				if ((value = g_hash_table_lookup(info, "q")) != NULL) {
-					char *icon;
-					int icon_len;
+					guchar *icon;
+					gsize icon_len;
 
 					icon = gaim_base64_decode(value, &icon_len);
 
@@ -1160,7 +1160,7 @@
 		FILE *fp;
 
 		if ((fp = g_fopen(filename, "rb")) != NULL) {
-			char *buf = g_malloc(sb.st_size + 1);
+			guchar *buf = g_malloc(sb.st_size + 1);
 			char *temp;
 			char *out_buf;
 
--- a/src/protocols/yahoo/yahoo.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/protocols/yahoo/yahoo.c	Thu Jul 21 05:49:48 2005 +0000
@@ -307,7 +307,7 @@
 			break;
 		case 197: /* Avatars */
 		{
-			guint8 *decoded;
+			guchar *decoded;
 			char *tmp;
 			gsize len;
 
@@ -1080,7 +1080,7 @@
 
 	GaimCipher *cipher;
 	GaimCipherContext *context;
-	guint8 digest[16];
+	guchar digest[16];
 
 	char *crypt_result;
 	char password_hash[25];
@@ -1186,7 +1186,7 @@
 
 	GaimCipher			*md5_cipher;
 	GaimCipherContext	*md5_ctx;
-	guint8				md5_digest[16];
+	guchar				md5_digest[16];
 
 	GaimCipher			*sha1_cipher;
 	GaimCipherContext	*sha1_ctx1;
@@ -1861,7 +1861,7 @@
 	GSList *l = pkt->hash;
 	char *who = NULL;
 	char *base64 = NULL;
-	guint8 *decoded;
+	guchar *decoded;
 	gsize len;
 
 	while (l) {
--- a/src/util.c	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/util.c	Thu Jul 21 05:49:48 2005 +0000
@@ -68,7 +68,7 @@
  * Base16 Functions
  **************************************************************************/
 gchar *
-gaim_base16_encode(const guint8 *data, gsize len)
+gaim_base16_encode(const guchar *data, gsize len)
 {
 	int i;
 	gchar *ascii = NULL;
@@ -84,11 +84,11 @@
 	return ascii;
 }
 
-guint8 *
+guchar *
 gaim_base16_decode(const char *str, gsize *ret_len)
 {
 	int len, i, accumulator = 0;
-	guint8 *data;
+	guchar *data;
 
 	g_return_val_if_fail(str != NULL, NULL);
 
@@ -142,7 +142,7 @@
 	"0123456789abcdef";
 
 gchar *
-gaim_base64_encode(const guint8 *data, gsize len)
+gaim_base64_encode(const guchar *data, gsize len)
 {
 	char *out, *rv;
 
@@ -180,10 +180,10 @@
 	return rv;
 }
 
-guint8 *
+guchar *
 gaim_base64_decode(const char *str, gsize *ret_len)
 {
-	guint8 *out = NULL;
+	guchar *out = NULL;
 	char tmp = 0;
 	const char *c;
 	gint32 tmp2 = 0;
@@ -210,13 +210,13 @@
 		} else if (*c == '=') {
 			if (n == 3) {
 				out = g_realloc(out, len + 2);
-				out[len] = (guint8)(tmp2 >> 10) & 0xff;
+				out[len] = (guchar)(tmp2 >> 10) & 0xff;
 				len++;
-				out[len] = (guint8)(tmp2 >> 2) & 0xff;
+				out[len] = (guchar)(tmp2 >> 2) & 0xff;
 				len++;
 			} else if (n == 2) {
 				out = g_realloc(out, len + 1);
-				out[len] = (guint8)(tmp2 >> 4) & 0xff;
+				out[len] = (guchar)(tmp2 >> 4) & 0xff;
 				len++;
 			}
 			break;
@@ -225,11 +225,11 @@
 		n++;
 		if (n == 4) {
 			out = g_realloc(out, len + 3);
-			out[len] = (guint8)((tmp2 >> 16) & 0xff);
+			out[len] = (guchar)((tmp2 >> 16) & 0xff);
 			len++;
-			out[len] = (guint8)((tmp2 >> 8) & 0xff);
+			out[len] = (guchar)((tmp2 >> 8) & 0xff);
 			len++;
-			out[len] = (guint8)(tmp2 & 0xff);
+			out[len] = (guchar)(tmp2 & 0xff);
 			len++;
 			tmp2 = 0;
 			n = 0;
@@ -249,7 +249,7 @@
 /**************************************************************************
  * Quoted Printable Functions (see RFC 2045).
  **************************************************************************/
-guint8 *
+guchar *
 gaim_quotedp_decode(const char *str, gsize *ret_len)
 {
 	char *n, *new;
@@ -293,7 +293,7 @@
 	/* Resize to take less space */
 	/* new = realloc(new, n - new); */
 
-	return (guint8 *)new;
+	return (guchar *)new;
 }
 
 /**************************************************************************
@@ -410,7 +410,7 @@
 				char *charset = g_strndup(charset0, encoding0 - charset0 - 1);
 				char *encoding = g_strndup(encoding0, encoded_text0 - encoding0 - 1);
 				char *encoded_text = g_strndup(encoded_text0, cur - encoded_text0 - 1);
-				guint8 *decoded = NULL;
+				guchar *decoded = NULL;
 				gsize dec_len;
 				if (g_ascii_strcasecmp(encoding, "Q") == 0)
 					decoded = gaim_quotedp_decode(encoded_text, &dec_len);
--- a/src/util.h	Thu Jul 21 04:16:35 2005 +0000
+++ b/src/util.h	Thu Jul 21 05:49:48 2005 +0000
@@ -53,7 +53,7 @@
  *
  * @see gaim_base16_decode()
  */
-gchar *gaim_base16_encode(const guint8 *data, gsize len);
+gchar *gaim_base16_encode(const guchar *data, gsize len);
 
 /**
  * Converts an ASCII string of base-16 encoded data to
@@ -70,7 +70,7 @@
  *
  * @see gaim_base16_encode()
  */
-guint8 *gaim_base16_decode(const char *str, gsize *ret_len);
+guchar *gaim_base16_decode(const char *str, gsize *ret_len);
 
 /*@}*/
 
@@ -91,7 +91,7 @@
  *
  * @see gaim_base64_decode()
  */
-gchar *gaim_base64_encode(const guint8 *data, gsize len);
+gchar *gaim_base64_encode(const guchar *data, gsize len);
 
 /**
  * Converts an ASCII string of base-64 encoded data to
@@ -108,7 +108,7 @@
  *
  * @see gaim_base64_encode()
  */
-guint8 *gaim_base64_decode(const char *str, gsize *ret_len);
+guchar *gaim_base64_decode(const char *str, gsize *ret_len);
 
 /*@}*/
 
@@ -134,7 +134,7 @@
  *
  * @return The raw data.  Must be g_free'd when no longer needed.
  */
-guint8 *gaim_quotedp_decode(const char *str, gsize *ret_len);
+guchar *gaim_quotedp_decode(const char *str, gsize *ret_len);
 
 /*@}*/