summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-06-04 13:51:26 -0400
committerColin Walters <walters@verbum.org>2009-06-09 11:49:07 -0400
commitb23ca1ec2afeed3c5ab914c996c1dd73870ecab6 (patch)
treea188aacfb0b1ef5b058f07b352ea55b1371ba8de /giscanner
parent4a5c6543195963d9a09843d9b015dd9db3107798 (diff)
downloadgobject-introspection-b23ca1ec2afeed3c5ab914c996c1dd73870ecab6.tar.gz
Bug 584453 - Handle char ** correctly (and const variation)
This patch fixes our default handling of char **. We add Return node types as a case where we test for array handling. Remove the hardcoded assumption of array = "no transfer", just use the separate Parameter/Return cases. This change causes inout char ** to be transfer="full", but that seems more correct.
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/annotationparser.py5
-rw-r--r--giscanner/transformer.py6
2 files changed, 5 insertions, 6 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 5458ee17..8c901a25 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -560,6 +560,7 @@ class AnnotationApplier(object):
if (not isinstance(node, Field) and
(not has_element_type and
(node.direction is None
+ or isinstance(node, Return)
or node.direction == PARAM_DIRECTION_IN))):
if self._guess_array(node):
has_array = True
@@ -588,6 +589,7 @@ class AnnotationApplier(object):
container_type = Array(node.type.ctype,
element_type_name)
+ container_type.is_const = node.type.is_const
if OPT_ARRAY_ZERO_TERMINATED in array_values:
container_type.zeroterminated = array_values.get(
OPT_ARRAY_ZERO_TERMINATED) == '1'
@@ -724,12 +726,9 @@ class AnnotationApplier(object):
if node.transfer is not None:
return node.transfer
- if isinstance(node.type, Array):
- return PARAM_TRANSFER_NONE
# Anything with 'const' gets none
if node.type.is_const:
return PARAM_TRANSFER_NONE
-
elif node.type.name in [TYPE_NONE, TYPE_ANY]:
return PARAM_TRANSFER_NONE
elif isinstance(node.type, Varargs):
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index c0846065..88cbc150 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -475,9 +475,9 @@ class Transformer(object):
rettype.derefed_canonical = self._canonicalize_ctype(derefed_ctype)
canontype = type_name_from_ctype(ctype)
- if ((canontype == TYPE_STRING or
- source_type.type == CTYPE_POINTER) and
- source_type.base_type.type_qualifier & TYPE_QUALIFIER_CONST):
+ # Is it a const char * or a const gpointer?
+ if ((canontype == TYPE_STRING or source_type.type == CTYPE_POINTER) and
+ (source_type.base_type.type_qualifier & TYPE_QUALIFIER_CONST)):
rettype.is_const = True
return rettype