diff options
author | Bruno da Silva Belo <bruno.belo@expertisesolutions.com.br> | 2019-11-20 16:57:14 -0300 |
---|---|---|
committer | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2019-11-20 17:47:44 -0300 |
commit | 6772a78d0238ee5fbc04126e9de26c4201e3ef57 (patch) | |
tree | 25f5385b518b710f6165cc89bc0f01c5f89e8621 /src/bindings | |
parent | 9f67ad59b0cf52fb2fe949c22c366229b4a64409 (diff) | |
download | efl-6772a78d0238ee5fbc04126e9de26c4201e3ef57.tar.gz |
csharp: Specifying StringComparison.
Summary: ref T8405
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi
Reviewed By: lauromoura
Subscribers: segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8405
Differential Revision: https://phab.enlightenment.org/D10650
Diffstat (limited to 'src/bindings')
-rw-r--r-- | src/bindings/mono/eina_mono/eina_error.cs | 2 | ||||
-rw-r--r-- | src/bindings/mono/eina_mono/eina_stringshare.cs | 2 | ||||
-rw-r--r-- | src/bindings/mono/eldbus_mono/eldbus_common.cs | 4 | ||||
-rw-r--r-- | src/bindings/mono/eo_mono/iwrapper.cs | 11 | ||||
-rw-r--r-- | src/bindings/mono/eo_mono/workaround.cs | 2 |
5 files changed, 11 insertions, 10 deletions
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<Error>, IEquatable<Error> /// </summary> /// <returns>A hash code.</returns> public override int GetHashCode() - => code.GetHashCode() + Message.GetHashCode(); + => code.GetHashCode() + Message.GetHashCode(StringComparison.Ordinal); /// <summary> /// 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<Stringshare>, IEquatable<string> /// </returns> public override int GetHashCode() { - return Str.GetHashCode(); + return Str.GetHashCode(StringComparison.Ordinal); } /// <summary> 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<ObjectPath> /// <para>Since EFL 1.24.</para> /// </summary> /// <returns>A hash code.</returns> - public override int GetHashCode() => value.GetHashCode(); + public override int GetHashCode() => value.GetHashCode(StringComparison.Ordinal); /// <summary>Returns whether this <see cref="ObjectPath" /> /// is equal to the given <see cref="object" />. @@ -185,7 +185,7 @@ public struct SignatureString : IEquatable<SignatureString> /// <para>Since EFL 1.24.</para> /// </summary> /// <returns>A hash code.</returns> - public override int GetHashCode() => value.GetHashCode(); + public override int GetHashCode() => value.GetHashCode(StringComparison.Ordinal); /// <summary>Returns whether this <see cref="SignatureString" /> /// is equal to the given <see cref="object" />. 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<ClassDescription> /// </summary> /// <returns>A hash code.</returns> public override int GetHashCode() - => version.GetHashCode() ^ name.GetHashCode() + => version.GetHashCode() ^ name.GetHashCode(StringComparison.Ordinal) ^ class_type ^ data_size.GetHashCode(); /// <summary>Returns whether this <see cref="ClassDescription" /> |