Remove redundant assignments.

This commit is contained in:
2021-08-17 14:40:50 +01:00
parent a715b9b351
commit c6f5ece939
13 changed files with 15 additions and 41 deletions

View File

@@ -52,7 +52,7 @@ namespace Aaru.Core.Devices.Scanning
MhddLog mhddLog; MhddLog mhddLog;
IbgLog ibgLog; IbgLog ibgLog;
byte[] senseBuf; byte[] senseBuf;
bool sense = false; bool sense;
uint blockSize = 0; uint blockSize = 0;
ushort currentProfile = 0x0001; ushort currentProfile = 0x0001;
bool foundReadCommand = false; bool foundReadCommand = false;

View File

@@ -131,7 +131,7 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.SectorSize < 512) if(imagePlugin.Info.SectorSize < 512)
return; return;
var efsSb = new Superblock(); Superblock efsSb;
// Misaligned // Misaligned
if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc)

View File

@@ -422,7 +422,6 @@ namespace Aaru.Filesystems
fat1Sector0[1] == 0xFF && fat1Sector0[1] == 0xFF &&
validRootDir) validRootDir)
{ {
useDecRainbowBpb = true;
AaruConsole.DebugWriteLine("FAT plugin", "Using DEC Rainbow hardcoded BPB."); AaruConsole.DebugWriteLine("FAT plugin", "Using DEC Rainbow hardcoded BPB.");
fakeBpb.bps = 512; fakeBpb.bps = 512;
fakeBpb.spc = 1; fakeBpb.spc = 1;

View File

@@ -146,7 +146,6 @@ namespace Aaru.Filesystems
byte[] eas = new byte[size]; byte[] eas = new byte[size];
Array.Copy(full, 0, eas, 0, size); Array.Copy(full, 0, eas, 0, size);
full = null;
eaMs.Close(); eaMs.Close();
return GetEas(eas); return GetEas(eas);

View File

@@ -279,10 +279,10 @@ namespace Aaru.Filesystems
ulong count = 0; ulong count = 0;
var pvd = new PrimaryVolumeDescriptor(); var pvd = new PrimaryVolumeDescriptor();
var lvd = new LogicalVolumeDescriptor(); var lvd = new LogicalVolumeDescriptor();
var lvid = new LogicalVolumeIntegrityDescriptor(); LogicalVolumeIntegrityDescriptor lvid;
var lvidiu = new LogicalVolumeIntegrityDescriptorImplementationUse(); var lvidiu = new LogicalVolumeIntegrityDescriptorImplementationUse();
while(count < 256) while(count < 256)
{ {

View File

@@ -466,7 +466,6 @@ namespace Aaru.DiscImages
case DataType.CdSectorPrefixCorrected: case DataType.CdSectorPrefixCorrected:
case DataType.CdSectorSuffixCorrected: case DataType.CdSectorSuffixCorrected:
{ {
uint[] cdDdt = new uint[ddtHeader.entries];
byte[] decompressedDdt = new byte[ddtHeader.length]; byte[] decompressedDdt = new byte[ddtHeader.length];
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
@@ -509,7 +508,7 @@ namespace Aaru.DiscImages
ImageNotSupportedException($"Found unsupported compression algorithm {(ushort)ddtHeader.compression}"); ImageNotSupportedException($"Found unsupported compression algorithm {(ushort)ddtHeader.compression}");
} }
cdDdt = MemoryMarshal.Cast<byte, uint>(decompressedDdt).ToArray(); uint[] cdDdt = MemoryMarshal.Cast<byte, uint>(decompressedDdt).ToArray();
switch(entry.dataType) switch(entry.dataType)
{ {

View File

@@ -787,7 +787,7 @@ namespace Aaru.DiscImages
string? filename = Path.GetFileNameWithoutExtension(splitStartChars.FilePath); string? filename = Path.GetFileNameWithoutExtension(splitStartChars.FilePath);
bool lowerCaseExtension = false; bool lowerCaseExtension = false;
bool lowerCaseFileName = false; bool lowerCaseFileName = false;
string basePath = ""; string basePath;
bool version5 = string.Compare(Path.GetExtension(imageFilter.GetFilename()), ".B5T", bool version5 = string.Compare(Path.GetExtension(imageFilter.GetFilename()), ".B5T",
StringComparison.OrdinalIgnoreCase) == 0; StringComparison.OrdinalIgnoreCase) == 0;

View File

@@ -294,10 +294,9 @@ namespace Aaru.DiscImages
foreach(byte[] blkxBytes in blkxList) foreach(byte[] blkxBytes in blkxList)
{ {
var bHdr = new BlockHeader(); byte[] bHdrB = new byte[Marshal.SizeOf<BlockHeader>()];
byte[] bHdrB = new byte[Marshal.SizeOf<BlockHeader>()];
Array.Copy(blkxBytes, 0, bHdrB, 0, Marshal.SizeOf<BlockHeader>()); Array.Copy(blkxBytes, 0, bHdrB, 0, Marshal.SizeOf<BlockHeader>());
bHdr = Marshal.ByteArrayToStructureBigEndian<BlockHeader>(bHdrB); BlockHeader bHdr = Marshal.ByteArrayToStructureBigEndian<BlockHeader>(bHdrB);
AaruConsole.DebugWriteLine("UDIF plugin", "bHdr.signature = 0x{0:X8}", bHdr.signature); AaruConsole.DebugWriteLine("UDIF plugin", "bHdr.signature = 0x{0:X8}", bHdr.signature);
AaruConsole.DebugWriteLine("UDIF plugin", "bHdr.version = {0}", bHdr.version); AaruConsole.DebugWriteLine("UDIF plugin", "bHdr.version = {0}", bHdr.version);
@@ -325,13 +324,12 @@ namespace Aaru.DiscImages
for(int i = 0; i < bHdr.chunks; i++) for(int i = 0; i < bHdr.chunks; i++)
{ {
var bChnk = new BlockChunk(); byte[] bChnkB = new byte[Marshal.SizeOf<BlockChunk>()];
byte[] bChnkB = new byte[Marshal.SizeOf<BlockChunk>()];
Array.Copy(blkxBytes, Marshal.SizeOf<BlockHeader>() + (Marshal.SizeOf<BlockChunk>() * i), bChnkB, 0, Array.Copy(blkxBytes, Marshal.SizeOf<BlockHeader>() + (Marshal.SizeOf<BlockChunk>() * i), bChnkB, 0,
Marshal.SizeOf<BlockChunk>()); Marshal.SizeOf<BlockChunk>());
bChnk = Marshal.ByteArrayToStructureBigEndian<BlockChunk>(bChnkB); BlockChunk bChnk = Marshal.ByteArrayToStructureBigEndian<BlockChunk>(bChnkB);
AaruConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].type = 0x{1:X8}", i, bChnk.type); AaruConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].type = 0x{1:X8}", i, bChnk.type);
AaruConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].comment = {1}", i, bChnk.comment); AaruConsole.DebugWriteLine("UDIF plugin", "bHdr.chunk[{0}].comment = {1}", i, bChnk.comment);

View File

@@ -73,8 +73,6 @@ namespace Aaru.Tests.Issues
ctx.Update(sector); ctx.Update(sector);
} }
previousTrackEnd = currentTrack.TrackEndSector;
} }
} }
} }

View File

@@ -170,7 +170,7 @@ namespace Aaru.Tests.WritableImages
Assert.IsTrue(outputFormat.SetTracks(inputFormat.Tracks), Assert.IsTrue(outputFormat.SetTracks(inputFormat.Tracks),
$"Error {outputFormat.ErrorMessage} sending tracks list to output image."); $"Error {outputFormat.ErrorMessage} sending tracks list to output image.");
ulong doneSectors = 0; ulong doneSectors;
foreach(Track track in inputFormat.Tracks) foreach(Track track in inputFormat.Tracks)
{ {

View File

@@ -286,25 +286,6 @@ namespace Aaru.Commands.Device
{ {
Identify.IdentifyDevice ATAID = decodedIdentify.Value; Identify.IdentifyDevice ATAID = decodedIdentify.Value;
uint blockSize;
if((ATAID.PhysLogSectorSize & 0x8000) == 0x0000 &&
(ATAID.PhysLogSectorSize & 0x4000) == 0x4000)
{
if((ATAID.PhysLogSectorSize & 0x1000) == 0x1000)
if(ATAID.LogicalSectorWords <= 255 ||
ATAID.LogicalAlignment == 0xFFFF)
blockSize = 512;
else
blockSize = ATAID.LogicalSectorWords * 2;
else
blockSize = 512;
}
else
{
blockSize = 512;
}
ulong blocks; ulong blocks;
if(ATAID.CurrentCylinders > 0 && if(ATAID.CurrentCylinders > 0 &&