From a59c3f3baa6bf13f74429d0946f4dc768be94e15 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 3 Nov 2012 23:09:59 +0000 Subject: fix operator input variables on webidl long --- src/jsapi-libdom-operator.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/jsapi-libdom-operator.c b/src/jsapi-libdom-operator.c index e0be9eb..3183676 100644 --- a/src/jsapi-libdom-operator.c +++ b/src/jsapi-libdom-operator.c @@ -536,6 +536,7 @@ output_operation_input(struct binding *binding, struct webidl_node *arg_ident = NULL; struct webidl_node *arg_type = NULL; struct webidl_node *arg_type_base = NULL; + struct webidl_node *type_mod = NULL; enum webidl_type webidl_arg_type; int arg_cur = 0; /* current position in the input argument vector */ @@ -611,9 +612,21 @@ output_operation_input(struct binding *binding, case WEBIDL_TYPE_LONG: /* int32_t */ - fprintf(binding->outfile, - "\t%s = 0;\n", - webidl_node_gettext(arg_ident)); + type_mod = webidl_node_find_type(webidl_node_getnode(arg_type), + NULL, + WEBIDL_NODE_TYPE_MODIFIER); + if ((type_mod != NULL) && + (webidl_node_getint(type_mod) == WEBIDL_TYPE_MODIFIER_UNSIGNED)) { + fprintf(binding->outfile, + "\tJS_ValueToECMAUint32(cx, argv[%d], &%s);\n", + arg_cur, + webidl_node_gettext(arg_ident)); + } else { + fprintf(binding->outfile, + "\tJS_ValueToECMAInt32(cx, argv[%d], &%s);\n", + arg_cur, + webidl_node_gettext(arg_ident)); + } break; case WEBIDL_TYPE_STRING: -- cgit v1.2.3