Use Array.Empty<T>.

This commit is contained in:
2021-08-17 18:21:12 +01:00
parent f14592b392
commit fdff1d74c9
41 changed files with 98 additions and 86 deletions

View File

@@ -89,7 +89,7 @@ namespace Aaru.Core.Devices.Dumping
{
Identify.IdentifyDevice ataId = ataIdNullable.Value;
byte[] ataIdentify = cmdBuf;
cmdBuf = new byte[0];
cmdBuf = Array.Empty<byte>();
DateTime start;
DateTime end;

View File

@@ -31,6 +31,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using Aaru.CommonTypes.Interfaces;
@@ -254,7 +255,7 @@ namespace Aaru.Core
file.statusChangeTimeSpecified = true;
}
byte[] data = new byte[0];
byte[] data = Array.Empty<byte>();
if(stat.Length > 0)
{

View File

@@ -66,7 +66,7 @@ namespace Aaru.Core
_aborted = false;
var emptyChkWorker = new Checksum();
emptyChkWorker.Update(new byte[0]);
emptyChkWorker.Update(Array.Empty<byte>());
_emptyChecksums = emptyChkWorker.End().ToArray();
}

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Decoders.ATA;
@@ -196,7 +197,7 @@ namespace Aaru.Devices
out double duration)
{
lba = 0;
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba28
{
@@ -341,7 +342,7 @@ namespace Aaru.Devices
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool Seek(out AtaErrorRegistersLba28 statusRegisters, uint lba, uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba28
{

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Decoders.ATA;
@@ -49,7 +50,7 @@ namespace Aaru.Devices
out double duration)
{
lba = 0;
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba48
{
@@ -243,7 +244,7 @@ namespace Aaru.Devices
out double duration)
{
lba = 0;
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba48
{

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Decoders.ATA;
@@ -302,7 +303,7 @@ namespace Aaru.Devices
public bool Seek(out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, byte sector,
uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersChs
{
@@ -351,7 +352,7 @@ namespace Aaru.Devices
public bool SetFeatures(out AtaErrorRegistersChs statusRegisters, AtaFeatures feature, ushort cylinder,
byte head, byte sector, byte sectorCount, uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersChs
{
@@ -384,7 +385,7 @@ namespace Aaru.Devices
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool DoorLock(out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersChs
{
@@ -411,7 +412,7 @@ namespace Aaru.Devices
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool DoorUnlock(out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersChs
{
@@ -438,7 +439,7 @@ namespace Aaru.Devices
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool MediaEject(out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersChs
{

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Decoders.ATA;
@@ -120,7 +121,7 @@ namespace Aaru.Devices
public bool RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLba28 statusRegisters,
uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba28
{

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Decoders.ATA;
@@ -70,7 +71,7 @@ namespace Aaru.Devices
public bool CheckMediaCardType(byte feature, out AtaErrorRegistersChs statusRegisters, uint timeout,
out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersChs
{

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Decoders.ATA;
@@ -46,7 +47,7 @@ namespace Aaru.Devices
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool SmartDisable(out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba28
{
@@ -77,7 +78,7 @@ namespace Aaru.Devices
public bool SmartEnableAttributeAutosave(out AtaErrorRegistersLba28 statusRegisters, uint timeout,
out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba28
{
@@ -109,7 +110,7 @@ namespace Aaru.Devices
public bool SmartDisableAttributeAutosave(out AtaErrorRegistersLba28 statusRegisters, uint timeout,
out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba28
{
@@ -139,7 +140,7 @@ namespace Aaru.Devices
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool SmartEnable(out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba28
{
@@ -171,7 +172,7 @@ namespace Aaru.Devices
public bool SmartExecuteOffLineImmediate(out AtaErrorRegistersLba28 statusRegisters, byte subcommand,
uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba28
{
@@ -268,7 +269,7 @@ namespace Aaru.Devices
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool SmartReturnStatus(out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
var registers = new AtaRegistersLba28
{

View File

@@ -139,7 +139,7 @@ namespace Aaru.Devices
{
AaruConsole.ErrorWriteLine("Invalid remote URI.");
return new DeviceInfo[0];
return Array.Empty<DeviceInfo>();
}
using var remote = new Remote.Remote(aaruUri);
@@ -157,7 +157,7 @@ namespace Aaru.Devices
{
AaruConsole.ErrorWriteLine("Error connecting to host.");
return new DeviceInfo[0];
return Array.Empty<DeviceInfo>();
}
}
}

View File

@@ -139,7 +139,7 @@ namespace Aaru.Devices
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool SetBlockLength(uint length, out uint[] response, uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
LastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false,
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, length, 0, 0,
@@ -367,7 +367,7 @@ namespace Aaru.Devices
argument = transferLength,
blockSize = 0,
blocks = 0,
buffer = new byte[0]
buffer = Array.Empty<byte>()
};
// READ_MULTIPLE_BLOCK
@@ -394,7 +394,7 @@ namespace Aaru.Devices
argument = 0,
blockSize = 0,
blocks = 0,
buffer = new byte[0]
buffer = Array.Empty<byte>()
};
LastError = SendMultipleMmcCommands(commands, out duration, out bool sense, timeout);

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Console;
namespace Aaru.Devices
@@ -82,7 +83,7 @@ namespace Aaru.Devices
public bool ArchiveCorpSeekBlock(out byte[] senseBuffer, bool immediate, uint lba, uint timeout,
out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
byte[] cdb = new byte[6];
senseBuffer = new byte[64];

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using Aaru.Console;
@@ -59,7 +60,7 @@ namespace Aaru.Devices
/// <param name="duration">Duration.</param>
public bool CertanceParkUnpark(out byte[] senseBuffer, bool park, uint timeout, out double duration)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
byte[] cdb = new byte[6];
senseBuffer = new byte[64];

View File

@@ -46,7 +46,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.KreonCommand;
cdb[1] = 0x08;
@@ -97,7 +97,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.KreonCommand;
cdb[1] = 0x08;

View File

@@ -556,7 +556,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
@@ -626,7 +626,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.StartStopUnit;
@@ -757,7 +757,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[12];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.SetCdRomSpeed;
cdb[1] = (byte)((byte)rotationalControl & 0x03);

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Console;
// ReSharper disable InconsistentNaming
@@ -144,7 +145,7 @@ namespace Aaru.Devices
cdb[0] = (byte)ScsiCommands.MiniDiscStopPlay;
buffer = new byte[0];
buffer = Array.Empty<byte>();
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
out bool sense);

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Decoders.SCSI;
@@ -63,7 +64,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[10];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
foundLba = 0;
foundBlocks = 0;

View File

@@ -389,7 +389,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.Seek6;
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
@@ -415,7 +415,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[10];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.Seek10;
cdb[2] = (byte)((lba & 0xFF000000) >> 24);

View File

@@ -202,7 +202,7 @@ namespace Aaru.Devices
(byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0
};
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
out bool sense);
@@ -420,7 +420,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
cdb[4] = (byte)((byte)preventMode & 0x03);

View File

@@ -71,7 +71,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.LoadUnload;
@@ -151,7 +151,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[10];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.Locate;
@@ -235,7 +235,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[16];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
byte[] idBytes = BitConverter.GetBytes(identifier);
cdb[0] = (byte)ScsiCommands.Locate16;
@@ -910,7 +910,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.Rewind;
@@ -937,7 +937,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
cdb[0] = (byte)ScsiCommands.TrackSelect;
cdb[5] = track;
@@ -965,7 +965,7 @@ namespace Aaru.Devices
{
senseBuffer = new byte[64];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
byte[] countB = BitConverter.GetBytes(count);
cdb[0] = (byte)ScsiCommands.Space;

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Console;
namespace Aaru.Devices
@@ -99,7 +100,7 @@ namespace Aaru.Devices
cdb[4] = 1;
}
else
buffer = new byte[0];
buffer = Array.Empty<byte>();
if(!inhibitDma)
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
@@ -178,7 +179,7 @@ namespace Aaru.Devices
cdb[4] = 1;
}
else
buffer = new byte[0];
buffer = Array.Empty<byte>();
if(!inhibitDma)
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,

View File

@@ -342,7 +342,7 @@ namespace Aaru.Devices.Remote
{
AaruConsole.ErrorWriteLine("Could not write to the network...");
return new DeviceInfo[0];
return Array.Empty<DeviceInfo>();
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
@@ -353,7 +353,7 @@ namespace Aaru.Devices.Remote
{
AaruConsole.ErrorWriteLine("Could not read from the network...");
return new DeviceInfo[0];
return Array.Empty<DeviceInfo>();
}
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian<AaruPacketHeader>(hdrBuf);
@@ -363,7 +363,7 @@ namespace Aaru.Devices.Remote
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
return new DeviceInfo[0];
return Array.Empty<DeviceInfo>();
}
if(hdr.packetType != AaruPacketType.ResponseListDevices)
@@ -373,7 +373,7 @@ namespace Aaru.Devices.Remote
AaruConsole.ErrorWriteLine("Expected List Devices Response Packet, got packet type {0}...",
hdr.packetType);
return new DeviceInfo[0];
return Array.Empty<DeviceInfo>();
}
buf = new byte[hdr.len];
@@ -383,21 +383,21 @@ namespace Aaru.Devices.Remote
{
AaruConsole.ErrorWriteLine("Could not read from the network...");
return new DeviceInfo[0];
return Array.Empty<DeviceInfo>();
}
AaruPacketNop nop = Marshal.ByteArrayToStructureLittleEndian<AaruPacketNop>(buf);
AaruConsole.ErrorWriteLine($"{nop.reason}");
return new DeviceInfo[0];
return Array.Empty<DeviceInfo>();
}
if(hdr.version != Consts.PACKET_VERSION)
{
AaruConsole.ErrorWriteLine("Unrecognized packet version...");
return new DeviceInfo[0];
return Array.Empty<DeviceInfo>();
}
buf = new byte[hdr.len];
@@ -407,7 +407,7 @@ namespace Aaru.Devices.Remote
{
AaruConsole.ErrorWriteLine("Could not read from the network...");
return new DeviceInfo[0];
return Array.Empty<DeviceInfo>();
}
AaruPacketResponseListDevices response =

View File

@@ -184,7 +184,7 @@ namespace Aaru.Filesystems
if(size == 0)
{
buf = new byte[0];
buf = Array.Empty<byte>();
return Errno.NoError;
}
@@ -328,7 +328,7 @@ namespace Aaru.Filesystems
{
if(entry.flRPyLen == 0)
{
buf = new byte[0];
buf = Array.Empty<byte>();
return Errno.NoError;
}
@@ -339,7 +339,7 @@ namespace Aaru.Filesystems
{
if(entry.flPyLen == 0)
{
buf = new byte[0];
buf = Array.Empty<byte>();
return Errno.NoError;
}

View File

@@ -88,7 +88,7 @@ namespace Aaru.Filesystems
if(size == 0)
{
buf = new byte[0];
buf = Array.Empty<byte>();
return Errno.NoError;
}

View File

@@ -104,7 +104,7 @@ namespace Aaru.Filesystems
if(size == 0)
{
buf = new byte[0];
buf = Array.Empty<byte>();
return Errno.NoError;
}
@@ -223,7 +223,7 @@ namespace Aaru.Filesystems
uint[] GetClusters(uint startCluster)
{
if(startCluster == 0)
return new uint[0];
return Array.Empty<uint>();
if(startCluster >= XmlFsType.Clusters)
return null;

View File

@@ -686,7 +686,7 @@ namespace Aaru.Filesystems
if(amiga.flags.HasFlag(AmigaFlags.Comment))
{
if(entry.AmigaComment is null)
entry.AmigaComment = new byte[0];
entry.AmigaComment = Array.Empty<byte>();
byte[] newComment = new byte[entry.AmigaComment.Length +
data
@@ -811,7 +811,7 @@ namespace Aaru.Filesystems
}
if(entry.RockRidgeAlternateName is null)
entry.RockRidgeAlternateName = new byte[0];
entry.RockRidgeAlternateName = Array.Empty<byte>();
byte[] newNm = new byte[entry.RockRidgeAlternateName.Length + nm.Length];
Array.Copy(entry.RockRidgeAlternateName, 0, newNm, 0, entry.RockRidgeAlternateName.Length);

View File

@@ -114,7 +114,7 @@ namespace Aaru.Filesystems
if(entry.Size == 0)
{
buf = new byte[0];
buf = Array.Empty<byte>();
return Errno.NoError;
}

View File

@@ -280,7 +280,7 @@ namespace Aaru.Filesystems
}
}
byte[] rootDir = new byte[0];
byte[] rootDir = Array.Empty<byte>();
int rootOff = 0;
bool xaExtensions = false;
bool apple = false;

View File

@@ -137,7 +137,7 @@ namespace Aaru.Filesystems
if(entry.AssociatedFile.Size == 0)
{
buf = new byte[0];
buf = Array.Empty<byte>();
return Errno.NoError;
}
@@ -172,7 +172,7 @@ namespace Aaru.Filesystems
if(entry.ResourceFork.Size == 0)
{
buf = new byte[0];
buf = Array.Empty<byte>();
return Errno.NoError;
}

View File

@@ -64,7 +64,7 @@ namespace Aaru.Filesystems.LisaFS
{
if(size == 0)
{
buf = new byte[0];
buf = Array.Empty<byte>();
return Errno.NoError;
}

View File

@@ -185,10 +185,10 @@ namespace Aaru.Filesystems
}
else
{
fields.FirstPartitions = new NintendoPartition[0];
fields.SecondPartitions = new NintendoPartition[0];
fields.ThirdPartitions = new NintendoPartition[0];
fields.FourthPartitions = new NintendoPartition[0];
fields.FirstPartitions = Array.Empty<NintendoPartition>();
fields.SecondPartitions = Array.Empty<NintendoPartition>();
fields.ThirdPartitions = Array.Empty<NintendoPartition>();
fields.FourthPartitions = Array.Empty<NintendoPartition>();
}
AaruConsole.DebugWriteLine("Nintendo plugin", "discType = {0}", fields.DiscType);

View File

@@ -102,7 +102,7 @@ namespace Aaru.Filesystems
if(entry.Entry.byte_count == 0)
{
buf = new byte[0];
buf = Array.Empty<byte>();
return Errno.NoError;
}

View File

@@ -288,7 +288,7 @@ namespace Aaru.Gui.ViewModels.Panels
try
{
byte[] outBuf = new byte[0];
byte[] outBuf = Array.Empty<byte>();
Errno error = _model.Plugin.Read(_model.Path + "/" + file.Name, 0, file.Stat.Length, ref outBuf);

View File

@@ -1765,7 +1765,7 @@ namespace Aaru.DiscImages
var cmpCrc64Context = new Crc64Context();
byte[] lzmaProperties = new byte[0];
byte[] lzmaProperties = Array.Empty<byte>();
switch(_currentBlockHeader.compression)
{
@@ -2498,7 +2498,7 @@ namespace Aaru.DiscImages
var cmpCrc64Context = new Crc64Context();
byte[] lzmaProperties = new byte[0];
byte[] lzmaProperties = Array.Empty<byte>();
if(_currentBlockHeader.compression == CompressionType.Flac)
{

View File

@@ -315,7 +315,7 @@ namespace Aaru.Tests.Filesystems
stat.Should().BeEquivalentTo(child.Value.Info, $"Wrong info for \"{childPath}\" in {testFile}");
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
if(child.Value.Info.Attributes.HasFlag(FileAttributes.Directory))
{
@@ -402,7 +402,7 @@ namespace Aaru.Tests.Filesystems
foreach(KeyValuePair<string, string> xattr in xattrs)
{
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
Errno ret = fs.GetXattr(path, xattr.Key, ref buffer);
if(ret == Errno.NoSuchExtendedAttribute ||

View File

@@ -213,7 +213,7 @@ namespace Aaru.Tests.Issues
expectedXattrs.Remove(xattr);
byte[] xattrBuf = new byte[0];
byte[] xattrBuf = Array.Empty<byte>();
error = fs.GetXattr(path + "/" + entry, xattr, ref xattrBuf);
Assert.AreEqual(Errno.NoError, error,
@@ -230,7 +230,7 @@ namespace Aaru.Tests.Issues
expectedXattrs);
}
byte[] outBuf = new byte[0];
byte[] outBuf = Array.Empty<byte>();
error = fs.Read(path + "/" + entry, 0, stat.Length, ref outBuf);

View File

@@ -156,7 +156,7 @@ namespace Aaru.Tests.Issues
if(error == Errno.NoError)
foreach(string xattr in xattrs)
{
byte[] xattrBuf = new byte[0];
byte[] xattrBuf = Array.Empty<byte>();
error = fs.GetXattr(path + "/" + entry, xattr, ref xattrBuf);
Assert.AreEqual(Errno.NoError, error,
@@ -164,7 +164,7 @@ namespace Aaru.Tests.Issues
}
}
byte[] outBuf = new byte[0];
byte[] outBuf = Array.Empty<byte>();
error = fs.Read(path + "/" + entry, 0, stat.Length, ref outBuf);

View File

@@ -415,7 +415,7 @@ namespace Aaru.Commands.Filesystem
if(error == Errno.NoError)
foreach(string xattr in xattrs)
{
byte[] xattrBuf = new byte[0];
byte[] xattrBuf = Array.Empty<byte>();
error = fs.GetXattr(path + "/" + entry, xattr, ref xattrBuf);
if(error != Errno.NoError)
@@ -483,7 +483,7 @@ namespace Aaru.Commands.Filesystem
if(!File.Exists(outputPath))
{
byte[] outBuf = new byte[0];
byte[] outBuf = Array.Empty<byte>();
error = fs.Read(path + "/" + entry, 0, stat.Length, ref outBuf);

View File

@@ -355,7 +355,7 @@ namespace Aaru.Commands.Filesystem
foreach(string xattr in xattrs)
{
byte[] xattrBuf = new byte[0];
byte[] xattrBuf = Array.Empty<byte>();
error = fs.GetXattr(path + "/" + entry.Key, xattr, ref xattrBuf);
if(error == Errno.NoError)