From 2206305cf87ec65f34977cca33e908f3faa27834 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Thu, 14 Oct 2010 20:47:27 +0000 Subject: [PATCH] Fixed enum comparison logic to compare the values of the relevant attributes instead of the attributes themselves. --- Source/Converter/Main.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/Converter/Main.cs b/Source/Converter/Main.cs index a09a7d53..9bb97fd4 100644 --- a/Source/Converter/Main.cs +++ b/Source/Converter/Main.cs @@ -36,7 +36,9 @@ namespace CHeaderToXML { public bool Equals (XNode a, XNode b) { - return ((XElement) a).Attribute("name").Equals(((XElement) b).Attribute("name")); + var a_attr = ((XElement)a).Attribute("name") ?? ((XElement)a).Attribute("token"); + var b_attr = ((XElement)b).Attribute("name") ?? ((XElement)b).Attribute("token"); + return a_attr.Value == b_attr.Value; } public int GetHashCode (XNode a) @@ -44,11 +46,11 @@ namespace CHeaderToXML XElement e = (XElement)a; if (e.Name == "enum" || e.Name == "token") { - return ((XElement)a).Attribute("name").GetHashCode(); + return ((XElement)a).Attribute("name").Value.GetHashCode(); } else if (e.Name == "use") { - return ((XElement)a).Attribute("token").GetHashCode(); + return ((XElement)a).Attribute("token").Value.GetHashCode(); } else { @@ -112,7 +114,7 @@ namespace CHeaderToXML type == HeaderType.Spec ? new GLParser { Prefix = prefix, Version = version } : (Parser)null; - var sigs = headers.Select(h => parser.Parse(h)); + var sigs = headers.Select(h => parser.Parse(h)).ToList(); // Merge any duplicate enum entries (in case an enum is declared // in multiple files with different entries in each file).