From: JCWasmx86 Date: Sun, 5 Jun 2022 12:40:07 +0000 (+0200) Subject: Ignore duplicate standard interfaces X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec09b6d139ea06e75d610b0611ab29503a995a13;p=thirdparty%2Fvala.git Ignore duplicate standard interfaces --- diff --git a/dbusgen/valadbusparser.vala b/dbusgen/valadbusparser.vala index 5eda72861..3d7a76869 100644 --- a/dbusgen/valadbusparser.vala +++ b/dbusgen/valadbusparser.vala @@ -151,6 +151,18 @@ public class Vala.DBusParser : CodeVisitor { } string iface_name = namespace_strategy.get_name (name); + + foreach (var iface in current_ns.get_interfaces ()) { + // The default interfaces can occur duplicated + if ((iface_name == namespace_strategy.get_name ("org.freedesktop.DBus.Peer") + || iface_name == namespace_strategy.get_name ("org.freedesktop.DBus.Introspectable") + || iface_name == namespace_strategy.get_name ("org.freedesktop.DBus.Properties") + || iface_name == namespace_strategy.get_name ("org.freedesktop.DBus.ObjectManager")) && iface.name == iface_name) { + next (); + seek_end ("interface"); + return; + } + } current_node = current_iface = new Interface (iface_name, get_current_src ()); current_iface.access = SymbolAccessibility.PUBLIC; @@ -619,6 +631,16 @@ public class Vala.DBusParser : CodeVisitor { next (); } + private void seek_end (string name) { + while (current_token != MarkupTokenType.END_ELEMENT || reader.name != name) { + skip_element (); + if (current_token == MarkupTokenType.EOF) { + return; + } + } + next (); + } + private SourceReference get_current_src () { return new SourceReference (current_source_file, begin, end); } diff --git a/dbusgen/valadbusvariantmodule.vala b/dbusgen/valadbusvariantmodule.vala index 404f7bb40..436329684 100644 --- a/dbusgen/valadbusvariantmodule.vala +++ b/dbusgen/valadbusvariantmodule.vala @@ -202,14 +202,12 @@ public class Vala.DBusVariantModule { } } else { var element_type = get_variant_type (element); - if (element != null && !(element_type is ArrayType)) { + if (element != null && !(element_type is ArrayType) && element_type != null) { var array = new ArrayType (element_type, 1, null); array.value_owned = true; return array; } } - } else if (type.equal (VariantType.TUPLE)) { - // TODO: Emit structure } if (!skipped_generation) {