Skip to content

Commit 27c9947

Browse files
committed
Replaced "InvariantCulture" with "Ordinal".
For our cases, it does not really matter, but using InvariantCulture makes no real sense. We don't want any linguistic rules being applied.
1 parent cbefdd8 commit 27c9947

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

VSDoxyHighlighter/CommentParser.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -895,21 +895,24 @@ private bool CiteOptionsValidator(int fragmentIndex, string fragmentText)
895895
string textWithinBraces = fragmentText.Substring(1, fragmentText.Length - 2);
896896

897897
// Doxygen always uses a comma to separate the options, ignores whitespace and compares case-insensitively.
898-
var options = textWithinBraces.Split(',').Select(o => o.Trim().ToLower(CultureInfo.InvariantCulture));
898+
var options = textWithinBraces.Split(',').Select(o => o.Trim());
899899

900900
bool foundMutuallyExclusiveOption = false;
901901
foreach (string option in options) {
902902
if (option.Length == 0) {
903903
continue; // Doxygen silently ignores empty entries.
904904
}
905905
// https://www.doxygen.nl/manual/commands.html#cmdcite
906-
if (option == "number" || option == "shortauthor" || option == "year") {
906+
if (option.Equals("number", StringComparison.OrdinalIgnoreCase)
907+
|| option.Equals("shortauthor", StringComparison.OrdinalIgnoreCase)
908+
|| option.Equals("year", StringComparison.OrdinalIgnoreCase)) {
907909
if (foundMutuallyExclusiveOption) {
908910
return false; // No syntax highlighting if multiple mutually exclusive options are found.
909911
}
910912
foundMutuallyExclusiveOption = true;
911913
}
912-
else if (option != "nopar" && option != "nocite") {
914+
else if (!option.Equals("nopar", StringComparison.OrdinalIgnoreCase)
915+
&& !option.Equals("nocite", StringComparison.OrdinalIgnoreCase)) {
913916
// Don't provide syntax highlighting for unknown options, even though Doxygen ignores them,
914917
// so that the user realizes the mistake.
915918
return false;
@@ -988,7 +991,7 @@ private int FindNextBacktickFragmentEnd(string text, int startMarkerStartIdx, in
988991
int startMarkerLength = startMarkerEndIdx - startMarkerStartIdx;
989992
Debug.Assert(startMarkerLength > 0);
990993
string endMarkerStr = new string('`', startMarkerLength);
991-
int endMarkerStartIdx = text.IndexOf(endMarkerStr, startMarkerEndIdx, StringComparison.InvariantCulture);
994+
int endMarkerStartIdx = text.IndexOf(endMarkerStr, startMarkerEndIdx, StringComparison.Ordinal);
992995
if (endMarkerStartIdx < 0) {
993996
return -1;
994997
}

VSDoxyHighlighter/DoxygenCommands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ int CompareConfigs(DoxygenCommandInConfig c1, DoxygenCommandInConfig c2)
375375
bool isLetter1 = char.IsLetter(c1.Command[0]);
376376
bool isLetter2 = char.IsLetter(c2.Command[0]);
377377
if ((isLetter1 && isLetter2) || (!isLetter1 && !isLetter2)) {
378-
return string.Compare(c1.Command, c2.Command, StringComparison.InvariantCulture);
378+
return string.Compare(c1.Command, c2.Command, StringComparison.Ordinal);
379379
}
380380
else if (isLetter1) {
381381
return -1;

VSDoxyHighlighter/FragmentsMatcherMarkdownEmphasis.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ private static (int endEmphasisStartIdx, int endEmphasisEndIdx) FindEmphasisEnd(
265265
{
266266
while (searchStartIdx < searchEndIdx) {
267267
Debug.Assert(searchStartIdx >= 0);
268-
int endEmphasisStartIdx = text.IndexOf(emphasisMarker, searchStartIdx, StringComparison.InvariantCulture);
268+
int endEmphasisStartIdx = text.IndexOf(emphasisMarker, searchStartIdx, StringComparison.Ordinal);
269269
if (endEmphasisStartIdx < 0 || endEmphasisStartIdx >= searchEndIdx) {
270270
return (-1, -1);
271271
}

0 commit comments

Comments
 (0)