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

@@ -97,7 +97,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
if(debug) catalogMs.Write(catSectorB, 0, catSectorB.Length);
// Read the catalog sector
CatalogSector catSector = new CatalogSector();
CatalogSector catSector;
IntPtr catPtr = Marshal.AllocHGlobal(256);
Marshal.Copy(catSectorB, 0, catPtr, 256);
catSector = (CatalogSector)Marshal.PtrToStructure(catPtr, typeof(CatalogSector));

View File

@@ -182,7 +182,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
if(debug) tsListMs.Write(tsSectorB, 0, tsSectorB.Length);
// Read the track/sector list sector
TrackSectorList tsSector = new TrackSectorList();
TrackSectorList tsSector;
IntPtr tsPtr = Marshal.AllocHGlobal(256);
Marshal.Copy(tsSectorB, 0, tsPtr, 256);
tsSector = (TrackSectorList)Marshal.PtrToStructure(tsPtr, typeof(TrackSectorList));

View File

@@ -47,7 +47,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
if(partition.Start > 0 || imagePlugin.ImageInfo.SectorSize != 256) return false;
int spt = 0;
int spt;
if(imagePlugin.ImageInfo.Sectors == 455) spt = 13;
else spt = 16;
@@ -67,7 +67,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
information = "";
StringBuilder sb = new StringBuilder();
int spt = 0;
int spt;
if(imagePlugin.ImageInfo.Sectors == 455) spt = 13;
else spt = 16;

View File

@@ -126,8 +126,8 @@ namespace DiscImageChef.Filesystems
StringBuilder sb = new StringBuilder();
HFS_MasterDirectoryBlock MDB = new HFS_MasterDirectoryBlock();
HFS_BootBlock BB = new HFS_BootBlock();
HFS_MasterDirectoryBlock MDB;
HFS_BootBlock BB;
byte[] bb_sector = null;
byte[] mdb_sector = null;

View File

@@ -102,7 +102,7 @@ namespace DiscImageChef.Filesystems
StringBuilder sb = new StringBuilder();
AtheosSuperBlock afs_sb = new AtheosSuperBlock();
AtheosSuperBlock afs_sb;
ulong sector = AFS_BOOTBLOCK_SIZE / imagePlugin.GetSectorSize();
uint offset = AFS_BOOTBLOCK_SIZE % imagePlugin.GetSectorSize();

View File

@@ -122,7 +122,7 @@ namespace DiscImageChef.Filesystems
byte[] sb_sector = imagePlugin.ReadSector(0 + partition.Start);
bool littleEndian = true;
bool littleEndian;
besb.magic1 = BigEndianBitConverter.ToUInt32(sb_sector, 0x20);
if(besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // Magic is at offset

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++;

View File

@@ -249,7 +249,6 @@ namespace DiscImageChef.Filesystems
{ rootMs.Write(tmp, 0, tmp.Length); }
byte[] root_dir = rootMs.ToArray();
rootMs = null;
bool valid_root_dir = true;
// Iterate all root directory
@@ -612,7 +611,6 @@ namespace DiscImageChef.Filesystems
{ rootMs.Write(tmp, 0, tmp.Length); }
byte[] root_dir = rootMs.ToArray();
rootMs = null;
bool valid_root_dir = true;
// Iterate all root directory
@@ -1313,7 +1311,6 @@ namespace DiscImageChef.Filesystems
{ rootMs.Write(tmp, 0, tmp.Length); }
root_directory = rootMs.ToArray();
rootMs = null;
}
for(int i = 0; i < root_directory.Length; i += 32)

View File

@@ -78,7 +78,7 @@ namespace DiscImageChef.Filesystems
{
if(imagePlugin.GetSectorSize() < 512) return false;
FATX_Superblock fatxSb = new FATX_Superblock();
FATX_Superblock fatxSb;
byte[] sector = imagePlugin.ReadSector(partition.Start);
fatxSb = BigEndianMarshal.ByteArrayToStructureBigEndian<FATX_Superblock>(sector);
@@ -92,7 +92,7 @@ namespace DiscImageChef.Filesystems
information = "";
if(imagePlugin.GetSectorSize() < 512) return;
FATX_Superblock fatxSb = new FATX_Superblock();
FATX_Superblock fatxSb;
byte[] sector = imagePlugin.ReadSector(partition.Start);

View File

@@ -153,7 +153,7 @@ namespace DiscImageChef.Filesystems
{
ulong hdrSector = HeaderPos / imagePlugin.GetSectorSize();
FossilHeader hdr = new FossilHeader();
FossilHeader hdr;
if(partition.Start + hdrSector > imagePlugin.GetSectors()) return false;
@@ -174,7 +174,7 @@ namespace DiscImageChef.Filesystems
ulong hdrSector = HeaderPos / imagePlugin.GetSectorSize();
FossilHeader hdr = new FossilHeader();
FossilHeader hdr;
byte[] sector = imagePlugin.ReadSector(partition.Start + hdrSector);
hdr = BigEndianMarshal.ByteArrayToStructureBigEndian<FossilHeader>(sector);

View File

@@ -97,7 +97,7 @@ namespace DiscImageChef.Filesystems
StringBuilder sb = new StringBuilder();
HammerSuperBlock hammer_sb = new HammerSuperBlock();
HammerSuperBlock hammer_sb;
uint run = HAMMER_VOLHDR_SIZE / imagePlugin.GetSectorSize();

View File

@@ -90,12 +90,9 @@ namespace DiscImageChef.Filesystems
StringBuilder sb = new StringBuilder();
HPFS_BIOSParameterBlock hpfs_bpb = new HPFS_BIOSParameterBlock();
HPFS_SuperBlock hpfs_sb = new HPFS_SuperBlock();
HPFS_SpareBlock hpfs_sp = new HPFS_SpareBlock();
byte[] oem_name = new byte[8];
byte[] volume_name = new byte[11];
HPFS_BIOSParameterBlock hpfs_bpb;
HPFS_SuperBlock hpfs_sb;
HPFS_SpareBlock hpfs_sp;
byte[] hpfs_bpb_sector =
imagePlugin.ReadSector(0 + partition.Start); // Seek to BIOS parameter block, on logical sector 0

View File

@@ -154,7 +154,6 @@ namespace DiscImageChef.Filesystems.ISO9660
{
case 0:
{
bvd = new BootRecord();
IntPtr ptr = Marshal.AllocHGlobal(2048);
Marshal.Copy(vd_sector, hs_off, ptr, 2048 - hs_off);
bvd = (BootRecord)Marshal.PtrToStructure(ptr, typeof(BootRecord));
@@ -165,7 +164,6 @@ namespace DiscImageChef.Filesystems.ISO9660
if(CurrentEncoding.GetString(bvd.Value.system_id).Substring(0, 23) == "EL TORITO SPECIFICATION")
{
BootSpec = "El Torito";
torito = new ElToritoBootRecord();
ptr = Marshal.AllocHGlobal(2048);
Marshal.Copy(vd_sector, hs_off, ptr, 2048 - hs_off);
torito = (ElToritoBootRecord)Marshal.PtrToStructure(ptr, typeof(ElToritoBootRecord));
@@ -178,7 +176,6 @@ namespace DiscImageChef.Filesystems.ISO9660
{
if(HighSierra)
{
hsvd = new HighSierraPrimaryVolumeDescriptor();
IntPtr ptr = Marshal.AllocHGlobal(2048);
Marshal.Copy(vd_sector, 0, ptr, 2048);
hsvd =
@@ -192,7 +189,6 @@ namespace DiscImageChef.Filesystems.ISO9660
.ByteArrayToStructureBigEndian<FileStructureVolumeDescriptor>(vd_sector);
else
{
pvd = new PrimaryVolumeDescriptor();
IntPtr ptr = Marshal.AllocHGlobal(2048);
Marshal.Copy(vd_sector, 0, ptr, 2048);
pvd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor));
@@ -202,7 +198,7 @@ namespace DiscImageChef.Filesystems.ISO9660
}
case 2:
{
PrimaryVolumeDescriptor svd = new PrimaryVolumeDescriptor();
PrimaryVolumeDescriptor svd;
IntPtr ptr = Marshal.AllocHGlobal(2048);
Marshal.Copy(vd_sector, 0, ptr, 2048);
svd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor));
@@ -565,7 +561,7 @@ namespace DiscImageChef.Filesystems.ISO9660
if(vd_sector[torito_off] != 1) goto exit_torito;
ElToritoValidationEntry valentry = new ElToritoValidationEntry();
ElToritoValidationEntry valentry;
IntPtr ptr = Marshal.AllocHGlobal(ElToritoEntrySize);
Marshal.Copy(vd_sector, torito_off, ptr, ElToritoEntrySize);
valentry = (ElToritoValidationEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoValidationEntry));
@@ -575,7 +571,7 @@ namespace DiscImageChef.Filesystems.ISO9660
torito_off += ElToritoEntrySize;
ElToritoInitialEntry initial_entry = new ElToritoInitialEntry();
ElToritoInitialEntry initial_entry;
ptr = Marshal.AllocHGlobal(ElToritoEntrySize);
Marshal.Copy(vd_sector, torito_off, ptr, ElToritoEntrySize);
initial_entry = (ElToritoInitialEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoInitialEntry));
@@ -637,7 +633,7 @@ namespace DiscImageChef.Filesystems.ISO9660
while(torito_off < vd_sector.Length && (vd_sector[torito_off] == (byte)ElToritoIndicator.Header ||
vd_sector[torito_off] == (byte)ElToritoIndicator.LastHeader))
{
ElToritoSectionHeaderEntry section_header = new ElToritoSectionHeaderEntry();
ElToritoSectionHeaderEntry section_header;
ptr = Marshal.AllocHGlobal(ElToritoEntrySize);
Marshal.Copy(vd_sector, torito_off, ptr, ElToritoEntrySize);
section_header =
@@ -652,7 +648,7 @@ namespace DiscImageChef.Filesystems.ISO9660
for(int entry_counter = 1; entry_counter <= section_header.entries && torito_off < vd_sector.Length;
entry_counter++)
{
ElToritoSectionEntry section_entry = new ElToritoSectionEntry();
ElToritoSectionEntry section_entry;
ptr = Marshal.AllocHGlobal(ElToritoEntrySize);
Marshal.Copy(vd_sector, torito_off, ptr, ElToritoEntrySize);
section_entry = (ElToritoSectionEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntry));
@@ -716,7 +712,7 @@ namespace DiscImageChef.Filesystems.ISO9660
while(true && torito_off < vd_sector.Length)
{
ElToritoSectionEntryExtension section_extension = new ElToritoSectionEntryExtension();
ElToritoSectionEntryExtension section_extension;
ptr = Marshal.AllocHGlobal(ElToritoEntrySize);
Marshal.Copy(vd_sector, torito_off, ptr, ElToritoEntrySize);
section_extension =

View File

@@ -90,7 +90,7 @@ namespace DiscImageChef.Filesystems
{
if(imagePlugin.GetSectorSize() < 256) return false;
LIF_SystemBlock LIFSb = new LIF_SystemBlock();
LIF_SystemBlock LIFSb;
byte[] sector = imagePlugin.ReadSector(partition.Start);
LIFSb = BigEndianMarshal.ByteArrayToStructureBigEndian<LIF_SystemBlock>(sector);
@@ -106,7 +106,7 @@ namespace DiscImageChef.Filesystems
if(imagePlugin.GetSectorSize() < 256) return;
LIF_SystemBlock LIFSb = new LIF_SystemBlock();
LIF_SystemBlock LIFSb;
byte[] sector = imagePlugin.ReadSector(partition.Start);
LIFSb = BigEndianMarshal.ByteArrayToStructureBigEndian<LIF_SystemBlock>(sector);

View File

@@ -113,6 +113,7 @@ namespace DiscImageChef.Filesystems.LisaFS
{
byte[] buf;
error = ReadFile((short)FILEID_CATALOG, out buf);
if(error != Errno.NoError) return error;
int offset = 0;
List<CatalogEntryV2> catalogV2 = new List<CatalogEntryV2>();
@@ -296,7 +297,7 @@ namespace DiscImageChef.Filesystems.LisaFS
stat = new FileEntryInfo();
stat.Attributes = new FileAttributes();
DateTime tmp = new DateTime();
DateTime tmp;
directoryDTCCache.TryGetValue(dirId, out tmp);
stat.CreationTime = tmp;

View File

@@ -76,7 +76,7 @@ namespace DiscImageChef.Filesystems
if(imagePlugin.GetSectorSize() < 512) return false;
MicroDOSBlock0 block0 = new MicroDOSBlock0();
MicroDOSBlock0 block0;
byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start);
@@ -93,7 +93,7 @@ namespace DiscImageChef.Filesystems
information = "";
StringBuilder sb = new StringBuilder();
MicroDOSBlock0 block0 = new MicroDOSBlock0();
MicroDOSBlock0 block0;
byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start);

View File

@@ -160,7 +160,7 @@ namespace DiscImageChef.Filesystems
xmlFSType = new FileSystemType();
bool littleEndian = true;
bool littleEndian;
if(magic == MINIX3_MAGIC || magic == MINIX3_CIGAM || magic == MINIX2_MAGIC || magic == MINIX2_CIGAM ||
magic == MINIX_MAGIC || magic == MINIX_CIGAM)
@@ -247,7 +247,7 @@ namespace DiscImageChef.Filesystems
if(minix3)
{
Minix3SuperBlock mnx_sb = new Minix3SuperBlock();
Minix3SuperBlock mnx_sb;
if(littleEndian)
{
@@ -285,7 +285,7 @@ namespace DiscImageChef.Filesystems
}
else
{
MinixSuperBlock mnx_sb = new MinixSuperBlock();
MinixSuperBlock mnx_sb;
if(littleEndian)
{

View File

@@ -103,29 +103,27 @@ namespace DiscImageChef.Filesystems
byte[] ntfs_bpb = imagePlugin.ReadSector(0 + partition.Start);
NTFS_BootBlock ntfs_bb = new NTFS_BootBlock();
NTFS_BootBlock ntfs_bb;
IntPtr bpbPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(ntfs_bpb, 0, bpbPtr, 512);
ntfs_bb = (NTFS_BootBlock)Marshal.PtrToStructure(bpbPtr, typeof(NTFS_BootBlock));
Marshal.FreeHGlobal(bpbPtr);
byte[] oem_name = new byte[8];
sb.AppendFormat("{0} bytes per sector", ntfs_bb.bps).AppendLine();
sb.AppendFormat("{0} sectors per cluster ({1} bytes)", ntfs_bb.spc, ntfs_bb.spc * ntfs_bb.bps).AppendLine();
// sb.AppendFormat("{0} reserved sectors", ntfs_bb.rsectors).AppendLine();
// sb.AppendFormat("{0} FATs", ntfs_bb.fats_no).AppendLine();
// sb.AppendFormat("{0} entries in the root folder", ntfs_bb.root_ent).AppendLine();
// sb.AppendFormat("{0} sectors on volume (small)", ntfs_bb.sml_sectors).AppendLine();
// sb.AppendFormat("{0} reserved sectors", ntfs_bb.rsectors).AppendLine();
// sb.AppendFormat("{0} FATs", ntfs_bb.fats_no).AppendLine();
// sb.AppendFormat("{0} entries in the root folder", ntfs_bb.root_ent).AppendLine();
// sb.AppendFormat("{0} sectors on volume (small)", ntfs_bb.sml_sectors).AppendLine();
sb.AppendFormat("Media descriptor: 0x{0:X2}", ntfs_bb.media).AppendLine();
// sb.AppendFormat("{0} sectors per FAT", ntfs_bb.spfat).AppendLine();
// sb.AppendFormat("{0} sectors per FAT", ntfs_bb.spfat).AppendLine();
sb.AppendFormat("{0} sectors per track", ntfs_bb.sptrk).AppendLine();
sb.AppendFormat("{0} heads", ntfs_bb.heads).AppendLine();
sb.AppendFormat("{0} hidden sectors before filesystem", ntfs_bb.hsectors).AppendLine();
// sb.AppendFormat("{0} sectors on volume (big)", ntfs_bb.big_sectors).AppendLine();
// sb.AppendFormat("{0} sectors on volume (big)", ntfs_bb.big_sectors).AppendLine();
sb.AppendFormat("BIOS drive number: 0x{0:X2}", ntfs_bb.drive_no).AppendLine();
// sb.AppendFormat("NT flags: 0x{0:X2}", ntfs_bb.nt_flags).AppendLine();
// sb.AppendFormat("Signature 1: 0x{0:X2}", ntfs_bb.signature1).AppendLine();
// sb.AppendFormat("NT flags: 0x{0:X2}", ntfs_bb.nt_flags).AppendLine();
// sb.AppendFormat("Signature 1: 0x{0:X2}", ntfs_bb.signature1).AppendLine();
sb.AppendFormat("{0} sectors on volume ({1} bytes)", ntfs_bb.sectors, ntfs_bb.sectors * ntfs_bb.bps)
.AppendLine();
sb.AppendFormat("Cluster where $MFT starts: {0}", ntfs_bb.mft_lsn).AppendLine();
@@ -141,7 +139,7 @@ namespace DiscImageChef.Filesystems
else sb.AppendFormat("{0} bytes per Index block", 1 << -ntfs_bb.index_blk_cts).AppendLine();
sb.AppendFormat("Volume serial number: {0:X16}", ntfs_bb.serial_no).AppendLine();
// sb.AppendFormat("Signature 2: 0x{0:X4}", ntfs_bb.signature2).AppendLine();
// sb.AppendFormat("Signature 2: 0x{0:X4}", ntfs_bb.signature2).AppendLine();
xmlFSType = new FileSystemType();

View File

@@ -100,9 +100,10 @@ namespace DiscImageChef.Filesystems
uint magicGC = BigEndianBitConverter.ToUInt32(header, 0x1C);
uint magicWii = BigEndianBitConverter.ToUInt32(header, 0x18);
if(magicGC == 0xC2339F3D) wii = false;
else if(magicWii == 0x5D1C9EA3) wii = true;
else return;
if(magicWii == 0x5D1C9EA3)
wii = true;
else if(magicGC != 0xC2339F3D)
return;
fields.discType = Encoding.ASCII.GetString(header, 0, 1);
fields.gameCode = Encoding.ASCII.GetString(header, 1, 2);

View File

@@ -115,8 +115,7 @@ namespace DiscImageChef.Filesystems
information = "";
StringBuilder sb = new StringBuilder();
ODSHomeBlock homeblock = new ODSHomeBlock();
byte[] temp_string = new byte[12];
ODSHomeBlock homeblock;
homeblock.min_class = new byte[20];
homeblock.max_class = new byte[20];

View File

@@ -205,7 +205,7 @@ namespace DiscImageChef.Filesystems
out string information)
{
byte[] RootBlockSector = imagePlugin.ReadSector(2 + partition.Start);
RootBlock rootBlock = new RootBlock();
RootBlock rootBlock;
rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian<RootBlock>(RootBlockSector);
StringBuilder sbInformation = new StringBuilder();

View File

@@ -135,7 +135,7 @@ namespace DiscImageChef.Filesystems
byte[] sector = imagePlugin.ReadSector(partition.Start + 1);
if(sector.Length < 512) return false;
QNX4_Superblock qnxSb = new QNX4_Superblock();
QNX4_Superblock qnxSb;
IntPtr sbPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(sector, 0, sbPtr, 512);
qnxSb = (QNX4_Superblock)Marshal.PtrToStructure(sbPtr, typeof(QNX4_Superblock));
@@ -169,7 +169,7 @@ namespace DiscImageChef.Filesystems
byte[] sector = imagePlugin.ReadSector(partition.Start + 1);
if(sector.Length < 512) return;
QNX4_Superblock qnxSb = new QNX4_Superblock();
QNX4_Superblock qnxSb;
IntPtr sbPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(sector, 0, sbPtr, 512);
qnxSb = (QNX4_Superblock)Marshal.PtrToStructure(sbPtr, typeof(QNX4_Superblock));

View File

@@ -89,7 +89,7 @@ namespace DiscImageChef.Filesystems
information = "";
StringBuilder sb = new StringBuilder();
RT11HomeBlock homeblock = new RT11HomeBlock();
RT11HomeBlock homeblock;
byte[] hb_sector = imagePlugin.ReadSector(1 + partition.Start);

View File

@@ -121,7 +121,7 @@ namespace DiscImageChef.Filesystems
out string information)
{
byte[] RootBlockSector = imagePlugin.ReadSector(partition.Start);
RootBlock rootBlock = new RootBlock();
RootBlock rootBlock;
rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian<RootBlock>(RootBlockSector);
StringBuilder sbInformation = new StringBuilder();

View File

@@ -203,7 +203,7 @@ namespace DiscImageChef.Filesystems
uint s_fsize;
bool xenix = false;
bool sysv = false;
bool sysvr4 = false;
bool sysvr4;
bool sys7th = false;
bool coherent = false;
bool xenix3 = false;
@@ -500,8 +500,7 @@ namespace DiscImageChef.Filesystems
sysv_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002 + offset);
if(sysv_sb.s_fsize * bs > 0 && sysv_sb.s_fsize * bs == partition.Size) sysvr4 = false;
else sysvr4 = true;
sysvr4 = sysv_sb.s_fsize * bs <= 0 || sysv_sb.s_fsize * bs != partition.Size;
if(sysvr4)
{

View File

@@ -337,7 +337,7 @@ namespace DiscImageChef.Filesystems
if(nvlist == null || nvlist.Length < 16) return false;
int offset = 0;
int offset;
if(!xdr) return false;
BigEndianBitConverter.IsLittleEndian = littleEndian;

View File

@@ -74,7 +74,7 @@ namespace DiscImageChef.Filesystems
byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start);
if(vbrSector.Length < 512) return false;
VolumeBootRecord vbr = new VolumeBootRecord();
VolumeBootRecord vbr;
IntPtr vbrPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(vbrSector, 0, vbrPtr, 512);
vbr = (VolumeBootRecord)Marshal.PtrToStructure(vbrPtr, typeof(VolumeBootRecord));
@@ -91,21 +91,21 @@ namespace DiscImageChef.Filesystems
xmlFSType = new FileSystemType();
byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start);
VolumeBootRecord vbr = new VolumeBootRecord();
VolumeBootRecord vbr;
IntPtr vbrPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(vbrSector, 0, vbrPtr, 512);
vbr = (VolumeBootRecord)Marshal.PtrToStructure(vbrPtr, typeof(VolumeBootRecord));
Marshal.FreeHGlobal(vbrPtr);
byte[] parametersSector = imagePlugin.ReadSector(9 + partition.Start);
OemParameterTable parametersTable = new OemParameterTable();
OemParameterTable parametersTable;
IntPtr parametersPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(parametersSector, 0, parametersPtr, 512);
parametersTable = (OemParameterTable)Marshal.PtrToStructure(parametersPtr, typeof(OemParameterTable));
Marshal.FreeHGlobal(parametersPtr);
byte[] chkSector = imagePlugin.ReadSector(11 + partition.Start);
ChecksumSector chksector = new ChecksumSector();
ChecksumSector chksector;
IntPtr chkPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(chkSector, 0, chkPtr, 512);
chksector = (ChecksumSector)Marshal.PtrToStructure(chkPtr, typeof(ChecksumSector));

View File

@@ -98,14 +98,10 @@ namespace DiscImageChef.Filesystems
StringBuilder sb = new StringBuilder();
ext2FSSuperBlock supblk = new ext2FSSuperBlock();
byte[] forstrings;
bool new_ext2 = false;
bool ext3 = false;
bool ext4 = false;
byte[] guid_a = new byte[16];
byte[] guid_b = new byte[16];
int sb_size_in_bytes = Marshal.SizeOf(typeof(ext2FSSuperBlock));
uint sb_size_in_sectors = (uint)(sb_size_in_bytes / imagePlugin.GetSectorSize());
if(sb_size_in_bytes % imagePlugin.GetSectorSize() > 0) sb_size_in_sectors++;