[gobject-introspection] Bug 579008 - Don't override element-type for arrays
- From: Colin Walters <walters src gnome org>
- To: svn-commits-list gnome org
- Subject: [gobject-introspection] Bug 579008 - Don't override element-type for arrays
- Date: Tue, 23 Jun 2009 22:57:31 +0000 (UTC)
commit 8ef942ed56236380cbc9acc445926bfa534cc58a
Author: Colin Walters <walters verbum org>
Date: Tue Jun 23 17:51:15 2009 -0400
Bug 579008 - Don't override element-type for arrays
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 | 3 ++-
tests/scanner/annotation-1.0-expected.gir | 16 ++++++++++++++++
tests/scanner/annotation-1.0-expected.tgir | 15 +++++++++++++++
tests/scanner/annotation.c | 10 ++++++++++
tests/scanner/annotation.h | 2 ++
5 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index bb74cdc..d79a46b 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -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)
diff --git a/tests/scanner/annotation-1.0-expected.gir b/tests/scanner/annotation-1.0-expected.gir
index 46a3006..3715edc 100644
--- a/tests/scanner/annotation-1.0-expected.gir
+++ b/tests/scanner/annotation-1.0-expected.gir
@@ -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">
diff --git a/tests/scanner/annotation-1.0-expected.tgir b/tests/scanner/annotation-1.0-expected.tgir
index 9e6fe16..76a20ed 100644
--- a/tests/scanner/annotation-1.0-expected.tgir
+++ b/tests/scanner/annotation-1.0-expected.tgir
@@ -452,6 +452,21 @@
</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">
diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c
index 5c5d46d..058d508 100644
--- a/tests/scanner/annotation.c
+++ b/tests/scanner/annotation.c
@@ -601,6 +601,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:
*
* Attributes: (org.foobar testvalue)
diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h
index 745a94b..798594b 100644
--- a/tests/scanner/annotation.h
+++ b/tests/scanner/annotation.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]