]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: handle multiple identifier-prefixes in namespaces
authorEvan Nemerson <evan@nemerson.com>
Sat, 31 May 2014 03:45:54 +0000 (20:45 -0700)
committerEvan Nemerson <evan@nemerson.com>
Sat, 31 May 2014 03:54:45 +0000 (20:54 -0700)
vala/valagirparser.vala

index 05a0703522936ae6c50c91aec0f98d8936ba5aac..5ac350e946cd4b4f682c0a50f8ccdbb464c80641 100644 (file)
@@ -678,8 +678,12 @@ public class Vala.GirParser : CodeVisitor {
                                return "";
                        }
                        var prefix = symbol.get_attribute_string ("CCode", "cprefix");
-                       if (prefix == null && girdata != null) {
+                       if (prefix == null && girdata != null && girdata["c:identifier-prefixes"] != null) {
                                prefix = girdata["c:identifier-prefixes"];
+                               int idx = prefix.index_of (",");
+                               if (idx != -1) {
+                                       prefix = prefix.substring (0, idx);
+                               }
                        }
                        if (prefix == null) {
                                if (symbol is Enum || symbol is ErrorDomain) {
@@ -1910,6 +1914,13 @@ public class Vala.GirParser : CodeVisitor {
                start_element ("namespace");
 
                string? cprefix = reader.get_attribute ("c:identifier-prefixes");
+               if (cprefix != null) {
+                       int idx = cprefix.index_of (",");
+                       if (idx != -1) {
+                               cprefix = cprefix.substring (0, idx);
+                       }
+               }
+
                string? lower_case_cprefix = reader.get_attribute ("c:symbol-prefixes");
                string vala_namespace = cprefix;
                string gir_namespace = reader.get_attribute ("name");