Use new little endian marshaller on filesystems.

This commit is contained in:
2019-03-01 00:28:55 +00:00
parent f95633046e
commit 0ec558da55
45 changed files with 154 additions and 531 deletions

View File

@@ -67,10 +67,7 @@ namespace DiscImageChef.Filesystems
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
if(sector.Length < Marshal.SizeOf(nilfsSb)) return false;
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(nilfsSb));
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(nilfsSb));
nilfsSb = (NILFS2_Superblock)Marshal.PtrToStructure(sbPtr, typeof(NILFS2_Superblock));
Marshal.FreeHGlobal(sbPtr);
nilfsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<NILFS2_Superblock>(sector);
return nilfsSb.magic == NILFS2_MAGIC;
}
@@ -93,10 +90,7 @@ namespace DiscImageChef.Filesystems
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
if(sector.Length < Marshal.SizeOf(nilfsSb)) return;
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(nilfsSb));
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(nilfsSb));
nilfsSb = (NILFS2_Superblock)Marshal.PtrToStructure(sbPtr, typeof(NILFS2_Superblock));
Marshal.FreeHGlobal(sbPtr);
nilfsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<NILFS2_Superblock>(sector);
if(nilfsSb.magic != NILFS2_MAGIC) return;