From: Christian H. <ch...@us...> - 2003-09-20 22:27:35
|
Update of /cvsroot/gaim/gaim/plugins/perl In directory sc8-pr-cvs1:/tmp/cvs-serv31526 Modified Files: perl-common.c Log Message: 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! Index: perl-common.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/perl/perl-common.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -p -r1.5 -r1.6 --- perl-common.c 20 Sep 2003 21:38:12 -0000 1.5 +++ perl-common.c 20 Sep 2003 22:27:31 -0000 1.6 @@ -383,46 +383,94 @@ gaim_perl_sv_from_subtype(const GaimValu 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_INT: + return newSViv(*va_arg(args, int *)); - case GAIM_TYPE_UINT: - return newSVuv(va_arg(args, unsigned 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_LONG: + return newSViv(*va_arg(args, long *)); - case GAIM_TYPE_ULONG: - return newSVuv(va_arg(args, unsigned long)); + case GAIM_TYPE_ULONG: + return newSVuv(*va_arg(args, unsigned long *)); - case GAIM_TYPE_INT64: - return newSViv(va_arg(args, gint64)); + case GAIM_TYPE_INT64: + return newSViv(*va_arg(args, gint64 *)); - case GAIM_TYPE_UINT64: - return newSVuv(va_arg(args, guint64)); + case GAIM_TYPE_UINT64: + return newSVuv(*va_arg(args, guint64 *)); - case GAIM_TYPE_STRING: - return newSVGChar(va_arg(args, char *)); + case GAIM_TYPE_STRING: + return newSVGChar(*va_arg(args, char **)); - case GAIM_TYPE_POINTER: - return newSViv((IV)va_arg(args, void *)); + case GAIM_TYPE_POINTER: + return newSViv((IV)*va_arg(args, void **)); - 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_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; + 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_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_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_POINTER: + return newSViv((IV)va_arg(args, void *)); + + 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; + } } } |