diff --git a/Aaru.Checksums b/Aaru.Checksums index dbf3a01f4..da3cbf28f 160000 --- a/Aaru.Checksums +++ b/Aaru.Checksums @@ -1 +1 @@ -Subproject commit dbf3a01f432bf25bc10842864071f4a59800a36a +Subproject commit da3cbf28f464351a0b951bcd14c930952c8ffb21 diff --git a/Aaru.Core/Devices/Dumping/ATA.cs b/Aaru.Core/Devices/Dumping/ATA.cs index a299ad2f6..91924424b 100644 --- a/Aaru.Core/Devices/Dumping/ATA.cs +++ b/Aaru.Core/Devices/Dumping/ATA.cs @@ -89,7 +89,7 @@ namespace Aaru.Core.Devices.Dumping { Identify.IdentifyDevice ataId = ataIdNullable.Value; byte[] ataIdentify = cmdBuf; - cmdBuf = new byte[0]; + cmdBuf = Array.Empty(); DateTime start; DateTime end; diff --git a/Aaru.Core/Sidecar/Files.cs b/Aaru.Core/Sidecar/Files.cs index 5ee7dc7f8..6b155d7cf 100644 --- a/Aaru.Core/Sidecar/Files.cs +++ b/Aaru.Core/Sidecar/Files.cs @@ -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(); if(stat.Length > 0) { diff --git a/Aaru.Core/Sidecar/Sidecar.cs b/Aaru.Core/Sidecar/Sidecar.cs index 03f7ea4f6..8fb7e500d 100644 --- a/Aaru.Core/Sidecar/Sidecar.cs +++ b/Aaru.Core/Sidecar/Sidecar.cs @@ -66,7 +66,7 @@ namespace Aaru.Core _aborted = false; var emptyChkWorker = new Checksum(); - emptyChkWorker.Update(new byte[0]); + emptyChkWorker.Update(Array.Empty()); _emptyChecksums = emptyChkWorker.End().ToArray(); } diff --git a/Aaru.Decryption b/Aaru.Decryption index a84d4c28f..a19cac220 160000 --- a/Aaru.Decryption +++ b/Aaru.Decryption @@ -1 +1 @@ -Subproject commit a84d4c28f6b19cb821913145216d436dfbd332ea +Subproject commit a19cac2209ce7e06ccae6653274d76b8bec9ca6f diff --git a/Aaru.Devices/Device/AtaCommands/Ata28.cs b/Aaru.Devices/Device/AtaCommands/Ata28.cs index bd448c255..d271a8e58 100644 --- a/Aaru.Devices/Device/AtaCommands/Ata28.cs +++ b/Aaru.Devices/Device/AtaCommands/Ata28.cs @@ -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(); var registers = new AtaRegistersLba28 { @@ -341,7 +342,7 @@ namespace Aaru.Devices /// true if the device set an error condition, false otherwise public bool Seek(out AtaErrorRegistersLba28 statusRegisters, uint lba, uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); var registers = new AtaRegistersLba28 { diff --git a/Aaru.Devices/Device/AtaCommands/Ata48.cs b/Aaru.Devices/Device/AtaCommands/Ata48.cs index d60ba5a4b..1cf4f695e 100644 --- a/Aaru.Devices/Device/AtaCommands/Ata48.cs +++ b/Aaru.Devices/Device/AtaCommands/Ata48.cs @@ -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(); 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(); var registers = new AtaRegistersLba48 { diff --git a/Aaru.Devices/Device/AtaCommands/AtaCHS.cs b/Aaru.Devices/Device/AtaCommands/AtaCHS.cs index 3a9e0beb9..ed3a97c2b 100644 --- a/Aaru.Devices/Device/AtaCommands/AtaCHS.cs +++ b/Aaru.Devices/Device/AtaCommands/AtaCHS.cs @@ -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(); 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(); var registers = new AtaRegistersChs { @@ -384,7 +385,7 @@ namespace Aaru.Devices /// true if the device set an error condition, false otherwise public bool DoorLock(out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); var registers = new AtaRegistersChs { @@ -411,7 +412,7 @@ namespace Aaru.Devices /// true if the device set an error condition, false otherwise public bool DoorUnlock(out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); var registers = new AtaRegistersChs { @@ -438,7 +439,7 @@ namespace Aaru.Devices /// true if the device set an error condition, false otherwise public bool MediaEject(out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); var registers = new AtaRegistersChs { diff --git a/Aaru.Devices/Device/AtaCommands/Cfa.cs b/Aaru.Devices/Device/AtaCommands/Cfa.cs index 228738ec2..c524eafbf 100644 --- a/Aaru.Devices/Device/AtaCommands/Cfa.cs +++ b/Aaru.Devices/Device/AtaCommands/Cfa.cs @@ -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(); var registers = new AtaRegistersLba28 { diff --git a/Aaru.Devices/Device/AtaCommands/MCPT.cs b/Aaru.Devices/Device/AtaCommands/MCPT.cs index e1c045d12..08b6f3ddf 100644 --- a/Aaru.Devices/Device/AtaCommands/MCPT.cs +++ b/Aaru.Devices/Device/AtaCommands/MCPT.cs @@ -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(); var registers = new AtaRegistersChs { diff --git a/Aaru.Devices/Device/AtaCommands/Smart.cs b/Aaru.Devices/Device/AtaCommands/Smart.cs index 23b451ae7..35f618db0 100644 --- a/Aaru.Devices/Device/AtaCommands/Smart.cs +++ b/Aaru.Devices/Device/AtaCommands/Smart.cs @@ -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 /// true if the device set an error condition, false otherwise public bool SmartDisable(out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); 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(); 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(); var registers = new AtaRegistersLba28 { @@ -139,7 +140,7 @@ namespace Aaru.Devices /// true if the device set an error condition, false otherwise public bool SmartEnable(out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); 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(); var registers = new AtaRegistersLba28 { @@ -268,7 +269,7 @@ namespace Aaru.Devices /// true if the device set an error condition, false otherwise public bool SmartReturnStatus(out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); var registers = new AtaRegistersLba28 { diff --git a/Aaru.Devices/Device/List.cs b/Aaru.Devices/Device/List.cs index 90a370985..516feb872 100644 --- a/Aaru.Devices/Device/List.cs +++ b/Aaru.Devices/Device/List.cs @@ -139,7 +139,7 @@ namespace Aaru.Devices { AaruConsole.ErrorWriteLine("Invalid remote URI."); - return new DeviceInfo[0]; + return Array.Empty(); } 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(); } } } diff --git a/Aaru.Devices/Device/MmcCommands/MMC.cs b/Aaru.Devices/Device/MmcCommands/MMC.cs index 1354061c7..21d15601e 100644 --- a/Aaru.Devices/Device/MmcCommands/MMC.cs +++ b/Aaru.Devices/Device/MmcCommands/MMC.cs @@ -139,7 +139,7 @@ namespace Aaru.Devices /// true if the device set an error condition, false otherwise public bool SetBlockLength(uint length, out uint[] response, uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); 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() }; // READ_MULTIPLE_BLOCK @@ -394,7 +394,7 @@ namespace Aaru.Devices argument = 0, blockSize = 0, blocks = 0, - buffer = new byte[0] + buffer = Array.Empty() }; LastError = SendMultipleMmcCommands(commands, out duration, out bool sense, timeout); diff --git a/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs b/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs index 06a4eeee5..128c31d42 100644 --- a/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs +++ b/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs @@ -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[] cdb = new byte[6]; senseBuffer = new byte[64]; diff --git a/Aaru.Devices/Device/ScsiCommands/Certance.cs b/Aaru.Devices/Device/ScsiCommands/Certance.cs index 0f0af476f..128933558 100644 --- a/Aaru.Devices/Device/ScsiCommands/Certance.cs +++ b/Aaru.Devices/Device/ScsiCommands/Certance.cs @@ -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 /// Duration. public bool CertanceParkUnpark(out byte[] senseBuffer, bool park, uint timeout, out double duration) { - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); byte[] cdb = new byte[6]; senseBuffer = new byte[64]; diff --git a/Aaru.Devices/Device/ScsiCommands/Kreon.cs b/Aaru.Devices/Device/ScsiCommands/Kreon.cs index 17d58d900..442b12a9f 100644 --- a/Aaru.Devices/Device/ScsiCommands/Kreon.cs +++ b/Aaru.Devices/Device/ScsiCommands/Kreon.cs @@ -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(); 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(); cdb[0] = (byte)ScsiCommands.KreonCommand; cdb[1] = 0x08; diff --git a/Aaru.Devices/Device/ScsiCommands/MMC.cs b/Aaru.Devices/Device/ScsiCommands/MMC.cs index 235747baf..d3f368b98 100644 --- a/Aaru.Devices/Device/ScsiCommands/MMC.cs +++ b/Aaru.Devices/Device/ScsiCommands/MMC.cs @@ -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(); 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(); 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(); cdb[0] = (byte)ScsiCommands.SetCdRomSpeed; cdb[1] = (byte)((byte)rotationalControl & 0x03); diff --git a/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs b/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs index aeff45573..c1c3eecf7 100644 --- a/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs +++ b/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs @@ -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(); LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out bool sense); diff --git a/Aaru.Devices/Device/ScsiCommands/Optical.cs b/Aaru.Devices/Device/ScsiCommands/Optical.cs index 291363285..aae905afd 100644 --- a/Aaru.Devices/Device/ScsiCommands/Optical.cs +++ b/Aaru.Devices/Device/ScsiCommands/Optical.cs @@ -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(); foundLba = 0; foundBlocks = 0; diff --git a/Aaru.Devices/Device/ScsiCommands/SBC.cs b/Aaru.Devices/Device/ScsiCommands/SBC.cs index 80d8ec67f..c5594177c 100644 --- a/Aaru.Devices/Device/ScsiCommands/SBC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SBC.cs @@ -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(); 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(); cdb[0] = (byte)ScsiCommands.Seek10; cdb[2] = (byte)((lba & 0xFF000000) >> 24); diff --git a/Aaru.Devices/Device/ScsiCommands/SPC.cs b/Aaru.Devices/Device/ScsiCommands/SPC.cs index b71dc35b3..fd0de1d3c 100644 --- a/Aaru.Devices/Device/ScsiCommands/SPC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SPC.cs @@ -202,7 +202,7 @@ namespace Aaru.Devices (byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0 }; - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); 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(); cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; cdb[4] = (byte)((byte)preventMode & 0x03); diff --git a/Aaru.Devices/Device/ScsiCommands/SSC.cs b/Aaru.Devices/Device/ScsiCommands/SSC.cs index a50b4ebd9..bedec9627 100644 --- a/Aaru.Devices/Device/ScsiCommands/SSC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SSC.cs @@ -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(); 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(); 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[] 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(); 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(); 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[] countB = BitConverter.GetBytes(count); cdb[0] = (byte)ScsiCommands.Space; diff --git a/Aaru.Devices/Device/ScsiCommands/SyQuest.cs b/Aaru.Devices/Device/ScsiCommands/SyQuest.cs index 4b7fc7df8..4f646a992 100644 --- a/Aaru.Devices/Device/ScsiCommands/SyQuest.cs +++ b/Aaru.Devices/Device/ScsiCommands/SyQuest.cs @@ -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(); 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(); if(!inhibitDma) LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, diff --git a/Aaru.Devices/Remote/Remote.cs b/Aaru.Devices/Remote/Remote.cs index e4f8bac43..5a94e892c 100644 --- a/Aaru.Devices/Remote/Remote.cs +++ b/Aaru.Devices/Remote/Remote.cs @@ -342,7 +342,7 @@ namespace Aaru.Devices.Remote { AaruConsole.ErrorWriteLine("Could not write to the network..."); - return new DeviceInfo[0]; + return Array.Empty(); } byte[] hdrBuf = new byte[Marshal.SizeOf()]; @@ -353,7 +353,7 @@ namespace Aaru.Devices.Remote { AaruConsole.ErrorWriteLine("Could not read from the network..."); - return new DeviceInfo[0]; + return Array.Empty(); } AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(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(); } 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(); } 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(); } AaruPacketNop nop = Marshal.ByteArrayToStructureLittleEndian(buf); AaruConsole.ErrorWriteLine($"{nop.reason}"); - return new DeviceInfo[0]; + return Array.Empty(); } if(hdr.version != Consts.PACKET_VERSION) { AaruConsole.ErrorWriteLine("Unrecognized packet version..."); - return new DeviceInfo[0]; + return Array.Empty(); } 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(); } AaruPacketResponseListDevices response = diff --git a/Aaru.Filesystems/AppleMFS/File.cs b/Aaru.Filesystems/AppleMFS/File.cs index f989c78b4..5928cc471 100644 --- a/Aaru.Filesystems/AppleMFS/File.cs +++ b/Aaru.Filesystems/AppleMFS/File.cs @@ -184,7 +184,7 @@ namespace Aaru.Filesystems if(size == 0) { - buf = new byte[0]; + buf = Array.Empty(); return Errno.NoError; } @@ -328,7 +328,7 @@ namespace Aaru.Filesystems { if(entry.flRPyLen == 0) { - buf = new byte[0]; + buf = Array.Empty(); return Errno.NoError; } @@ -339,7 +339,7 @@ namespace Aaru.Filesystems { if(entry.flPyLen == 0) { - buf = new byte[0]; + buf = Array.Empty(); return Errno.NoError; } diff --git a/Aaru.Filesystems/CPM/File.cs b/Aaru.Filesystems/CPM/File.cs index 89983bb64..156fde0a3 100644 --- a/Aaru.Filesystems/CPM/File.cs +++ b/Aaru.Filesystems/CPM/File.cs @@ -88,7 +88,7 @@ namespace Aaru.Filesystems if(size == 0) { - buf = new byte[0]; + buf = Array.Empty(); return Errno.NoError; } diff --git a/Aaru.Filesystems/FAT/File.cs b/Aaru.Filesystems/FAT/File.cs index 1401101ed..741da0c7b 100644 --- a/Aaru.Filesystems/FAT/File.cs +++ b/Aaru.Filesystems/FAT/File.cs @@ -104,7 +104,7 @@ namespace Aaru.Filesystems if(size == 0) { - buf = new byte[0]; + buf = Array.Empty(); return Errno.NoError; } @@ -223,7 +223,7 @@ namespace Aaru.Filesystems uint[] GetClusters(uint startCluster) { if(startCluster == 0) - return new uint[0]; + return Array.Empty(); if(startCluster >= XmlFsType.Clusters) return null; diff --git a/Aaru.Filesystems/ISO9660/Dir.cs b/Aaru.Filesystems/ISO9660/Dir.cs index 06b05bfde..61a1aeb00 100644 --- a/Aaru.Filesystems/ISO9660/Dir.cs +++ b/Aaru.Filesystems/ISO9660/Dir.cs @@ -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[] 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[] newNm = new byte[entry.RockRidgeAlternateName.Length + nm.Length]; Array.Copy(entry.RockRidgeAlternateName, 0, newNm, 0, entry.RockRidgeAlternateName.Length); diff --git a/Aaru.Filesystems/ISO9660/File.cs b/Aaru.Filesystems/ISO9660/File.cs index 4b60d8928..6185d123c 100644 --- a/Aaru.Filesystems/ISO9660/File.cs +++ b/Aaru.Filesystems/ISO9660/File.cs @@ -114,7 +114,7 @@ namespace Aaru.Filesystems if(entry.Size == 0) { - buf = new byte[0]; + buf = Array.Empty(); return Errno.NoError; } diff --git a/Aaru.Filesystems/ISO9660/Info.cs b/Aaru.Filesystems/ISO9660/Info.cs index 5806b37a5..3f321a0ef 100644 --- a/Aaru.Filesystems/ISO9660/Info.cs +++ b/Aaru.Filesystems/ISO9660/Info.cs @@ -280,7 +280,7 @@ namespace Aaru.Filesystems } } - byte[] rootDir = new byte[0]; + byte[] rootDir = Array.Empty(); int rootOff = 0; bool xaExtensions = false; bool apple = false; diff --git a/Aaru.Filesystems/ISO9660/Xattr.cs b/Aaru.Filesystems/ISO9660/Xattr.cs index 2636966b5..56a42e9cb 100644 --- a/Aaru.Filesystems/ISO9660/Xattr.cs +++ b/Aaru.Filesystems/ISO9660/Xattr.cs @@ -137,7 +137,7 @@ namespace Aaru.Filesystems if(entry.AssociatedFile.Size == 0) { - buf = new byte[0]; + buf = Array.Empty(); return Errno.NoError; } @@ -172,7 +172,7 @@ namespace Aaru.Filesystems if(entry.ResourceFork.Size == 0) { - buf = new byte[0]; + buf = Array.Empty(); return Errno.NoError; } diff --git a/Aaru.Filesystems/LisaFS/File.cs b/Aaru.Filesystems/LisaFS/File.cs index ab5d856a6..a072e867d 100644 --- a/Aaru.Filesystems/LisaFS/File.cs +++ b/Aaru.Filesystems/LisaFS/File.cs @@ -64,7 +64,7 @@ namespace Aaru.Filesystems.LisaFS { if(size == 0) { - buf = new byte[0]; + buf = Array.Empty(); return Errno.NoError; } diff --git a/Aaru.Filesystems/Nintendo.cs b/Aaru.Filesystems/Nintendo.cs index 26f48f946..6e74faf71 100644 --- a/Aaru.Filesystems/Nintendo.cs +++ b/Aaru.Filesystems/Nintendo.cs @@ -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(); + fields.SecondPartitions = Array.Empty(); + fields.ThirdPartitions = Array.Empty(); + fields.FourthPartitions = Array.Empty(); } AaruConsole.DebugWriteLine("Nintendo plugin", "discType = {0}", fields.DiscType); diff --git a/Aaru.Filesystems/Opera/File.cs b/Aaru.Filesystems/Opera/File.cs index 761fe42e4..930ff7a5e 100644 --- a/Aaru.Filesystems/Opera/File.cs +++ b/Aaru.Filesystems/Opera/File.cs @@ -102,7 +102,7 @@ namespace Aaru.Filesystems if(entry.Entry.byte_count == 0) { - buf = new byte[0]; + buf = Array.Empty(); return Errno.NoError; } diff --git a/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs b/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs index 25797330c..f7e2d3204 100644 --- a/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs @@ -288,7 +288,7 @@ namespace Aaru.Gui.ViewModels.Panels try { - byte[] outBuf = new byte[0]; + byte[] outBuf = Array.Empty(); Errno error = _model.Plugin.Read(_model.Path + "/" + file.Name, 0, file.Stat.Length, ref outBuf); diff --git a/Aaru.Images/AaruFormat/Write.cs b/Aaru.Images/AaruFormat/Write.cs index 88eeb2347..f4518b3c6 100644 --- a/Aaru.Images/AaruFormat/Write.cs +++ b/Aaru.Images/AaruFormat/Write.cs @@ -1765,7 +1765,7 @@ namespace Aaru.DiscImages var cmpCrc64Context = new Crc64Context(); - byte[] lzmaProperties = new byte[0]; + byte[] lzmaProperties = Array.Empty(); switch(_currentBlockHeader.compression) { @@ -2498,7 +2498,7 @@ namespace Aaru.DiscImages var cmpCrc64Context = new Crc64Context(); - byte[] lzmaProperties = new byte[0]; + byte[] lzmaProperties = Array.Empty(); if(_currentBlockHeader.compression == CompressionType.Flac) { diff --git a/Aaru.Tests/Filesystems/ReadOnlyFilesystemTest.cs b/Aaru.Tests/Filesystems/ReadOnlyFilesystemTest.cs index c98c9a30f..48e246859 100644 --- a/Aaru.Tests/Filesystems/ReadOnlyFilesystemTest.cs +++ b/Aaru.Tests/Filesystems/ReadOnlyFilesystemTest.cs @@ -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(); if(child.Value.Info.Attributes.HasFlag(FileAttributes.Directory)) { @@ -402,7 +402,7 @@ namespace Aaru.Tests.Filesystems foreach(KeyValuePair xattr in xattrs) { - byte[] buffer = new byte[0]; + byte[] buffer = Array.Empty(); Errno ret = fs.GetXattr(path, xattr.Key, ref buffer); if(ret == Errno.NoSuchExtendedAttribute || diff --git a/Aaru.Tests/Issues/FsExtractHashIssueTest.cs b/Aaru.Tests/Issues/FsExtractHashIssueTest.cs index 28822f130..752bdb9e0 100644 --- a/Aaru.Tests/Issues/FsExtractHashIssueTest.cs +++ b/Aaru.Tests/Issues/FsExtractHashIssueTest.cs @@ -213,7 +213,7 @@ namespace Aaru.Tests.Issues expectedXattrs.Remove(xattr); - byte[] xattrBuf = new byte[0]; + byte[] xattrBuf = Array.Empty(); 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(); error = fs.Read(path + "/" + entry, 0, stat.Length, ref outBuf); diff --git a/Aaru.Tests/Issues/FsExtractIssueTest.cs b/Aaru.Tests/Issues/FsExtractIssueTest.cs index 4c4aebeac..6cb78e61f 100644 --- a/Aaru.Tests/Issues/FsExtractIssueTest.cs +++ b/Aaru.Tests/Issues/FsExtractIssueTest.cs @@ -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(); 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(); error = fs.Read(path + "/" + entry, 0, stat.Length, ref outBuf); diff --git a/Aaru/Commands/Filesystem/ExtractFiles.cs b/Aaru/Commands/Filesystem/ExtractFiles.cs index 466d07d2b..3af082528 100644 --- a/Aaru/Commands/Filesystem/ExtractFiles.cs +++ b/Aaru/Commands/Filesystem/ExtractFiles.cs @@ -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(); 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(); error = fs.Read(path + "/" + entry, 0, stat.Length, ref outBuf); diff --git a/Aaru/Commands/Filesystem/Ls.cs b/Aaru/Commands/Filesystem/Ls.cs index b6fba65f3..ca13ce376 100644 --- a/Aaru/Commands/Filesystem/Ls.cs +++ b/Aaru/Commands/Filesystem/Ls.cs @@ -355,7 +355,7 @@ namespace Aaru.Commands.Filesystem foreach(string xattr in xattrs) { - byte[] xattrBuf = new byte[0]; + byte[] xattrBuf = Array.Empty(); error = fs.GetXattr(path + "/" + entry.Key, xattr, ref xattrBuf); if(error == Errno.NoError)