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



Author: otaylor
Date: Tue Dec 16 04:20:50 2008
New Revision: 994
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=994&view=rev

Log:
Disable array auto-detection for out-annotated parameters

If we have a parameter annotated as (out), then having a ctype of
'char **' (or similar) doesn't necessarily indicate an array.

* giscanner/transformer.py: Skip array-detection logic for
  (out)-annotated parameters.
* tests/scanner/annotation.h tests/scanner/annotation.c
  tests/scanner/annotation-1.0-expected.gir
  tests/scanner/annotation-1.0-expected.tgir: Add a test for
  an (out) string parameter.

http://bugzilla.gnome.org/show_bug.cgi?id=563934

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	Tue Dec 16 04:20:50 2008
@@ -462,7 +462,8 @@
             rettype = Map(derefed_name,
                           ctype,
                           key_type, value_type)
-        elif ((is_param and canonical_ctype in default_array_types)
+        elif ((is_param and canonical_ctype in default_array_types
+               and not 'out' in options)
               or ('array' in options)):
             if canonical_ctype[-1] == '*':
                 derefed_name = canonical_ctype[:-1]

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	Tue Dec 16 04:20:50 2008
@@ -235,6 +235,16 @@
           </parameter>
         </parameters>
       </method>
+      <method name="string_out" c:identifier="annotation_object_string_out">
+        <return-value transfer-ownership="none">
+          <type name="boolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="str_out" direction="out" transfer-ownership="full">
+            <type name="utf8" c:type="char**"/>
+          </parameter>
+        </parameters>
+      </method>
       <method name="do_not_use"
               c:identifier="annotation_object_do_not_use"
               deprecated="Use annotation_object_create_object() instead."

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	Tue Dec 16 04:20:50 2008
@@ -224,6 +224,16 @@
           </parameter>
         </parameters>
       </method>
+      <method name="string_out" c:identifier="annotation_object_string_out">
+        <return-value transfer-ownership="none">
+          <type name="boolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="str_out" transfer-ownership="full" direction="out">
+            <type name="utf8"/>
+          </parameter>
+        </parameters>
+      </method>
       <method name="do_not_use" c:identifier="annotation_object_do_not_use" deprecated="1">
         <return-value transfer-ownership="full">
           <type name="GObject.Object"/>

Modified: trunk/tests/scanner/annotation.c
==============================================================================
--- trunk/tests/scanner/annotation.c	(original)
+++ trunk/tests/scanner/annotation.c	Tue Dec 16 04:20:50 2008
@@ -292,6 +292,22 @@
 }
 
 /**
+ * annotation_object_string_out:
+ * @object: a #AnnotationObject
+ * @str_out: (out) (transfer full): string return value
+ *
+ * Test returning a string as an out parameter
+ *
+ * Returns: some boolean
+ **/
+gboolean
+annotation_object_string_out(AnnotationObject *object,
+                             char            **str_out)
+{
+
+}
+
+/**
  * 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	Tue Dec 16 04:20:50 2008
@@ -73,6 +73,8 @@
 void     annotation_object_parse_args   (AnnotationObject *object,
                                          int              *argc,
                                          char           ***argv);
+gboolean annotation_object_string_out   (AnnotationObject *object,
+                                         char            **str_out);
 
 GObject* annotation_object_do_not_use   (AnnotationObject *object);
 



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