[gjs] function: Correct argument counting for array arguments



commit 4d31cc9c544b1403c21a14ccb077190ae87de0d6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Aug 7 14:55:53 2012 -0300

    function: Correct argument counting for array arguments
    
    For an (out) array length argument, we were accidentally subtracting
    it from the expected argc.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680215

 gi/function.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gi/function.c b/gi/function.c
index 111a803..03bd5e8 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -1539,9 +1539,10 @@ init_cached_function_data (JSContext      *context,
 
                     if (array_length_pos < i) {
                         /* we already collected array_length_pos, remove it */
-                        function->expected_js_argc -= 1;
+                        if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT)
+                            function->expected_js_argc -= 1;
                         if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT)
-                            function->js_out_argc--;
+                            function->js_out_argc -= 1;
                     }
                 }
             }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]