Bug 556323 – transfer-ownership is wrong for functions returning const
authorJohan Bilien <jobi@via.ecp.fr>
Tue, 14 Oct 2008 22:51:28 +0000 (22:51 +0000)
committerJohan Bilien <jobi@src.gnome.org>
Tue, 14 Oct 2008 22:51:28 +0000 (22:51 +0000)
2008-10-14  Johan Bilien  <jobi@via.ecp.fr>

Bug 556323 – transfer-ownership is wrong for functions returning const
char *

* giscanner/transformer.py: check for a const string as return value,
not just const char*. Suggested by Colin Walters
* tests/scanner/annotation-1.0-expected.gir: updated expected output

svn path=/trunk/; revision=707

ChangeLog
giscanner/transformer.py
tests/scanner/annotation-1.0-expected.gir

index eddb0a2..0ec9153 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-10-14  Johan Bilien  <jobi@via.ecp.fr>
+
+       Bug 556323 – transfer-ownership is wrong for functions returning const
+       char *
+
+       * giscanner/transformer.py: check for a const string as return value,
+       not just const char*. Suggested by Colin Walters
+       * tests/scanner/annotation-1.0-expected.gir: updated expected output
+
 2008-10-14  Johan Bilien  <jobi@via.ecp.fr>
 
        * girepository/ginfo.c, girepository/girepository.h: add
index 987221b..9418195 100644 (file)
@@ -25,7 +25,7 @@ from giscanner.ast import (Callback, Enum, Function, Namespace, Member,
                            Parameter, Return, Array, Struct, Field,
                            Type, Alias, Interface, Class, Node, Union,
                            List, Map, Varargs, Constant, type_name_from_ctype,
-                           type_names, default_array_types)
+                           type_names, default_array_types, TYPE_STRING)
 from giscanner.config import DATADIR
 from .glibast import GLibBoxed
 from giscanner.sourcescanner import (
@@ -396,7 +396,7 @@ class Transformer(object):
         resolved_type_name = self._parse_ctype(ctype)
 
         # string memory management
-        if ctype == 'char*':
+        if type_name_from_ctype(ctype) == TYPE_STRING:
             if source_type.base_type.type_qualifier & TYPE_QUALIFIER_CONST:
                 options['transfer'] = ['none']
             else:
index 19c1d88..fb16ff0 100644 (file)
@@ -38,7 +38,7 @@
           <type name="GObject.Object" c:type="GObject*"/>
         </return-value>
         <parameters>
-          <parameter name="somearg" allow-none="1">
+          <parameter name="somearg" transfer-ownership="full" allow-none="1">
             <type name="utf8" c:type="gchar*"/>
           </parameter>
         </parameters>