changeset 2462:cf2f2450f7cc

[gaim-migrate @ 2475] stupid committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 09 Oct 2001 20:19:42 +0000
parents 0edec72bc72f
children 0be6fadaa64f
files src/core.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/core.c	Tue Oct 09 19:24:16 2001 +0000
+++ b/src/core.c	Tue Oct 09 20:19:42 2001 +0000
@@ -41,18 +41,18 @@
 static gint UI_fd = -1;
 GSList *uis = NULL;
 
-static guchar *UI_build(int *len, guchar type, guchar subtype, va_list args1)
+static guchar *UI_build(guint32 *len, guchar type, guchar subtype, va_list args1)
 {
 	va_list args2;
 	guchar *buffer;
-	int pos;
+	guint32 pos;
 	int size;
 	void *data;
 
 	G_VA_COPY(args2, args1);
 
-	buffer = g_malloc(sizeof(guchar) * 2 + 4);
 	*len = sizeof(guchar) * 2 + 4;
+	buffer = g_malloc(*len);
 	pos = 0;
 
 	memcpy(buffer + pos, &type, sizeof(type)); pos += sizeof(type);
@@ -73,6 +73,9 @@
 		size = va_arg(args2, int);
 	}
 
+	/* now we do size */
+	memcpy(buffer + sizeof(guchar) * 2, &pos, 4);
+
 	va_end(args2);
 
 	return buffer;
@@ -95,7 +98,7 @@
 {
 	va_list ap;
 	gchar *data;
-	int len;
+	guint32 len;
 
 	va_start(ap, subtype);
 	data = UI_build(&len, type, subtype, ap);
@@ -120,7 +123,7 @@
 {
 	va_list ap;
 	gchar *data;
-	int len;
+	guint32 len;
 
 	if (!uis)
 		return;