diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2011-06-01 16:59:17 +0200 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2011-06-04 15:15:12 -0400 |
commit | 3e0292cd66752489d5b05bed57abffec0315b3ae (patch) | |
tree | 3b0c9e2cb1f8dde640e0525b2f6ad588000fe9c3 /tests/scanner | |
parent | 7c93dc9534a4de5599f574043dcb688b8443ebad (diff) | |
download | gobject-introspection-3e0292cd66752489d5b05bed57abffec0315b3ae.tar.gz |
Always add a zero-terminated attribute when it cannot be implied
g-ir-compiler assumes that an array is zero terminated when the
attribute is absent and there is no other attribute (length and
fixed-size), but g-ir-scanner only added the attribute when it is 0.
This means that an explicit zero-terminated=1 annotation would have
had no effect.
Fix that and at the same time ensure that all other arrays are not
zero-terminated by default.
https://bugzilla.gnome.org/show_bug.cgi?id=646635
Diffstat (limited to 'tests/scanner')
-rw-r--r-- | tests/scanner/Annotation-1.0-expected.gir | 18 | ||||
-rw-r--r-- | tests/scanner/Regress-1.0-expected.gir | 36 |
2 files changed, 28 insertions, 26 deletions
diff --git a/tests/scanner/Annotation-1.0-expected.gir b/tests/scanner/Annotation-1.0-expected.gir index a760a19a..f650c256 100644 --- a/tests/scanner/Annotation-1.0-expected.gir +++ b/tests/scanner/Annotation-1.0-expected.gir @@ -146,7 +146,7 @@ and/or use gtk-doc annotations. --> <parameters> <parameter name="nums" transfer-ownership="none"> <doc xml:whitespace="preserve">Sequence of numbers</doc> - <array c:type="int*"> + <array zero-terminated="0" c:type="int*"> <type name="gint" c:type="int"/> </array> </parameter> @@ -180,7 +180,7 @@ and/or use gtk-doc annotations. --> <parameters> <parameter name="nums" transfer-ownership="none"> <doc xml:whitespace="preserve">Sequence of numbers that are zero-terminated</doc> - <array length="1" c:type="int*"> + <array length="1" zero-terminated="1" c:type="int*"> <type name="gint" c:type="int"/> </array> </parameter> @@ -377,7 +377,7 @@ each string needs to be freed.</doc> caller-allocates="0" transfer-ownership="full"> <doc xml:whitespace="preserve">Argument vector</doc> - <array length="0" c:type="char***"> + <array length="0" zero-terminated="1" c:type="char***"> <type name="utf8" c:type="char**"/> </array> </parameter> @@ -391,7 +391,7 @@ each string needs to be freed.</doc> <parameters> <parameter name="data" transfer-ownership="none"> <doc xml:whitespace="preserve">The data</doc> - <array length="1" c:type="guchar*"> + <array length="1" zero-terminated="0" c:type="guchar*"> <type name="guint8" c:type="guchar"/> </array> </parameter> @@ -409,7 +409,7 @@ each string needs to be freed.</doc> <parameters> <parameter name="data" transfer-ownership="none"> <doc xml:whitespace="preserve">The data</doc> - <array length="1" c:type="gchar*"> + <array length="1" zero-terminated="0" c:type="gchar*"> <type name="gint8"/> </array> </parameter> @@ -428,7 +428,7 @@ type.</doc> <parameters> <parameter name="data" transfer-ownership="none"> <doc xml:whitespace="preserve">The data</doc> - <array length="1" c:type="gpointer"> + <array length="1" zero-terminated="0" c:type="gpointer"> <type name="guint8"/> </array> </parameter> @@ -687,7 +687,7 @@ detection, and fixing it via annotations.</doc> caller-allocates="0" transfer-ownership="full"> <doc xml:whitespace="preserve">The arguments.</doc> - <array length="0" c:type="char***"> + <array length="0" zero-terminated="0" c:type="char***"> <type name="utf8" c:type="char**"/> </array> </parameter> @@ -723,7 +723,7 @@ detection, and fixing it via annotations.</doc> <function name="return_array" c:identifier="annotation_return_array"> <return-value transfer-ownership="full"> <doc xml:whitespace="preserve">The return value</doc> - <array length="0" c:type="char**"> + <array length="0" zero-terminated="0" c:type="char**"> <type name="utf8"/> </array> </return-value> @@ -765,7 +765,7 @@ detection, and fixing it via annotations.</doc> <type name="guint" c:type="guint"/> </parameter> <parameter name="properties" transfer-ownership="none"> - <array length="0" c:type="gchar*"> + <array length="0" zero-terminated="0" c:type="gchar*"> <type name="utf8"/> </array> </parameter> diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index 6302579d..6c5fdec5 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -1104,12 +1104,14 @@ TpAccount::status-changed</doc> </array> </field> <field name="array2" writable="1"> - <array c:type="RegressTestStructB**" fixed-size="5"> + <array zero-terminated="0" + c:type="RegressTestStructB**" + fixed-size="5"> <type name="TestStructB" c:type="RegressTestStructB*"/> </array> </field> <field name="array3" writable="1"> - <array c:type="gpointer*"> + <array zero-terminated="0" c:type="gpointer*"> <type name="TestObj"/> </array> </field> @@ -1337,7 +1339,7 @@ TpAccount::status-changed</doc> <parameters> <parameter name="ints" transfer-ownership="none"> <doc xml:whitespace="preserve">a list of 5 integers</doc> - <array c:type="int*" fixed-size="5"> + <array zero-terminated="0" c:type="int*" fixed-size="5"> <type name="gint" c:type="int"/> </array> </parameter> @@ -1354,7 +1356,7 @@ TpAccount::status-changed</doc> caller-allocates="0" transfer-ownership="full"> <doc xml:whitespace="preserve">a list of 5 integers ranging from 0 to 4</doc> - <array c:type="int**" fixed-size="5"> + <array zero-terminated="0" c:type="int**" fixed-size="5"> <type name="gint" c:type="int*"/> </array> </parameter> @@ -1364,7 +1366,7 @@ TpAccount::status-changed</doc> c:identifier="regress_test_array_fixed_size_int_return"> <return-value transfer-ownership="full"> <doc xml:whitespace="preserve">a list of 5 integers ranging from 0 to 4</doc> - <array c:type="int*" fixed-size="5"> + <array zero-terminated="0" c:type="int*" fixed-size="5"> <type name="gint" c:type="int"/> </array> </return-value> @@ -1380,7 +1382,7 @@ TpAccount::status-changed</doc> </parameter> <parameter name="ints" transfer-ownership="none"> <doc xml:whitespace="preserve">List of ints</doc> - <array length="0" c:type="gint16*"> + <array length="0" zero-terminated="0" c:type="gint16*"> <type name="gint16" c:type="gint16"/> </array> </parameter> @@ -1397,7 +1399,7 @@ TpAccount::status-changed</doc> </parameter> <parameter name="ints" transfer-ownership="none"> <doc xml:whitespace="preserve">List of ints</doc> - <array length="0" c:type="gint32*"> + <array length="0" zero-terminated="0" c:type="gint32*"> <type name="gint32" c:type="gint32"/> </array> </parameter> @@ -1414,7 +1416,7 @@ TpAccount::status-changed</doc> </parameter> <parameter name="ints" transfer-ownership="none"> <doc xml:whitespace="preserve">List of ints</doc> - <array length="0" c:type="gint64*"> + <array length="0" zero-terminated="0" c:type="gint64*"> <type name="gint64" c:type="gint64"/> </array> </parameter> @@ -1431,7 +1433,7 @@ TpAccount::status-changed</doc> </parameter> <parameter name="ints" transfer-ownership="none"> <doc xml:whitespace="preserve">List of ints</doc> - <array length="0" c:type="gint8*"> + <array length="0" zero-terminated="0" c:type="gint8*"> <type name="gint8" c:type="gint8"/> </array> </parameter> @@ -1449,7 +1451,7 @@ TpAccount::status-changed</doc> </parameter> <parameter name="types" transfer-ownership="none"> <doc xml:whitespace="preserve">List of types</doc> - <array length="0" c:type="GType*"> + <array length="0" zero-terminated="0" c:type="GType*"> <type name="GType" c:type="GType"/> </array> </parameter> @@ -1459,7 +1461,7 @@ TpAccount::status-changed</doc> c:identifier="regress_test_array_int_full_out"> <return-value transfer-ownership="full"> <doc xml:whitespace="preserve">a new array of integers.</doc> - <array length="0" c:type="int*"> + <array length="0" zero-terminated="0" c:type="int*"> <type name="gint" c:type="int"/> </array> </return-value> @@ -1484,7 +1486,7 @@ TpAccount::status-changed</doc> </parameter> <parameter name="ints" transfer-ownership="none"> <doc xml:whitespace="preserve">List of ints</doc> - <array length="0" c:type="int*"> + <array length="0" zero-terminated="0" c:type="int*"> <type name="gint" c:type="int"/> </array> </parameter> @@ -1508,7 +1510,7 @@ TpAccount::status-changed</doc> caller-allocates="0" transfer-ownership="full"> <doc xml:whitespace="preserve">a list of integers whose items will be increased by 1, except the first that will be dropped</doc> - <array length="0" c:type="int**"> + <array length="0" zero-terminated="0" c:type="int**"> <type name="gint" c:type="int*"/> </array> </parameter> @@ -1518,7 +1520,7 @@ TpAccount::status-changed</doc> c:identifier="regress_test_array_int_none_out"> <return-value transfer-ownership="none"> <doc xml:whitespace="preserve">a static array of integers.</doc> - <array length="0" c:type="int*"> + <array length="0" zero-terminated="0" c:type="int*"> <type name="gint" c:type="int"/> </array> </return-value> @@ -1539,7 +1541,7 @@ TpAccount::status-changed</doc> </return-value> <parameters> <parameter name="arr" transfer-ownership="none" allow-none="1"> - <array length="1" c:type="int*"> + <array length="1" zero-terminated="0" c:type="int*"> <type name="gint" c:type="int"/> </array> </parameter> @@ -1560,7 +1562,7 @@ TpAccount::status-changed</doc> caller-allocates="0" transfer-ownership="full" allow-none="1"> - <array length="1" c:type="int**"> + <array length="1" zero-terminated="0" c:type="int**"> <type name="gint" c:type="int*"/> </array> </parameter> @@ -1591,7 +1593,7 @@ TpAccount::status-changed</doc> caller-allocates="0" transfer-ownership="full"> <doc xml:whitespace="preserve">a list of 5 integers, from 0 to 4 in consecutive order</doc> - <array length="0" c:type="int**"> + <array length="0" zero-terminated="0" c:type="int**"> <type name="gint" c:type="int*"/> </array> </parameter> |