gobject-introspection r921 - in trunk: . giscanner tests/scanner



Author: walters
Date: Thu Nov 13 23:17:57 2008
New Revision: 921
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=921&view=rev

Log:
Bug 560708 â Fix zero-termination defaults for arrays with length=

Modified:
   trunk/ChangeLog
   trunk/giscanner/transformer.py
   trunk/tests/scanner/annotation-1.0-expected.gir
   trunk/tests/scanner/annotation-1.0-expected.tgir
   trunk/tests/scanner/annotation.c
   trunk/tests/scanner/annotation.h

Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py	(original)
+++ trunk/giscanner/transformer.py	Thu Nov 13 23:17:57 2008
@@ -426,9 +426,12 @@
                                for opt in options.get('array', [])])
             if 'length' in array_opts:
                 rettype.length_param_name = array_opts['length']
+                rettype.zeroterminated = False
             if 'fixed-size' in array_opts:
                 rettype.size = array_opts['fixed-size']
                 rettype.zeroterminated = False
+            if 'zero-terminated' in array_opts:
+                rettype.zeroterminated = array_opts['zero-terminated'] != '0'
         else:
             derefed_name = self.parse_ctype(ctype)
             rettype = Type(derefed_name, ctype)

Modified: trunk/tests/scanner/annotation-1.0-expected.gir
==============================================================================
--- trunk/tests/scanner/annotation-1.0-expected.gir	(original)
+++ trunk/tests/scanner/annotation-1.0-expected.gir	Thu Nov 13 23:17:57 2008
@@ -187,6 +187,22 @@
         </return-value>
         <parameters>
           <parameter name="nums" transfer-ownership="none">
+            <array zero-terminated="0" length="2" c:type="int*">
+              <type name="int"/>
+            </array>
+          </parameter>
+          <parameter name="n_nums" transfer-ownership="none">
+            <type name="int" c:type="int"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="compute_sum_nz"
+              c:identifier="annotation_object_compute_sum_nz">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="nums" transfer-ownership="none">
             <array length="2" c:type="int*">
               <type name="int"/>
             </array>

Modified: trunk/tests/scanner/annotation-1.0-expected.tgir
==============================================================================
--- trunk/tests/scanner/annotation-1.0-expected.tgir	(original)
+++ trunk/tests/scanner/annotation-1.0-expected.tgir	Thu Nov 13 23:17:57 2008
@@ -177,6 +177,21 @@
         </return-value>
         <parameters>
           <parameter name="nums" transfer-ownership="none">
+            <array length="2">
+              <type name="int"/>
+            </array>
+          </parameter>
+          <parameter name="n_nums" transfer-ownership="none">
+            <type name="int"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="compute_sum_nz" c:identifier="annotation_object_compute_sum_nz">
+        <return-value transfer-ownership="none">
+          <type name="none"/>
+        </return-value>
+        <parameters>
+          <parameter name="nums" transfer-ownership="none">
             <array length="2" zero-terminated="1">
               <type name="int"/>
             </array>

Modified: trunk/tests/scanner/annotation.c
==============================================================================
--- trunk/tests/scanner/annotation.c	(original)
+++ trunk/tests/scanner/annotation.c	Thu Nov 13 23:17:57 2008
@@ -242,6 +242,22 @@
 }
 
 /**
+ * annotation_object_compute_sum_nz:
+ * @object: a #AnnotationObject
+ * @nums: (array length=n_nums zero-terminated=1): Sequence of numbers
+ * @n_nums: Length of number array
+ *
+ * Test taking a zero-terminated array with length parameter
+ **/
+void
+annotation_object_compute_sum_nz(AnnotationObject *object,
+                                 int             *nums,
+                                 int              n_nums)
+{
+
+}
+
+/**
  * annotation_object_allow_none:
  * @object: a #GObject
  * @somearg: (allow-none):

Modified: trunk/tests/scanner/annotation.h
==============================================================================
--- trunk/tests/scanner/annotation.h	(original)
+++ trunk/tests/scanner/annotation.h	Thu Nov 13 23:17:57 2008
@@ -66,6 +66,9 @@
 void     annotation_object_compute_sum_n(AnnotationObject *object,
 					 int              *nums,
 					 int               n_nums);
+void     annotation_object_compute_sum_nz(AnnotationObject *object,
+                                          int             *nums,
+                                          int              n_nums);
 
 GObject* annotation_object_do_not_use   (AnnotationObject *object);
 



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