REFACTOR: Convert 'if' statement to 'switch' statement.

This commit is contained in:
2017-12-21 04:43:29 +00:00
parent df2fb651e4
commit 9cd1869d1d
55 changed files with 4429 additions and 4192 deletions

View File

@@ -123,17 +123,17 @@ namespace DiscImageChef.Filesystems
SquashSuperBlock sqSb = new SquashSuperBlock();
bool littleEndian = true;
if(magic == Squash_MAGIC)
{
IntPtr sqSbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(sqSb));
Marshal.Copy(sector, 0, sqSbPtr, Marshal.SizeOf(sqSb));
sqSb = (SquashSuperBlock)Marshal.PtrToStructure(sqSbPtr, typeof(SquashSuperBlock));
Marshal.FreeHGlobal(sqSbPtr);
}
else if(magic == Squash_CIGAM)
{
sqSb = BigEndianMarshal.ByteArrayToStructureBigEndian<SquashSuperBlock>(sector);
littleEndian = false;
switch(magic) {
case Squash_MAGIC:
IntPtr sqSbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(sqSb));
Marshal.Copy(sector, 0, sqSbPtr, Marshal.SizeOf(sqSb));
sqSb = (SquashSuperBlock)Marshal.PtrToStructure(sqSbPtr, typeof(SquashSuperBlock));
Marshal.FreeHGlobal(sqSbPtr);
break;
case Squash_CIGAM:
sqSb = BigEndianMarshal.ByteArrayToStructureBigEndian<SquashSuperBlock>(sector);
littleEndian = false;
break;
}
StringBuilder sbInformation = new StringBuilder();