Bug 579008 - Don't override element-type for arrays
authorColin Walters <walters@verbum.org>
Tue, 23 Jun 2009 21:51:15 +0000 (17:51 -0400)
committerColin Walters <walters@verbum.org>
Tue, 23 Jun 2009 21:58:38 +0000 (17:58 -0400)
Annotation parser patch from: Tim Horton <hortont424@gmail.com>

If an explicit element type is specified, don't override it with
guint8.

giscanner/annotationparser.py
tests/scanner/annotation-1.0-expected.gir
tests/scanner/annotation-1.0-expected.tgir
tests/scanner/annotation.c
tests/scanner/annotation.h

index bb74cdc..d79a46b 100644 (file)
@@ -601,7 +601,8 @@ class AnnotationApplier(object):
             # is specified.
             if (isinstance(node, Parameter) and
                 node.type.name == 'utf8' and
-                self._guess_direction(node) == PARAM_DIRECTION_IN):
+                self._guess_direction(node) == PARAM_DIRECTION_IN and
+                element_type is None):
                 # FIXME: unsigned char/guchar should be uint8
                 container_type.element_type = Type('int8')
         container_type.size = array_values.get(OPT_ARRAY_FIXED_SIZE)
index 46a3006..3715edc 100644 (file)
@@ -607,6 +607,22 @@ detection, and fixing it via annotations.">
         </parameter>
       </parameters>
     </function>
+    <function name="string_array_length"
+              c:identifier="annotation_string_array_length">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="n_properties" transfer-ownership="none">
+          <type name="uint" c:type="guint"/>
+        </parameter>
+        <parameter name="properties" transfer-ownership="none">
+          <array length="0" c:type="gchar*">
+            <type name="utf8"/>
+          </array>
+        </parameter>
+      </parameters>
+    </function>
     <function name="string_zero_terminated"
               c:identifier="annotation_string_zero_terminated">
       <return-value transfer-ownership="full" doc="The return value">
index 9e6fe16..76a20ed 100644 (file)
         </parameter>
       </parameters>
     </function>
+    <function name="string_array_length" c:identifier="annotation_string_array_length">
+      <return-value transfer-ownership="none">
+        <type name="none"/>
+      </return-value>
+      <parameters>
+        <parameter name="n_properties" transfer-ownership="none">
+          <type name="uint"/>
+        </parameter>
+        <parameter name="properties" transfer-ownership="none">
+          <array length="0">
+            <type name="utf8"/>
+          </array>
+        </parameter>
+      </parameters>
+    </function>
     <function name="string_zero_terminated" c:identifier="annotation_string_zero_terminated">
       <return-value transfer-ownership="full">
         <array zero-terminated="1">
index 5c5d46d..058d508 100644 (file)
@@ -600,6 +600,16 @@ annotation_versioned (void)
 {
 }
 
+/**
+ * annotation_string_array_length:
+ * @n_properties:
+ * @properties: (array length=n_properties) (element-type utf8):
+ */
+void
+annotation_string_array_length (guint n_properties, const gchar * const properties[])
+{
+}
+
 /**
  * annotation_object_extra_annos:
  *
index 745a94b..798594b 100644 (file)
@@ -129,6 +129,8 @@ void     annotation_versioned           (void);
 char **  annotation_string_zero_terminated (void);
 void     annotation_string_zero_terminated_out (char ***out);
 
+void     annotation_string_array_length (guint n_properties, const gchar * const properties[]);
+
 void     annotation_object_extra_annos (AnnotationObject *object);
 
 void     annotation_custom_destroy (AnnotationCallback callback,