REFACTOR: Removed unneeded value sets.

This commit is contained in:
2017-12-21 16:07:20 +00:00
parent 9883b567ff
commit bcbda18e4d
110 changed files with 203 additions and 280 deletions

View File

@@ -69,7 +69,7 @@ namespace DiscImageChef.Filesystems.CPM
for(int off = 0; off < directory.Length; off += 32)
{
DirectoryEntry entry = new DirectoryEntry();
DirectoryEntry entry;
IntPtr dirPtr = Marshal.AllocHGlobal(32);
Marshal.Copy(directory, off, dirPtr, 32);
entry = (DirectoryEntry)Marshal.PtrToStructure(dirPtr, typeof(DirectoryEntry));

View File

@@ -188,7 +188,7 @@ namespace DiscImageChef.Filesystems.CPM
if(sig1 == 0x4D2F5043 && sig2 == 0x004B5344 && sig3 == sig1) amsSbOffset = 0x80;
// Read the superblock
AmstradSuperBlock amsSb = new AmstradSuperBlock();
AmstradSuperBlock amsSb;
IntPtr amsPtr = Marshal.AllocHGlobal(16);
Marshal.Copy(sector, amsSbOffset, amsPtr, 16);
amsSb = (AmstradSuperBlock)Marshal.PtrToStructure(amsPtr, typeof(AmstradSuperBlock));
@@ -992,7 +992,7 @@ namespace DiscImageChef.Filesystems.CPM
.AppendLine();
int interleaveSide1;
int interleaveSide2 = 1;
int interleaveSide2;
if(workingDefinition.side1.sectorIds.Length >= 2)
{

View File

@@ -219,7 +219,7 @@ namespace DiscImageChef.Filesystems.CPM
if((directory[dOff] & 0x7F) < 0x10)
if(allocationBlocks.Count > 256)
{
DirectoryEntry16 entry = new DirectoryEntry16();
DirectoryEntry16 entry;
dirPtr = Marshal.AllocHGlobal(32);
Marshal.Copy(directory, dOff, dirPtr, 32);
entry = (DirectoryEntry16)Marshal.PtrToStructure(dirPtr, typeof(DirectoryEntry16));
@@ -313,7 +313,7 @@ namespace DiscImageChef.Filesystems.CPM
}
else
{
DirectoryEntry entry = new DirectoryEntry();
DirectoryEntry entry;
dirPtr = Marshal.AllocHGlobal(32);
Marshal.Copy(directory, dOff, dirPtr, 32);
entry = (DirectoryEntry)Marshal.PtrToStructure(dirPtr, typeof(DirectoryEntry));
@@ -408,7 +408,7 @@ namespace DiscImageChef.Filesystems.CPM
// A password entry (or a file entry in PDOS, but this does not handle that case)
else if((directory[dOff] & 0x7F) >= 0x10 && (directory[dOff] & 0x7F) < 0x20)
{
PasswordEntry entry = new PasswordEntry();
PasswordEntry entry;
dirPtr = Marshal.AllocHGlobal(32);
Marshal.Copy(directory, dOff, dirPtr, 32);
entry = (PasswordEntry)Marshal.PtrToStructure(dirPtr, typeof(PasswordEntry));
@@ -617,7 +617,7 @@ namespace DiscImageChef.Filesystems.CPM
foreach(string filename in dirList)
{
MemoryStream fileMs = new MemoryStream();
FileEntryInfo fInfo = new FileEntryInfo();
FileEntryInfo fInfo;
if(statCache.TryGetValue(filename, out fInfo)) statCache.Remove(filename);
@@ -633,7 +633,7 @@ namespace DiscImageChef.Filesystems.CPM
foreach(ushort alBlk in alBlks)
{
byte[] blk = new byte[blockSize];
byte[] blk;
allocationBlocks.TryGetValue(alBlk, out blk);
fileMs.Write(blk, 0, blk.Length);
fInfo.Blocks++;