From: Sebastian Dröge Date: Sat, 4 Apr 2009 11:37:12 +0000 (+0200) Subject: Optimize gst-gapi-cleanup a bit X-Git-Tag: 1.19.3~483^2~776 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7aa8b985109cde6e92e7960d1bd6f9a985897ac5;p=platform%2Fupstream%2Fgstreamer.git Optimize gst-gapi-cleanup a bit --- diff --git a/fixup/gst-gapi-fixup.cs b/fixup/gst-gapi-fixup.cs index 87e017f..d8810c8 100644 --- a/fixup/gst-gapi-fixup.cs +++ b/fixup/gst-gapi-fixup.cs @@ -167,11 +167,8 @@ namespace GtkSharp.Parsing { bool matched = false; while (api_iter.MoveNext ()) { XmlElement node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement; - XmlAttribute attr = node.Attributes[name]; - Console.WriteLine (attr); - if (attr != null) - node.Attributes.Remove (attr); + node.RemoveAttribute (name); matched = true; } if (!matched) diff --git a/gtk-sharp-gapi-fixup.diff b/gtk-sharp-gapi-fixup.diff deleted file mode 100644 index 513c945..0000000 --- a/gtk-sharp-gapi-fixup.diff +++ /dev/null @@ -1,59 +0,0 @@ -Index: parser/gapi-fixup.cs -=================================================================== ---- parser/gapi-fixup.cs (revision 60863) -+++ parser/gapi-fixup.cs (working copy) -@@ -136,6 +136,21 @@ - Console.WriteLine ("Warning: matched no nodes", path); - } - -+ XPathNodeIterator remove_attr_iter = meta_nav.Select ("/metadata/remove-attr"); -+ while (remove_attr_iter.MoveNext ()) { -+ string path = remove_attr_iter.Current.GetAttribute ("path", ""); -+ string attr_name = remove_attr_iter.Current.GetAttribute ("name", ""); -+ XPathNodeIterator api_iter = api_nav.Select (path); -+ bool matched = false; -+ while (api_iter.MoveNext ()) { -+ XmlElement node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement; -+ node.RemoveAttribute (attr_name); -+ matched = true; -+ } -+ if (!matched) -+ Console.WriteLine ("Warning: matched no nodes", path); -+ } -+ - XPathNodeIterator move_iter = meta_nav.Select ("/metadata/move-node"); - while (move_iter.MoveNext ()) { - string path = move_iter.Current.GetAttribute ("path", ""); -@@ -157,6 +172,32 @@ - Console.WriteLine ("Warning: matched no nodes", path); - } - -+ XPathNodeIterator change_iter = meta_nav.Select ("/metadata/change-node-type"); -+ while (change_iter.MoveNext ()) { -+ string path = change_iter.Current.GetAttribute ("path", ""); -+ XPathNodeIterator api_iter = api_nav.Select (path); -+ bool matched = false; -+ while (api_iter.MoveNext ()) { -+ XmlElement node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement; -+ XmlElement new_node = api_doc.CreateElement (change_iter.Current.Value); -+ foreach (XmlNode child in node.ChildNodes) -+ { -+ XmlNode new_child = child.CloneNode (true); -+ new_node.AppendChild (new_child); -+ } -+ -+ foreach (XmlAttribute attr in node.Attributes) -+ { -+ new_node.SetAttribute (attr.Name, attr.Value); -+ } -+ -+ node.ParentNode.ReplaceChild (new_node, node); -+ matched = true; -+ } -+ if (!matched) -+ Console.WriteLine ("Warning: matched no nodes", path); -+ } -+ - if (symbol_doc != null) { - XPathNavigator symbol_nav = symbol_doc.CreateNavigator (); - XPathNodeIterator iter = symbol_nav.Select ("/api/*");