summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2018-04-28 00:00:00 +0000
committerChristoph Reiter <reiter.christoph@gmail.com>2018-06-20 19:43:48 +0200
commit7043bb4b6842ba5572a4cf289a720b4044aeab5f (patch)
tree39b125e75a52e1fcb90c2edc8d8310fb0fe0c316
parentb310d006968030862714398e89254402d0b00edb (diff)
downloadgobject-introspection-7043bb4b6842ba5572a4cf289a720b4044aeab5f.tar.gz
Preserve complete C type when applying array annotations.
-rw-r--r--giscanner/maintransformer.py1
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.test_strv_out_container.page2
-rw-r--r--tests/scanner/Regress-1.0-expected.gir12
3 files changed, 8 insertions, 7 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 4f6db545..a7287ec2 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -389,6 +389,7 @@ class MainTransformer(object):
array_options = annotations.get(ANN_ARRAY)
container_type = ast.Array(array_type, element_type_node, ctype=node.type.ctype,
+ complete_ctype=node.type.complete_ctype,
is_const=node.type.is_const)
if array_options.get(OPT_ARRAY_ZERO_TERMINATED, '0') == '0':
container_type.zeroterminated = False
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.test_strv_out_container.page b/tests/scanner/Regress-1.0-C-expected/Regress.test_strv_out_container.page
index 3e27a2ea..827e480b 100644
--- a/tests/scanner/Regress-1.0-C-expected/Regress.test_strv_out_container.page
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.test_strv_out_container.page
@@ -16,7 +16,7 @@
</info>
<title>regress_test_strv_out_container</title>
<synopsis><code mime="text/x-csrc">
-char** regress_test_strv_out_container (void);
+const char** regress_test_strv_out_container (void);
</code></synopsis>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 5e859ad0..39f5d05d 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -623,7 +623,7 @@ each string needs to be freed.</doc>
</instance-parameter>
<parameter name="data" transfer-ownership="none">
<doc xml:space="preserve">The data</doc>
- <array length="1" zero-terminated="0" c:type="guchar*">
+ <array length="1" zero-terminated="0" c:type="const guchar*">
<type name="guint8" c:type="guchar"/>
</array>
</parameter>
@@ -646,7 +646,7 @@ each string needs to be freed.</doc>
</instance-parameter>
<parameter name="data" transfer-ownership="none">
<doc xml:space="preserve">The data</doc>
- <array length="1" zero-terminated="0" c:type="gchar*">
+ <array length="1" zero-terminated="0" c:type="const gchar*">
<type name="gint8"/>
</array>
</parameter>
@@ -2374,7 +2374,7 @@ use it should be.</doc>
<type name="gsize" c:type="gsize"/>
</parameter>
<parameter name="two" transfer-ownership="none">
- <array length="3" zero-terminated="0" c:type="char**">
+ <array length="3" zero-terminated="0" c:type="const char**">
<type name="utf8"/>
</array>
</parameter>
@@ -4536,7 +4536,7 @@ detection, and fixing it via annotations.</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="properties" transfer-ownership="none">
- <array length="0" zero-terminated="0" c:type="gchar**">
+ <array length="0" zero-terminated="0" c:type="const gchar* const*">
<type name="utf8"/>
</array>
</parameter>
@@ -6555,7 +6555,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=685399</doc>
<function name="test_strv_out_container"
c:identifier="regress_test_strv_out_container">
<return-value transfer-ownership="container">
- <array c:type="char**">
+ <array c:type="const char**">
<type name="utf8"/>
</array>
</return-value>
@@ -6569,7 +6569,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=685399</doc>
direction="out"
caller-allocates="0"
transfer-ownership="container">
- <array c:type="char***">
+ <array c:type="const char***">
<type name="utf8" c:type="char**"/>
</array>
</parameter>