diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh index 7c0bc9e4e1..973eb27149 100644 --- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh @@ -485,6 +485,7 @@ struct struct_definition_generator indent << scope_tab << "/// Get a hash code for this item.\n" << since_line << indent << scope_tab << "/// \n" + << "#pragma warning disable CA1307\n" << indent << scope_tab << "public override int GetHashCode()\n" << indent << scope_tab << "{\n" ).generate(sink, attributes::unused, context)) @@ -515,6 +516,7 @@ struct struct_definition_generator if (!as_generator( indent << scope_tab << "}\n" + << "#pragma warning restore CA1307\n\n" ).generate(sink, attributes::unused, context)) return false; diff --git a/src/bindings/mono/eina_mono/eina_error.cs b/src/bindings/mono/eina_mono/eina_error.cs index 6774545603..44528cc691 100644 --- a/src/bindings/mono/eina_mono/eina_error.cs +++ b/src/bindings/mono/eina_mono/eina_error.cs @@ -201,7 +201,7 @@ public struct Error : IComparable, IEquatable /// /// A hash code. public override int GetHashCode() - => code.GetHashCode() + Message.GetHashCode(); + => code.GetHashCode() + Message.GetHashCode(StringComparison.Ordinal); /// /// Compare to a given error. diff --git a/src/bindings/mono/eina_mono/eina_stringshare.cs b/src/bindings/mono/eina_mono/eina_stringshare.cs index a6ca53a02c..cfef948dc4 100644 --- a/src/bindings/mono/eina_mono/eina_stringshare.cs +++ b/src/bindings/mono/eina_mono/eina_stringshare.cs @@ -198,7 +198,7 @@ public class Stringshare : IEquatable, IEquatable /// public override int GetHashCode() { - return Str.GetHashCode(); + return Str.GetHashCode(StringComparison.Ordinal); } /// diff --git a/src/bindings/mono/eldbus_mono/eldbus_common.cs b/src/bindings/mono/eldbus_mono/eldbus_common.cs index b6306953a1..8d4a8ab991 100644 --- a/src/bindings/mono/eldbus_mono/eldbus_common.cs +++ b/src/bindings/mono/eldbus_mono/eldbus_common.cs @@ -92,7 +92,7 @@ public struct ObjectPath : IEquatable /// Since EFL 1.24. /// /// A hash code. - public override int GetHashCode() => value.GetHashCode(); + public override int GetHashCode() => value.GetHashCode(StringComparison.Ordinal); /// Returns whether this /// is equal to the given . @@ -185,7 +185,7 @@ public struct SignatureString : IEquatable /// Since EFL 1.24. /// /// A hash code. - public override int GetHashCode() => value.GetHashCode(); + public override int GetHashCode() => value.GetHashCode(StringComparison.Ordinal); /// Returns whether this /// is equal to the given . diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index 4e3e2e4486..c84433c23e 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -867,16 +867,17 @@ internal static class ClassRegister { throw new System.InvalidOperationException($"Could not get Native class name. Handle: {klass}"); } - +#pragma warning disable CA1307 string name = Eina.StringConversion.NativeUtf8ToManagedString(namePtr) - .Replace("_", ""); // Convert Efl C name to C# name + .Replace("_", ""); // Convert Efl C name to C# name +#pragma warning restore CA1307 // Check if this is an internal implementation of an abstract class var abstract_impl_suffix = "Realized"; - if (name.EndsWith(abstract_impl_suffix)) + if (name.EndsWith(abstract_impl_suffix, StringComparison.Ordinal)) { name = name.Substring(0, name.Length - abstract_impl_suffix.Length); - var lastDot = name.LastIndexOf("."); + var lastDot = name.LastIndexOf(".", StringComparison.Ordinal); var klassName = name.Substring(lastDot + 1); name += "+" + klassName + abstract_impl_suffix; // '+' is the separator for nested classes } @@ -885,7 +886,7 @@ internal static class ClassRegister var klass_type = Efl.Eo.Globals.efl_class_type_get(klass); if (klass_type == Efl.Eo.Globals.EflClassType.Interface || klass_type == Efl.Eo.Globals.EflClassType.Mixin) { - var pos = name.LastIndexOf("."); + var pos = name.LastIndexOf(".", StringComparison.Ordinal); name = name.Insert(pos + 1, "I"); // -1 if not found, inserts at 0 normally } diff --git a/src/bindings/mono/eo_mono/workaround.cs b/src/bindings/mono/eo_mono/workaround.cs index 107a7cd237..de8ab97efd 100644 --- a/src/bindings/mono/eo_mono/workaround.cs +++ b/src/bindings/mono/eo_mono/workaround.cs @@ -44,7 +44,7 @@ internal struct ClassDescription : IEquatable /// /// A hash code. public override int GetHashCode() - => version.GetHashCode() ^ name.GetHashCode() + => version.GetHashCode() ^ name.GetHashCode(StringComparison.Ordinal) ^ class_type ^ data_size.GetHashCode(); /// Returns whether this diff --git a/src/tests/efl_mono/Main.cs b/src/tests/efl_mono/Main.cs index 7829cf359f..5a9f93c290 100644 --- a/src/tests/efl_mono/Main.cs +++ b/src/tests/efl_mono/Main.cs @@ -24,8 +24,8 @@ class TestMain static Type[] GetTestCases(String name="") { return Assembly.GetExecutingAssembly().GetTypes().Where(t => String.Equals(t.Namespace, "TestSuite", StringComparison.Ordinal) && - t.Name.StartsWith("Test") && - t.Name.Contains(name)).ToArray(); + t.Name.StartsWith("Test", StringComparison.Ordinal) && + t.Name.Contains(name, StringComparison.Ordinal)).ToArray(); } static int Main(string[] args) @@ -45,7 +45,7 @@ class TestMain String ckRunSuite = Environment.GetEnvironmentVariable("CK_RUN_SUITE"); String ckRunCase = Environment.GetEnvironmentVariable("CK_RUN_CASE"); - if (ckRunSuite != null && !ckRunSuite.Equals("mono")) + if (ckRunSuite != null && !ckRunSuite.Equals("mono", StringComparison.Ordinal)) return 0; if (ckRunCase == null)