summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2008-10-02 13:15:09 +0000
committerDan Winship <danw@src.gnome.org>2008-10-02 13:15:09 +0000
commit1ab23b133ad9b48b9f67117f150026ff48daa927 (patch)
treef6345aac594765a01d82b875c3ebdf6e3f022a5b
parent4c510808d875abbc1c5933118e0fb0ac7a2ce9f7 (diff)
downloadgobject-introspection-1ab23b133ad9b48b9f67117f150026ff48daa927.tar.gz
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 svn path=/trunk/; revision=640
-rw-r--r--ChangeLog12
-rw-r--r--giscanner/utils.py4
-rw-r--r--tests/scanner/foo-expected.gir5
-rw-r--r--tests/scanner/foo.h7
4 files changed, 26 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1905c72b..c75133a7 100644
--- 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
diff --git a/giscanner/utils.py b/giscanner/utils.py
index c2f6e5d8..959ed830 100644
--- a/giscanner/utils.py
+++ b/giscanner/utils.py
@@ -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:]
diff --git a/tests/scanner/foo-expected.gir b/tests/scanner/foo-expected.gir
index 057c3a70..81158550 100644
--- a/tests/scanner/foo-expected.gir
+++ b/tests/scanner/foo-expected.gir
@@ -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"
diff --git a/tests/scanner/foo.h b/tests/scanner/foo.h
index d00eff37..3183c883 100644
--- a/tests/scanner/foo.h
+++ b/tests/scanner/foo.h
@@ -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;