summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLevi Broderick <levib@microsoft.com>2019-04-10 16:51:30 -0700
committerLevi Broderick <levib@microsoft.com>2019-04-10 16:51:30 -0700
commit60b8c4f69b70c6d94893fd075c53e49e62777467 (patch)
tree4de9f50e2864475ac4cd45d7eadd154e080231e4 /src
parent6cc74a9d209a27c0fccf3e4c90c46c8df67a61fa (diff)
downloadcoreclr-60b8c4f69b70c6d94893fd075c53e49e62777467.tar.gz
coreclr-60b8c4f69b70c6d94893fd075c53e49e62777467.tar.bz2
coreclr-60b8c4f69b70c6d94893fd075c53e49e62777467.zip
Rename DWORD -> UInt32 throughout API surface
Diffstat (limited to 'src')
-rw-r--r--src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Helpers.cs36
-rw-r--r--src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Transcoding.cs36
-rw-r--r--src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Validation.cs18
3 files changed, 45 insertions, 45 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Helpers.cs b/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Helpers.cs
index 33aa664cd7..b1199229d8 100644
--- a/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Helpers.cs
+++ b/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Helpers.cs
@@ -18,13 +18,13 @@ namespace System.Text.Unicode
/// returns <see langword="true"/> iff the first two bytes of the buffer are
/// an overlong representation of a sequence that should be represented as one byte.
/// This method *does not* validate that the sequence matches the appropriate
- /// 2-byte sequence mask (see <see cref="DWordBeginsWithUtf8TwoByteMask"/>).
+ /// 2-byte sequence mask (see <see cref="UInt32BeginsWithUtf8TwoByteMask"/>).
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordBeginsWithOverlongUtf8TwoByteSequence(uint value)
+ private static bool UInt32BeginsWithOverlongUtf8TwoByteSequence(uint value)
{
// ASSUMPTION: Caller has already checked the '110yyyyy 10xxxxxx' mask of the input.
- Debug.Assert(DWordBeginsWithUtf8TwoByteMask(value));
+ Debug.Assert(UInt32BeginsWithUtf8TwoByteMask(value));
// Per Table 3-7, first byte of two-byte sequence must be within range C2 .. DF.
// Since we already validated it's 80 <= ?? <= DF (per mask check earlier), now only need
@@ -44,7 +44,7 @@ namespace System.Text.Unicode
/// still perform overlong form or out-of-range checking.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordBeginsWithUtf8FourByteMask(uint value)
+ private static bool UInt32BeginsWithUtf8FourByteMask(uint value)
{
// The code in this method is equivalent to the code
// below but is slightly more optimized.
@@ -76,7 +76,7 @@ namespace System.Text.Unicode
/// overlong form or surrogate checking.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordBeginsWithUtf8ThreeByteMask(uint value)
+ private static bool UInt32BeginsWithUtf8ThreeByteMask(uint value)
{
// The code in this method is equivalent to the code
// below but is slightly more optimized.
@@ -108,7 +108,7 @@ namespace System.Text.Unicode
/// overlong form checking.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordBeginsWithUtf8TwoByteMask(uint value)
+ private static bool UInt32BeginsWithUtf8TwoByteMask(uint value)
{
// The code in this method is equivalent to the code
// below but is slightly more optimized.
@@ -137,13 +137,13 @@ namespace System.Text.Unicode
/// returns <see langword="true"/> iff the first two bytes of the buffer are
/// an overlong representation of a sequence that should be represented as one byte.
/// This method *does not* validate that the sequence matches the appropriate
- /// 2-byte sequence mask (see <see cref="DWordBeginsWithUtf8TwoByteMask"/>).
+ /// 2-byte sequence mask (see <see cref="UInt32BeginsWithUtf8TwoByteMask"/>).
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordEndsWithOverlongUtf8TwoByteSequence(uint value)
+ private static bool UInt32EndsWithOverlongUtf8TwoByteSequence(uint value)
{
// ASSUMPTION: Caller has already checked the '110yyyyy 10xxxxxx' mask of the input.
- Debug.Assert(DWordEndsWithUtf8TwoByteMask(value));
+ Debug.Assert(UInt32EndsWithUtf8TwoByteMask(value));
// Per Table 3-7, first byte of two-byte sequence must be within range C2 .. DF.
// We already validated that it's 80 .. DF (per mask check earlier).
@@ -166,7 +166,7 @@ namespace System.Text.Unicode
/// overlong form checking.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordEndsWithUtf8TwoByteMask(uint value)
+ private static bool UInt32EndsWithUtf8TwoByteMask(uint value)
{
// The code in this method is equivalent to the code
// below but is slightly more optimized.
@@ -197,7 +197,7 @@ namespace System.Text.Unicode
/// single operation. Returns <see langword="false"/> if running on a big-endian machine.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordBeginsWithValidUtf8TwoByteSequenceLittleEndian(uint value)
+ private static bool UInt32BeginsWithValidUtf8TwoByteSequenceLittleEndian(uint value)
{
// Per Table 3-7, valid 2-byte sequences are [ C2..DF ] [ 80..BF ].
// In little-endian, that would be represented as:
@@ -222,9 +222,9 @@ namespace System.Text.Unicode
/// single operation. Returns <see langword="false"/> if running on a big-endian machine.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordEndsWithValidUtf8TwoByteSequenceLittleEndian(uint value)
+ private static bool UInt32EndsWithValidUtf8TwoByteSequenceLittleEndian(uint value)
{
- // See comments in DWordBeginsWithValidUtf8TwoByteSequenceLittleEndian.
+ // See comments in UInt32BeginsWithValidUtf8TwoByteSequenceLittleEndian.
Debug.Assert(BitConverter.IsLittleEndian);
@@ -239,7 +239,7 @@ namespace System.Text.Unicode
/// returns <see langword="true"/> iff the first byte of the buffer is ASCII.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordFirstByteIsAscii(uint value)
+ private static bool UInt32FirstByteIsAscii(uint value)
{
// Return statement is written this way to work around https://github.com/dotnet/coreclr/issues/914.
@@ -252,7 +252,7 @@ namespace System.Text.Unicode
/// returns <see langword="true"/> iff the fourth byte of the buffer is ASCII.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordFourthByteIsAscii(uint value)
+ private static bool UInt32FourthByteIsAscii(uint value)
{
// Return statement is written this way to work around https://github.com/dotnet/coreclr/issues/914.
@@ -265,7 +265,7 @@ namespace System.Text.Unicode
/// returns <see langword="true"/> iff the second byte of the buffer is ASCII.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordSecondByteIsAscii(uint value)
+ private static bool UInt32SecondByteIsAscii(uint value)
{
// Return statement is written this way to work around https://github.com/dotnet/coreclr/issues/914.
@@ -278,7 +278,7 @@ namespace System.Text.Unicode
/// returns <see langword="true"/> iff the third byte of the buffer is ASCII.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool DWordThirdByteIsAscii(uint value)
+ private static bool UInt32ThirdByteIsAscii(uint value)
{
// Return statement is written this way to work around https://github.com/dotnet/coreclr/issues/914.
@@ -316,7 +316,7 @@ namespace System.Text.Unicode
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static uint ExtractCharFromFirstTwoByteSequence(uint value)
{
- Debug.Assert(DWordBeginsWithUtf8TwoByteMask(value) && !DWordBeginsWithOverlongUtf8TwoByteSequence(value));
+ Debug.Assert(UInt32BeginsWithUtf8TwoByteMask(value) && !UInt32BeginsWithOverlongUtf8TwoByteSequence(value));
if (BitConverter.IsLittleEndian)
{
diff --git a/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Transcoding.cs b/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Transcoding.cs
index ec7dae57d9..2baee48024 100644
--- a/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Transcoding.cs
+++ b/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Transcoding.cs
@@ -161,7 +161,7 @@ namespace System.Text.Unicode
// Next, try stripping off ASCII bytes one at a time.
// We only handle up to three ASCII bytes here since we handled the four ASCII byte case above.
- if (DWordFirstByteIsAscii(thisDWord))
+ if (UInt32FirstByteIsAscii(thisDWord))
{
if (outputCharsRemaining >= 3)
{
@@ -173,13 +173,13 @@ namespace System.Text.Unicode
nuint adjustment = 1;
pOutputBuffer[0] = (char)(byte)thisDWordLittleEndian;
- if (DWordSecondByteIsAscii(thisDWord))
+ if (UInt32SecondByteIsAscii(thisDWord))
{
adjustment++;
thisDWordLittleEndian >>= 8;
pOutputBuffer[1] = (char)(byte)thisDWordLittleEndian;
- if (DWordThirdByteIsAscii(thisDWord))
+ if (UInt32ThirdByteIsAscii(thisDWord))
{
adjustment++;
thisDWordLittleEndian >>= 8;
@@ -207,7 +207,7 @@ namespace System.Text.Unicode
*pOutputBuffer++ = (char)(byte)thisDWordLittleEndian;
outputCharsRemaining--;
- if (DWordSecondByteIsAscii(thisDWord))
+ if (UInt32SecondByteIsAscii(thisDWord))
{
if (outputCharsRemaining == 0)
{
@@ -230,7 +230,7 @@ namespace System.Text.Unicode
Debug.Assert(outputCharsRemaining == 1);
- if (DWordThirdByteIsAscii(thisDWord))
+ if (UInt32ThirdByteIsAscii(thisDWord))
{
goto OutputBufferTooSmall;
}
@@ -263,12 +263,12 @@ namespace System.Text.Unicode
// Check the 2-byte case.
- if (DWordBeginsWithUtf8TwoByteMask(thisDWord))
+ if (UInt32BeginsWithUtf8TwoByteMask(thisDWord))
{
// Per Table 3-7, valid sequences are:
// [ C2..DF ] [ 80..BF ]
- if (DWordBeginsWithOverlongUtf8TwoByteSequence(thisDWord))
+ if (UInt32BeginsWithOverlongUtf8TwoByteSequence(thisDWord))
{
goto Error;
}
@@ -283,8 +283,8 @@ namespace System.Text.Unicode
// the value isn't overlong using a single comparison. On big-endian platforms, we'll need
// to validate the mask and validate that the sequence isn't overlong as two separate comparisons.
- if ((BitConverter.IsLittleEndian && DWordEndsWithValidUtf8TwoByteSequenceLittleEndian(thisDWord))
- || (!BitConverter.IsLittleEndian && (DWordEndsWithUtf8TwoByteMask(thisDWord) && !DWordEndsWithOverlongUtf8TwoByteSequence(thisDWord))))
+ if ((BitConverter.IsLittleEndian && UInt32EndsWithValidUtf8TwoByteSequenceLittleEndian(thisDWord))
+ || (!BitConverter.IsLittleEndian && (UInt32EndsWithUtf8TwoByteMask(thisDWord) && !UInt32EndsWithOverlongUtf8TwoByteSequence(thisDWord))))
{
// We have two runs of two bytes each.
@@ -308,7 +308,7 @@ namespace System.Text.Unicode
if (BitConverter.IsLittleEndian)
{
- if (DWordBeginsWithValidUtf8TwoByteSequenceLittleEndian(thisDWord))
+ if (UInt32BeginsWithValidUtf8TwoByteSequenceLittleEndian(thisDWord))
{
// The next sequence is a valid two-byte sequence.
goto ProcessTwoByteSequenceSkipOverlongFormCheck;
@@ -316,9 +316,9 @@ namespace System.Text.Unicode
}
else
{
- if (DWordBeginsWithUtf8TwoByteMask(thisDWord))
+ if (UInt32BeginsWithUtf8TwoByteMask(thisDWord))
{
- if (DWordBeginsWithOverlongUtf8TwoByteSequence(thisDWord))
+ if (UInt32BeginsWithOverlongUtf8TwoByteSequence(thisDWord))
{
goto Error; // The next sequence purports to be a 2-byte sequence but is overlong.
}
@@ -343,9 +343,9 @@ namespace System.Text.Unicode
uint charToWrite = ExtractCharFromFirstTwoByteSequence(thisDWord); // optimistically compute this now, but don't store until we know dest is large enough
- if (DWordThirdByteIsAscii(thisDWord))
+ if (UInt32ThirdByteIsAscii(thisDWord))
{
- if (DWordFourthByteIsAscii(thisDWord))
+ if (UInt32FourthByteIsAscii(thisDWord))
{
if (outputCharsRemaining < 3)
{
@@ -426,7 +426,7 @@ namespace System.Text.Unicode
BeforeProcessThreeByteSequence:
- if (DWordBeginsWithUtf8ThreeByteMask(thisDWord))
+ if (UInt32BeginsWithUtf8ThreeByteMask(thisDWord))
{
ProcessThreeByteSequenceWithCheck:
@@ -524,7 +524,7 @@ namespace System.Text.Unicode
// in to the text. If this happens strip it off now before seeing if the next character
// consists of three code units.
- if (DWordFourthByteIsAscii(thisDWord))
+ if (UInt32FourthByteIsAscii(thisDWord))
{
if (outputCharsRemaining == 0)
{
@@ -554,7 +554,7 @@ namespace System.Text.Unicode
// marker now and jump directly to three-byte sequence processing if we see one, skipping
// all of the logic at the beginning of the loop.
- if (DWordBeginsWithUtf8ThreeByteMask(thisDWord))
+ if (UInt32BeginsWithUtf8ThreeByteMask(thisDWord))
{
goto ProcessThreeByteSequenceWithCheck; // found a three-byte sequence marker; validate and consume
}
@@ -579,7 +579,7 @@ namespace System.Text.Unicode
// [ F1..F3 ] [ 80..BF ] [ 80..BF ] [ 80..BF ]
// [ F4 ] [ 80..8F ] [ 80..BF ] [ 80..BF ]
- if (!DWordBeginsWithUtf8FourByteMask(thisDWord))
+ if (!UInt32BeginsWithUtf8FourByteMask(thisDWord))
{
goto Error;
}
diff --git a/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Validation.cs b/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Validation.cs
index 80e16d62a4..671bf1fc60 100644
--- a/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Validation.cs
+++ b/src/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.Validation.cs
@@ -265,8 +265,8 @@ namespace System.Text.Unicode
// the value isn't overlong using a single comparison. On big-endian platforms, we'll need
// to validate the mask and validate that the sequence isn't overlong as two separate comparisons.
- if ((BitConverter.IsLittleEndian && DWordEndsWithValidUtf8TwoByteSequenceLittleEndian(thisDWord))
- || (!BitConverter.IsLittleEndian && (DWordEndsWithUtf8TwoByteMask(thisDWord) && !DWordEndsWithOverlongUtf8TwoByteSequence(thisDWord))))
+ if ((BitConverter.IsLittleEndian && UInt32EndsWithValidUtf8TwoByteSequenceLittleEndian(thisDWord))
+ || (!BitConverter.IsLittleEndian && (UInt32EndsWithUtf8TwoByteMask(thisDWord) && !UInt32EndsWithOverlongUtf8TwoByteSequence(thisDWord))))
{
// We have two runs of two bytes each.
pInputBuffer += 4;
@@ -281,7 +281,7 @@ namespace System.Text.Unicode
if (BitConverter.IsLittleEndian)
{
- if (DWordBeginsWithValidUtf8TwoByteSequenceLittleEndian(thisDWord))
+ if (UInt32BeginsWithValidUtf8TwoByteSequenceLittleEndian(thisDWord))
{
// The next sequence is a valid two-byte sequence.
goto ProcessTwoByteSequenceSkipOverlongFormCheck;
@@ -289,9 +289,9 @@ namespace System.Text.Unicode
}
else
{
- if (DWordBeginsWithUtf8TwoByteMask(thisDWord))
+ if (UInt32BeginsWithUtf8TwoByteMask(thisDWord))
{
- if (DWordBeginsWithOverlongUtf8TwoByteSequence(thisDWord))
+ if (UInt32BeginsWithOverlongUtf8TwoByteSequence(thisDWord))
{
goto Error; // The next sequence purports to be a 2-byte sequence but is overlong.
}
@@ -316,9 +316,9 @@ namespace System.Text.Unicode
tempUtf16CodeUnitCountAdjustment--; // 2-byte sequence + (some number of ASCII bytes) -> 1 UTF-16 code units (and 1 scalar) [+ trailing]
- if (DWordThirdByteIsAscii(thisDWord))
+ if (UInt32ThirdByteIsAscii(thisDWord))
{
- if (DWordFourthByteIsAscii(thisDWord))
+ if (UInt32FourthByteIsAscii(thisDWord))
{
pInputBuffer += 4;
}
@@ -527,7 +527,7 @@ namespace System.Text.Unicode
continue;
}
- if (DWordBeginsWithUtf8ThreeByteMask(thisDWord))
+ if (UInt32BeginsWithUtf8ThreeByteMask(thisDWord))
{
// A single three-byte sequence.
goto ProcessThreeByteSequenceWithCheck;
@@ -549,7 +549,7 @@ namespace System.Text.Unicode
// marker now and jump directly to three-byte sequence processing if we see one, skipping
// all of the logic at the beginning of the loop.
- if (DWordBeginsWithUtf8ThreeByteMask(thisDWord))
+ if (UInt32BeginsWithUtf8ThreeByteMask(thisDWord))
{
goto ProcessThreeByteSequenceWithCheck; // Found another [not yet validated] three-byte sequence; process
}