diff options
author | Tarek Mahmoud Sayed <tarekms@microsoft.com> | 2018-03-09 00:56:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-09 00:56:43 +0300 |
commit | 8ad2b10cff945e4428520c6932e8de499af2931b (patch) | |
tree | e64ed486443af02ce979036382c4dd23117c158e /src/System.Security.Cryptography.Encoding | |
parent | 8b0d0f03f9ed6bd5c4be79af6105372d119e58c8 (diff) |
Collapse AsSpan().Slice(...) into .AsSpan(...) (#27867)
Diffstat (limited to 'src/System.Security.Cryptography.Encoding')
5 files changed, 9 insertions, 9 deletions
diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ParseTag.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ParseTag.cs index a9211778f1..33f268530d 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ParseTag.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ParseTag.cs @@ -69,7 +69,7 @@ namespace System.Security.Cryptography.Tests.Asn1 byte[] secondBytes = new byte[inputBytes.Length]; int written; - Assert.False(tag.TryWrite(secondBytes.AsSpan().Slice(0, inputBytes.Length - 1), out written)); + Assert.False(tag.TryWrite(secondBytes.AsSpan(0, inputBytes.Length - 1), out written)); Assert.Equal(0, written); Assert.True(tag.TryWrite(secondBytes, out written)); Assert.Equal(inputBytes.Length, written); diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBMPString.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBMPString.cs index 62b8439e0a..dbf647f48d 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBMPString.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBMPString.cs @@ -153,7 +153,7 @@ namespace System.Security.Cryptography.Tests.Asn1 output[0] = 'a'; copied = reader.TryCopyBMPString( - output.AsSpan().Slice(0, expectedValue.Length - 1), + output.AsSpan(0, expectedValue.Length - 1), out charsWritten); Assert.False(copied, "reader.TryCopyBMPString - too short"); @@ -190,7 +190,7 @@ namespace System.Security.Cryptography.Tests.Asn1 { output[0] = 32; - copied = reader.TryCopyBMPStringBytes(output.AsSpan().Slice(0, output.Length - 1), + copied = reader.TryCopyBMPStringBytes(output.AsSpan(0, output.Length - 1), out bytesWritten); Assert.False(copied, "reader.TryCopyBMPStringBytes - too short"); diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadIA5String.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadIA5String.cs index 42dc62a77e..8a4e24f77b 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadIA5String.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadIA5String.cs @@ -148,7 +148,7 @@ namespace System.Security.Cryptography.Tests.Asn1 { output[0] = 'a'; - copied = reader.TryCopyIA5String(output.AsSpan().Slice(0, expectedValue.Length - 1), + copied = reader.TryCopyIA5String(output.AsSpan(0, expectedValue.Length - 1), out charsWritten); Assert.False(copied, "reader.TryCopyIA5String - too short"); @@ -184,7 +184,7 @@ namespace System.Security.Cryptography.Tests.Asn1 { output[0] = 32; - copied = reader.TryCopyIA5StringBytes(output.AsSpan().Slice(0, output.Length - 1), + copied = reader.TryCopyIA5StringBytes(output.AsSpan(0, output.Length - 1), out bytesWritten); Assert.False(copied, "reader.TryCopyIA5StringBytes - too short"); diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadUTF8String.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadUTF8String.cs index 5ab1b6dc51..6348c987b5 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadUTF8String.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadUTF8String.cs @@ -154,7 +154,7 @@ namespace System.Security.Cryptography.Tests.Asn1 copied = reader.TryCopyCharacterString( UniversalTagNumber.UTF8String, - output.AsSpan().Slice(0, expectedValue.Length - 1), + output.AsSpan(0, expectedValue.Length - 1), out charsWritten); Assert.False(copied, "reader.TryCopyUTF8String - too short"); @@ -194,7 +194,7 @@ namespace System.Security.Cryptography.Tests.Asn1 copied = reader.TryCopyCharacterStringBytes( UniversalTagNumber.UTF8String, - output.AsSpan().Slice(0, output.Length - 1), + output.AsSpan(0, output.Length - 1), out bytesWritten); Assert.False(copied, "reader.TryCopyUTF8StringBytes - too short"); diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/Asn1WriterTests.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/Asn1WriterTests.cs index 316eb28b59..3016af053f 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/Asn1WriterTests.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/Asn1WriterTests.cs @@ -20,13 +20,13 @@ namespace System.Security.Cryptography.Tests.Asn1 encoded2[0] = 255; encoded2[encoded.Length] = 254; - Span<byte> dest = encoded2.AsSpan().Slice(0, encoded.Length - 1); + Span<byte> dest = encoded2.AsSpan(0, encoded.Length - 1); Assert.False(writer.TryEncode(dest, out int bytesWritten), "writer.TryEncode (too small)"); Assert.Equal(0, bytesWritten); Assert.Equal(255, encoded2[0]); Assert.Equal(254, encoded2[encoded.Length]); - dest = encoded2.AsSpan().Slice(0, encoded.Length); + dest = encoded2.AsSpan(0, encoded.Length); Assert.True(writer.TryEncode(dest, out bytesWritten), "writer.TryEncode (exact length)"); Assert.Equal(encoded.Length, bytesWritten); Assert.True(dest.SequenceEqual(encoded), "dest.SequenceEqual(encoded2) (exact length)"); |