diff options
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/girwriter.py | 6 | ||||
-rw-r--r-- | giscanner/maintransformer.py | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index ad601eeb..4a6c47e0 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -278,8 +278,14 @@ and/or use gtk-doc annotations. ''') elif isinstance(ntype, ast.Array): if ntype.array_type != ast.Array.C: attrs.insert(0, ('name', ntype.array_type)) + # we insert an explicit 'zero-terminated' attribute + # when it is false, or when it would not be implied + # by the absence of length and fixed-size if not ntype.zeroterminated: attrs.insert(0, ('zero-terminated', '0')) + elif (ntype.zeroterminated + and (ntype.size is not None or ntype.length_param_name is not None)): + attrs.insert(0, ('zero-terminated', '1')) if ntype.size is not None: attrs.append(('fixed-size', '%d' % (ntype.size, ))) if ntype.length_param_name is not None: diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index dd20af1e..fd0cc6c6 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -346,6 +346,8 @@ usage is void (*_gtk_reserved1)(void);""" if OPT_ARRAY_ZERO_TERMINATED in array_values: container_type.zeroterminated = array_values.get( OPT_ARRAY_ZERO_TERMINATED) == '1' + else: + container_type.zeroterminated = False length = array_values.get(OPT_ARRAY_LENGTH) if length is not None: paramname = self._get_validate_parameter_name(parent, length, node) |