[gobject-introspection] Preserve complete C type when applying array annotations.



commit 7043bb4b6842ba5572a4cf289a720b4044aeab5f
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Sat Apr 28 00:00:00 2018 +0000

    Preserve complete C type when applying array annotations.

 giscanner/maintransformer.py                                 |  1 +
 .../Regress.test_strv_out_container.page                     |  2 +-
 tests/scanner/Regress-1.0-expected.gir                       | 12 ++++++------
 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>


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