diff options
author | Ahson Khan <ahkha@microsoft.com> | 2018-02-22 08:02:20 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-22 08:02:21 -0800 |
commit | 9e7ec667bd2871970b127fda856b0c6cf3eb2060 (patch) | |
tree | 3722062de178d4982a8828ba57b1d125173cbbb6 | |
parent | c36b282a16237423d8c8a3c6f3abc13b52c36c68 (diff) | |
download | coreclr-9e7ec667bd2871970b127fda856b0c6cf3eb2060.tar.gz coreclr-9e7ec667bd2871970b127fda856b0c6cf3eb2060.tar.bz2 coreclr-9e7ec667bd2871970b127fda856b0c6cf3eb2060.zip |
Fix impl of ReadOnlySpan ToLower/ToUpper for Unix. (#16496)
-rw-r--r-- | src/mscorlib/shared/System/Globalization/TextInfo.Unix.cs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mscorlib/shared/System/Globalization/TextInfo.Unix.cs b/src/mscorlib/shared/System/Globalization/TextInfo.Unix.cs index 5186394df0..d13d3e8cee 100644 --- a/src/mscorlib/shared/System/Globalization/TextInfo.Unix.cs +++ b/src/mscorlib/shared/System/Globalization/TextInfo.Unix.cs @@ -81,24 +81,26 @@ namespace System.Globalization { if (IsAsciiCasingSameAsInvariant) { - int length = source.Length; + int length = 0; char* a = pSource, b = pResult; if (toUpper) { - while (length-- != 0 && *a < 0x80) + while (length < source.Length && *a < 0x80) { *b++ = ToUpperAsciiInvariant(*a++); + length++; } } else { - while (length-- != 0 && *a < 0x80) + while (length < source.Length && *a < 0x80) { *b++ = ToLowerAsciiInvariant(*a++); + length++; } } - if (length != 0) + if (length != source.Length) { ChangeCase(a, source.Length - length, b, destination.Length - length, toUpper); } |