Skip to content

Commit c5fb5b1

Browse files
committed
Remove Utility.EmptyByteArray.
This was only necessary for .NET 4.5 compatibility. Signed-off-by: Bradley Grainger <[email protected]>
1 parent 9edab00 commit c5fb5b1

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

src/MySqlConnector/Protocol/Payloads/AuthenticationMethodSwitchRequestPayload.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static AuthenticationMethodSwitchRequestPayload Create(ReadOnlySpan<byte>
2222
// if the packet is just the header byte (0xFE), it's an "Old Authentication Method Switch Request Packet"
2323
// (possibly sent by a server that doesn't support CLIENT_PLUGIN_AUTH)
2424
name = "mysql_old_password";
25-
data = Utility.EmptyByteArray;
25+
data = Array.Empty<byte>();
2626
}
2727
else
2828
{

src/MySqlConnector/Protocol/Payloads/EmptyPayload.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ namespace MySqlConnector.Protocol.Payloads;
44

55
internal static class EmptyPayload
66
{
7-
public static PayloadData Instance { get; } = new(Utility.EmptyByteArray);
7+
public static PayloadData Instance { get; } = new(Array.Empty<byte>());
88
}

src/MySqlConnector/Protocol/Serialization/AuthenticationUtility.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace MySqlConnector.Protocol.Serialization;
1010
internal static class AuthenticationUtility
1111
{
1212
public static byte[] CreateAuthenticationResponse(ReadOnlySpan<byte> challenge, string password) =>
13-
string.IsNullOrEmpty(password) ? Utility.EmptyByteArray : HashPassword(challenge, password);
13+
string.IsNullOrEmpty(password) ? Array.Empty<byte>() : HashPassword(challenge, password);
1414

1515
/// <summary>
1616
/// Hashes a password with the "Secure Password Authentication" method.
@@ -57,7 +57,7 @@ public static byte[] HashPassword(ReadOnlySpan<byte> challenge, string password)
5757
public static byte[] CreateScrambleResponse(ReadOnlySpan<byte> nonce, string password)
5858
{
5959
var scrambleResponse = string.IsNullOrEmpty(password)
60-
? Utility.EmptyByteArray
60+
? Array.Empty<byte>()
6161
: HashPasswordWithNonce(nonce, password);
6262

6363
return scrambleResponse;

src/MySqlConnector/Utilities/Utility.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,6 @@ public static TimeSpan ParseTimeSpan(ReadOnlySpan<byte> value)
473473
throw new FormatException("Couldn't interpret '{0}' as a valid TimeSpan".FormatInvariant(Encoding.UTF8.GetString(originalValue)));
474474
}
475475

476-
public static byte[] EmptyByteArray { get; } = Array.Empty<byte>();
477-
478476
#if !NETCOREAPP2_1_OR_GREATER && !NETSTANDARD2_1_OR_GREATER
479477
public static bool TryComputeHash(this HashAlgorithm hashAlgorithm, ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten)
480478
{

0 commit comments

Comments
 (0)