From c4af5bf241480db1861f8a8169a9051458225a87 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 24 Nov 2025 19:00:58 +0000 Subject: [PATCH] [Refactor] Call AddRange instead of Add. --- Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs | 2 +- Aaru.Core/Devices/Dumping/CompactDisc/Data.cs | 5 ++--- Aaru.Filesystems/CPM/Super.cs | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs index f3ac45526..8f7e5b485 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs @@ -439,7 +439,7 @@ partial class Dump { outputOptical.SetTracks(tracks.ToList()); - foreach(ulong newPregapSector in newPregapSectors) _resume.BadBlocks.Add(newPregapSector); + _resume.BadBlocks.AddRange(newPregapSectors); if(i >= blocksToRead) i -= blocksToRead; diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs index 1742444ea..3aefe3275 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs @@ -844,8 +844,7 @@ partial class Dump { (outputFormat as IWritableOpticalImage).SetTracks(tracks.ToList()); - foreach(ulong newPregapSector in newPregapSectors) - _resume.BadBlocks.Add(newPregapSector); + _resume.BadBlocks.AddRange(newPregapSectors); if(i >= blocksToRead) i -= blocksToRead; @@ -1109,7 +1108,7 @@ partial class Dump { (outputFormat as IWritableOpticalImage).SetTracks(tracks.ToList()); - foreach(ulong newPregapSector in newPregapSectors) _resume.BadBlocks.Add(newPregapSector); + _resume.BadBlocks.AddRange(newPregapSectors); if(i >= blocksToRead) i -= blocksToRead; diff --git a/Aaru.Filesystems/CPM/Super.cs b/Aaru.Filesystems/CPM/Super.cs index 592ca52d9..6ad643729 100644 --- a/Aaru.Filesystems/CPM/Super.cs +++ b/Aaru.Filesystems/CPM/Super.cs @@ -169,8 +169,9 @@ public sealed partial class CPM if(errno != ErrorNumber.NoError) return errno; if(_workingDefinition.complement) - for(var b = 0; b < readSector.Length; b++) - readSector[b] = (byte)(~readSector[b] & 0xFF); + { + for(var b = 0; b < readSector.Length; b++) readSector[b] = (byte)(~readSector[b] & 0xFF); + } deinterleavedSectors.Add((ulong)p, readSector); } @@ -340,8 +341,7 @@ public sealed partial class CPM // allocate block 0 for a file because that's where the directory resides. // There is also a field telling how many bytes are used in the last block, but its meaning is // non-standard so we must ignore it. - foreach(ushort blk in entry.allocations.Where(blk => !blocks.Contains(blk) && blk != 0)) - blocks.Add(blk); + blocks.AddRange(entry.allocations.Where(blk => !blocks.Contains(blk) && blk != 0)); // Save the file fInfo.UID = (ulong)user;