gtk+-1.2.5 va_args fix...
- From: Ani Joshi <ajoshi shell unixbox com>
- To: gtk-list redhat com
- Subject: gtk+-1.2.5 va_args fix...
- Date: Wed, 6 Oct 1999 13:40:19 -0700 (PDT)
I ran into problems with gtk+-1.2.5 and gcc-2.95.2pre with a bunch
of bad va_arg() calls. The new compiler is now pretty strict on these.
Attatched you will find a patch which fixes the bad va_arg() calls.
Ani
diff -uNr gtk+-1.2.5.orig/gtk/gtkargcollector.c gtk+-1.2.5/gtk/gtkargcollector.c
--- gtk+-1.2.5.orig/gtk/gtkargcollector.c Tue Oct 5 14:50:14 1999
+++ gtk+-1.2.5/gtk/gtkargcollector.c Tue Oct 5 15:07:07 1999
@@ -65,45 +65,45 @@
* passed as an int \
*/ \
case GTK_TYPE_CHAR: \
- GTK_VALUE_CHAR (*arg) = va_arg (var_args, gint); \
+ GTK_VALUE_CHAR (*arg) = (gint)va_arg (var_args, int); \
break; \
case GTK_TYPE_UCHAR: \
- GTK_VALUE_UCHAR (*arg) = va_arg (var_args, guint); \
+ GTK_VALUE_UCHAR (*arg) = (guint)va_arg (var_args, int); \
break; \
case GTK_TYPE_BOOL: \
- GTK_VALUE_BOOL (*arg) = va_arg (var_args, gint); \
+ GTK_VALUE_BOOL (*arg) = (gint)va_arg (var_args, int); \
break; \
case GTK_TYPE_INT: \
- GTK_VALUE_INT (*arg) = va_arg (var_args, gint); \
+ GTK_VALUE_INT (*arg) = (gint)va_arg (var_args, int); \
break; \
case GTK_TYPE_UINT: \
- GTK_VALUE_UINT (*arg) = va_arg (var_args, guint); \
+ GTK_VALUE_UINT (*arg) = (guint)va_arg (var_args, int); \
break; \
case GTK_TYPE_ENUM: \
- GTK_VALUE_ENUM (*arg) = va_arg (var_args, gint); \
+ GTK_VALUE_ENUM (*arg) = (gint)va_arg (var_args, int); \
break; \
case GTK_TYPE_FLAGS: \
- GTK_VALUE_FLAGS (*arg) = va_arg (var_args, guint); \
+ GTK_VALUE_FLAGS (*arg) = (guint)va_arg (var_args, int); \
break; \
\
/* we collect longs as glongs since they differ in size with \
* integers on some platforms \
*/ \
case GTK_TYPE_LONG: \
- GTK_VALUE_LONG (*arg) = va_arg (var_args, glong); \
+ GTK_VALUE_LONG (*arg) = (glong)va_arg (var_args, int); \
break; \
case GTK_TYPE_ULONG: \
- GTK_VALUE_ULONG (*arg) = va_arg (var_args, gulong); \
+ GTK_VALUE_ULONG (*arg) = (gulong)va_arg (var_args, int); \
break; \
\
/* floats are always passed as doubles \
*/ \
case GTK_TYPE_FLOAT: \
- /* GTK_VALUE_FLOAT (*arg) = va_arg (var_args, gfloat); */ \
- GTK_VALUE_FLOAT (*arg) = va_arg (var_args, gdouble); \
+ /* GTK_VALUE_FLOAT (*arg) = (gfloat)va_arg (var_args, float); */ \
+ GTK_VALUE_FLOAT (*arg) = (gdouble)va_arg (var_args, float); \
break; \
case GTK_TYPE_DOUBLE: \
- GTK_VALUE_DOUBLE (*arg) = va_arg (var_args, gdouble); \
+ GTK_VALUE_DOUBLE (*arg) = (gdouble)va_arg (var_args, float); \
break; \
\
/* collect pointer values \
@@ -112,34 +112,34 @@
GTK_VALUE_STRING (*arg) = va_arg (var_args, gchar*); \
break; \
case GTK_TYPE_POINTER: \
- GTK_VALUE_POINTER (*arg) = va_arg (var_args, gpointer); \
+ GTK_VALUE_POINTER (*arg) = (gpointer)va_arg (var_args, int); \
break; \
case GTK_TYPE_BOXED: \
- GTK_VALUE_BOXED (*arg) = va_arg (var_args, gpointer); \
+ GTK_VALUE_BOXED (*arg) = (gpointer)va_arg (var_args, int); \
break; \
\
/* structured types \
*/ \
case GTK_TYPE_SIGNAL: \
- GTK_VALUE_SIGNAL (*arg).f = va_arg (var_args, GtkSignalFunc); \
- GTK_VALUE_SIGNAL (*arg).d = va_arg (var_args, gpointer); \
+ GTK_VALUE_SIGNAL (*arg).f = (GtkSignalFunc)va_arg (var_args, int); \
+ GTK_VALUE_SIGNAL (*arg).d = (gpointer)va_arg (var_args, int); \
break; \
case GTK_TYPE_ARGS: \
- GTK_VALUE_ARGS (*arg).n_args = va_arg (var_args, gint); \
+ GTK_VALUE_ARGS (*arg).n_args = (gint)va_arg (var_args, int); \
GTK_VALUE_ARGS (*arg).args = va_arg (var_args, GtkArg*); \
break; \
case GTK_TYPE_FOREIGN: \
- GTK_VALUE_FOREIGN (*arg).data = va_arg (var_args, gpointer); \
- GTK_VALUE_FOREIGN (*arg).notify = va_arg (var_args, GtkDestroyNotify); \
+ GTK_VALUE_FOREIGN (*arg).data = (gpointer)va_arg (var_args, int); \
+ GTK_VALUE_FOREIGN (*arg).notify = (GtkDestroyNotify)va_arg (var_args, int); \
break; \
case GTK_TYPE_CALLBACK: \
- GTK_VALUE_CALLBACK (*arg).marshal = va_arg (var_args, GtkCallbackMarshal); \
- GTK_VALUE_CALLBACK (*arg).data = va_arg (var_args, gpointer); \
- GTK_VALUE_CALLBACK (*arg).notify = va_arg (var_args, GtkDestroyNotify); \
+ GTK_VALUE_CALLBACK (*arg).marshal = (GtkCallbackMarshal)va_arg (var_args, int); \
+ GTK_VALUE_CALLBACK (*arg).data = (gpointer)va_arg (var_args, int); \
+ GTK_VALUE_CALLBACK (*arg).notify = (GtkDestroyNotify)va_arg (var_args, int); \
break; \
case GTK_TYPE_C_CALLBACK: \
- GTK_VALUE_C_CALLBACK (*arg).func = va_arg (var_args, GtkFunction); \
- GTK_VALUE_C_CALLBACK (*arg).func_data = va_arg (var_args, gpointer); \
+ GTK_VALUE_C_CALLBACK (*arg).func = (GtkFunction)va_arg (var_args, int); \
+ GTK_VALUE_C_CALLBACK (*arg).func_data = (gpointer)va_arg (var_args, int); \
break; \
\
/* we do some extra sanity checking when collecting objects, \
diff -uNr gtk+-1.2.5.orig/gtk/gtkbindings.c gtk+-1.2.5/gtk/gtkbindings.c
--- gtk+-1.2.5.orig/gtk/gtkbindings.c Tue Oct 5 15:07:26 1999
+++ gtk+-1.2.5/gtk/gtkbindings.c Tue Oct 5 15:08:49 1999
@@ -656,7 +656,7 @@
arg = g_new0 (GtkBindingArg, 1);
slist = g_slist_prepend (slist, arg);
- arg->arg_type = va_arg (args, GtkType);
+ arg->arg_type = (GtkType)va_arg (args, int);
switch (GTK_FUNDAMENTAL_TYPE (arg->arg_type))
{
/* for elaborated commenting about var args collection, take a look
@@ -670,17 +670,17 @@
case GTK_TYPE_ENUM:
case GTK_TYPE_FLAGS:
arg->arg_type = GTK_TYPE_LONG;
- arg->d.long_data = va_arg (args, gint);
+ arg->d.long_data = (gint)va_arg (args, int);
break;
case GTK_TYPE_LONG:
case GTK_TYPE_ULONG:
arg->arg_type = GTK_TYPE_LONG;
- arg->d.long_data = va_arg (args, glong);
+ arg->d.long_data = (glong)va_arg (args, int);
break;
case GTK_TYPE_FLOAT:
case GTK_TYPE_DOUBLE:
arg->arg_type = GTK_TYPE_DOUBLE;
- arg->d.double_data = va_arg (args, gdouble);
+ arg->d.double_data = (gdouble)va_arg (args, float);
break;
case GTK_TYPE_STRING:
if (arg->arg_type != GTK_TYPE_IDENTIFIER)
diff -uNr gtk+-1.2.5.orig/gtk/gtkobject.c gtk+-1.2.5/gtk/gtkobject.c
--- gtk+-1.2.5.orig/gtk/gtkobject.c Tue Oct 5 15:09:05 1999
+++ gtk+-1.2.5/gtk/gtkobject.c Tue Oct 5 15:09:41 1999
@@ -387,7 +387,7 @@
va_start (args, nparams);
for (i = 0; i < nparams; i++)
- params[i] = va_arg (args, GtkType);
+ params[i] = (GtkType)va_arg (args, int);
va_end (args);
}
@@ -685,7 +685,7 @@
name = (gchar*) first_arg_name;
while (name)
{
- gpointer value_pointer = va_arg (var_args, gpointer);
+ gpointer value_pointer = (gpointer)va_arg (var_args, int);
if (value_pointer)
{
diff -uNr gtk+-1.2.5.orig/gtk/gtksignal.c gtk+-1.2.5/gtk/gtksignal.c
--- gtk+-1.2.5.orig/gtk/gtksignal.c Tue Oct 5 15:12:54 1999
+++ gtk+-1.2.5/gtk/gtksignal.c Tue Oct 5 15:13:31 1999
@@ -400,7 +400,7 @@
va_start (args, nparams);
for (i = 0; i < nparams; i++)
- params[i] = va_arg (args, GtkType);
+ params[i] = (GtkType)va_arg (args, int);
va_end (args);
}
@@ -1986,7 +1986,7 @@
return_type <= GTK_TYPE_FLAT_LAST) ||
(return_type == GTK_TYPE_OBJECT))
{
- GTK_VALUE_POINTER (*params) = va_arg (var_args, gpointer);
+ GTK_VALUE_POINTER (*params) = (gpointer)va_arg (var_args, int);
if (GTK_VALUE_POINTER (*params) == NULL)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]