Skip to content

Commit 0be3c1c

Browse files
authored
Resolve some warnings about string comparisons (#1757)
1 parent 9aa48ff commit 0be3c1c

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Src/IronPython/Runtime/Operations/StringOps.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,7 @@ static CodecsInfo() {
20792079
#if DEBUG
20802080
foreach (KeyValuePair<string, Lazy<Encoding?>> kvp in d) {
20812081
// all codecs should be stored in lowercase because we only look up from lowercase strings
2082-
Debug.Assert(kvp.Key.ToLower(CultureInfo.InvariantCulture) == kvp.Key);
2082+
Debug.Assert(kvp.Key.Equals(kvp.Key, StringComparison.OrdinalIgnoreCase));
20832083
// all codec names should use underscores instead of dashes to match lookup values
20842084
Debug.Assert(kvp.Key.IndexOf('-') < 0);
20852085
}

Src/IronPythonTest/Util/IniParser.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ private static OptionStore Parse(IEnumerable<string> lines) {
7272

7373
if (string.IsNullOrEmpty(line)) continue;
7474

75-
if (line.StartsWith("[", StringComparison.Ordinal) && line.EndsWith("]", StringComparison.Ordinal)) {
75+
//if (line.StartsWith('[', StringComparison.Ordinal) && line.EndsWith(']', StringComparison.Ordinal)) {
76+
if (line.Length >= 2 && line[0] == '[' && line[line.Length - 1] == ']') {
7677
var sectionName = line.Substring(1, line.Length - 2);
7778
if (!options.TryGetValue(sectionName, out currentSection)) {
7879
currentSection = new Section();

0 commit comments

Comments
 (0)