gobject-introspection r640 - in trunk: . giscanner tests/scanner



Author: danw
Date: Thu Oct  2 13:15:09 2008
New Revision: 640
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=640&view=rev

Log:
	Bug 554521: scanner generates wrong names for enum members with
	full type name prefix

	* giscanner/utils.py (strip_common_prefix): Fix this to strip the
	right amount when the entire "first" string is a prefix of
	"second"

	* tests/scanner/foo.h (FooEnumFullname):
	* tests/scanner/foo-expected.gir: test that


Modified:
   trunk/ChangeLog
   trunk/giscanner/utils.py
   trunk/tests/scanner/foo-expected.gir
   trunk/tests/scanner/foo.h

Modified: trunk/giscanner/utils.py
==============================================================================
--- trunk/giscanner/utils.py	(original)
+++ trunk/giscanner/utils.py	Thu Oct  2 13:15:09 2008
@@ -59,5 +59,5 @@
     second = second.replace('_', '')
     for i, c in enumerate(first.upper()):
         if i >= len(second) or c != second[i]:
-            break
-    return second[i:]
+            return second[i:]
+    return second[i + 1:]

Modified: trunk/tests/scanner/foo-expected.gir
==============================================================================
--- trunk/tests/scanner/foo-expected.gir	(original)
+++ trunk/tests/scanner/foo-expected.gir	Thu Oct  2 13:15:09 2008
@@ -245,6 +245,11 @@
       <member name="deux" value="2" c:identifier="FOO_ENUM_DEUX"/>
       <member name="trois" value="3" c:identifier="FOO_ENUM_TROIS"/>
     </enumeration>
+    <enumeration name="EnumFullname" c:type="FooEnumFullname">
+      <member name="one" value="1" c:identifier="FOO_ENUM_FULLNAME_ONE"/>
+      <member name="two" value="2" c:identifier="FOO_ENUM_FULLNAME_TWO"/>
+      <member name="three" value="3" c:identifier="FOO_ENUM_FULLNAME_THREE"/>
+    </enumeration>
     <record name="Boxed"
             c:type="FooBoxed"
             glib:type-name="FooBoxed"

Modified: trunk/tests/scanner/foo.h
==============================================================================
--- trunk/tests/scanner/foo.h	(original)
+++ trunk/tests/scanner/foo.h	Thu Oct  2 13:15:09 2008
@@ -106,6 +106,13 @@
 
 GType foo_flags_type_get_type (void);
 
+typedef enum
+{
+  FOO_ENUM_FULLNAME_ONE = 1,
+  FOO_ENUM_FULLNAME_TWO,
+  FOO_ENUM_FULLNAME_THREE
+} FooEnumFullname;
+
 typedef struct _FooBoxed FooBoxed;
 
 GType                 foo_boxed_get_type       (void) G_GNUC_CONST;



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