Bug 554521: scanner generates wrong names for enum members with
authorDan Winship <danw@src.gnome.org>
Thu, 2 Oct 2008 13:15:09 +0000 (13:15 +0000)
committerDan Winship <danw@src.gnome.org>
Thu, 2 Oct 2008 13:15:09 +0000 (13:15 +0000)
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

svn path=/trunk/; revision=640

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

index 1905c72..c75133a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-09-30  Dan Winship  <danw@gnome.org>
+
+       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
+
 2008-09-29  Colin Walters  <walters@verbum.org>
 
        Bug 552380: Array parameters should be marked in the gir
index c2f6e5d..959ed83 100644 (file)
@@ -59,5 +59,5 @@ def strip_common_prefix(first, second):
     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:]
index 057c3a7..8115855 100644 (file)
       <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"
index d00eff3..3183c88 100644 (file)
@@ -106,6 +106,13 @@ typedef enum
 
 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;