use array.Empty<byte>

This commit is contained in:
UbitUmarov
2022-03-12 15:21:24 +00:00
parent 5ffa1801d8
commit e043d8a2eb
45 changed files with 100 additions and 103 deletions

View File

@@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.Asset
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] result = new byte[0];
byte[] result = Array.Empty<byte>();
string[] p = SplitParams(path);
@@ -88,7 +88,7 @@ namespace OpenSim.Server.Handlers.Asset
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
httpResponse.ContentType = "text/plain";
result = new byte[0];
result = Array.Empty<byte>();
}
else
{
@@ -112,7 +112,7 @@ namespace OpenSim.Server.Handlers.Asset
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
httpResponse.ContentType = "text/plain";
result = new byte[0];
result = Array.Empty<byte>();
}
}
else
@@ -120,7 +120,7 @@ namespace OpenSim.Server.Handlers.Asset
// Unknown request
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
httpResponse.ContentType = "text/plain";
result = new byte[0];
result = Array.Empty<byte>();
}
}
else if (p.Length == 1)
@@ -142,7 +142,7 @@ namespace OpenSim.Server.Handlers.Asset
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
httpResponse.ContentType = "text/plain";
result = new byte[0];
result = Array.Empty<byte>();
}
}
else
@@ -150,7 +150,7 @@ namespace OpenSim.Server.Handlers.Asset
// Unknown request
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
httpResponse.ContentType = "text/plain";
result = new byte[0];
result = Array.Empty<byte>();
}
if (httpResponse.StatusCode == (int)HttpStatusCode.NotFound && !string.IsNullOrEmpty(m_RedirectURL) && !string.IsNullOrEmpty(id))

View File

@@ -187,7 +187,7 @@ namespace OpenSim.Server.Handlers.Authentication
private byte[] DoEncryptedMethods(byte[] ciphertext)
{
return new byte[0];
return Array.Empty<byte>();
}
private byte[] SuccessResult()

View File

@@ -80,7 +80,7 @@ namespace OpenSim.Server.Handlers.BakedTextures
catch
{
}
return new byte[0];
return Array.Empty<byte>();
}
public void Store(string id, byte[] data, int dataLength)

View File

@@ -47,9 +47,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
{
public class InstantMessageServerConnector : ServiceConnector
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IInstantMessage m_IMService;
@@ -105,7 +103,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
uint ParentEstateID = 0;
Vector3 Position = Vector3.Zero;
UUID RegionID = UUID.Zero;
byte[] binaryBucket = new byte[0];
byte[] binaryBucket = Array.Empty<byte>();
float pos_x = 0;
float pos_y = 0;
@@ -198,7 +196,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
string requestData3 = (string)requestData["binary_bucket"];
if (string.IsNullOrEmpty(requestData3))
{
binaryBucket = new byte[0];
binaryBucket = Array.Empty<byte>();
}
else
{
@@ -235,10 +233,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
// calling region uses this to know when to look up a user's location again.
XmlRpcResponse resp = new XmlRpcResponse();
Hashtable respdata = new Hashtable();
if (successful)
respdata["success"] = "TRUE";
else
respdata["success"] = "FALSE";
respdata["success"] = successful ? "TRUE" : "FALSE";
resp.Value = respdata;
return resp;

View File

@@ -88,10 +88,10 @@ namespace OpenSim.Server.Handlers.MapImage
{
httpResponse.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
httpResponse.AddHeader("Retry-After", "10");
return new byte[0];
return Array.Empty<byte>();
}
byte[] result = new byte[0];
byte[] result = Array.Empty<byte>();
string format = string.Empty;
//UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
@@ -119,7 +119,7 @@ namespace OpenSim.Server.Handlers.MapImage
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
httpResponse.ContentType = "text/plain";
return new byte[0];
return Array.Empty<byte>();
}
result = m_MapService.GetMapTile(path, scopeID, out format);