changeset 6898:806f6e950e76

[gaim-migrate @ 7445] This should allow parameters with outgoing types (int *, char **, etc) in signals to work without appearing as garbage in perl. You still can't set them, though.. That's next. Untested! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 20 Sep 2003 22:27:31 +0000
parents 69e0a3e29aa1
children 6de3b775d5b1
files plugins/perl/perl-common.c
diffstat 1 files changed, 77 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/perl/perl-common.c	Sat Sep 20 21:38:12 2003 +0000
+++ b/plugins/perl/perl-common.c	Sat Sep 20 22:27:31 2003 +0000
@@ -383,46 +383,94 @@
 SV *
 gaim_perl_sv_from_vargs(const GaimValue *value, va_list args)
 {
-	switch (gaim_value_get_type(value))
+	if (gaim_value_is_outgoing(value))
 	{
-		case GAIM_TYPE_SUBTYPE:
-			return gaim_perl_sv_from_subtype(value, va_arg(args, void *));
+		switch (gaim_value_get_type(value))
+		{
+			case GAIM_TYPE_SUBTYPE:
+				return gaim_perl_sv_from_subtype(value, *va_arg(args, void **));
+
+			case GAIM_TYPE_BOOLEAN:
+				return newSViv(*va_arg(args, gboolean *));
 
-		case GAIM_TYPE_BOOLEAN:
-			return newSViv(va_arg(args, gboolean));
+			case GAIM_TYPE_INT:
+				return newSViv(*va_arg(args, int *));
+
+			case GAIM_TYPE_UINT:
+				return newSVuv(*va_arg(args, unsigned int *));
+
+			case GAIM_TYPE_LONG:
+				return newSViv(*va_arg(args, long *));
 
-		case GAIM_TYPE_INT:
-			return newSViv(va_arg(args, int));
+			case GAIM_TYPE_ULONG:
+				return newSVuv(*va_arg(args, unsigned long *));
 
-		case GAIM_TYPE_UINT:
-			return newSVuv(va_arg(args, unsigned int));
+			case GAIM_TYPE_INT64:
+				return newSViv(*va_arg(args, gint64 *));
+
+			case GAIM_TYPE_UINT64:
+				return newSVuv(*va_arg(args, guint64 *));
 
-		case GAIM_TYPE_LONG:
-			return newSViv(va_arg(args, long));
+			case GAIM_TYPE_STRING:
+				return newSVGChar(*va_arg(args, char **));
+
+			case GAIM_TYPE_POINTER:
+				return newSViv((IV)*va_arg(args, void **));
 
-		case GAIM_TYPE_ULONG:
-			return newSVuv(va_arg(args, unsigned long));
+			case GAIM_TYPE_BOXED:
+				/* Uh.. I dunno. Try this? */
+				return sv_2mortal(gaim_perl_bless_object(
+						va_arg(args, void **),
+						gaim_value_get_specific_type(value)));
 
-		case GAIM_TYPE_INT64:
-			return newSViv(va_arg(args, gint64));
+			default:
+				/* If this happens, things are going to get screwed up... */
+				return NULL;
+		}
+	}
+	else
+	{
+		switch (gaim_value_get_type(value))
+		{
+			case GAIM_TYPE_SUBTYPE:
+				return gaim_perl_sv_from_subtype(value, va_arg(args, void *));
 
-		case GAIM_TYPE_UINT64:
-			return newSVuv(va_arg(args, guint64));
+			case GAIM_TYPE_BOOLEAN:
+				return newSViv(va_arg(args, gboolean));
+
+			case GAIM_TYPE_INT:
+				return newSViv(va_arg(args, int));
 
-		case GAIM_TYPE_STRING:
-			return newSVGChar(va_arg(args, char *));
+			case GAIM_TYPE_UINT:
+				return newSVuv(va_arg(args, unsigned int));
+
+			case GAIM_TYPE_LONG:
+				return newSViv(va_arg(args, long));
 
-		case GAIM_TYPE_POINTER:
-			return newSViv((IV)va_arg(args, void *));
+			case GAIM_TYPE_ULONG:
+				return newSVuv(va_arg(args, unsigned long));
+
+			case GAIM_TYPE_INT64:
+				return newSViv(va_arg(args, gint64));
+
+			case GAIM_TYPE_UINT64:
+				return newSVuv(va_arg(args, guint64));
+
+			case GAIM_TYPE_STRING:
+				return newSVGChar(va_arg(args, char *));
 
-		case GAIM_TYPE_BOXED:
-			/* Uh.. I dunno. Try this? */
-			return sv_2mortal(gaim_perl_bless_object(
-					va_arg(args, void *),
-					gaim_value_get_specific_type(value)));
+			case GAIM_TYPE_POINTER:
+				return newSViv((IV)va_arg(args, void *));
 
-		default:
-			/* If this happens, things are going to get screwed up... */
-			return NULL;
+			case GAIM_TYPE_BOXED:
+				/* Uh.. I dunno. Try this? */
+				return sv_2mortal(gaim_perl_bless_object(
+						va_arg(args, void *),
+						gaim_value_get_specific_type(value)));
+
+			default:
+				/* If this happens, things are going to get screwed up... */
+				return NULL;
+		}
 	}
 }