diff --git a/DiscImageChef.Partitions/AppleMap.cs b/DiscImageChef.Partitions/AppleMap.cs index 903ef1916..e0cde6a8c 100644 --- a/DiscImageChef.Partitions/AppleMap.cs +++ b/DiscImageChef.Partitions/AppleMap.cs @@ -185,7 +185,7 @@ namespace DiscImageChef.Partitions uint skipDdm; // If sector is bigger than 512 - if(sectorSize > 512) + if(ddmSector.Length > 512) { byte[] tmp = new byte[512]; Array.Copy(ddmSector, 512, tmp, 0, 512); @@ -341,19 +341,19 @@ namespace DiscImageChef.Partitions struct AppleDriverDescriptorMap { /// Signature - public ushort sbSig; + public readonly ushort sbSig; /// Byter per sector - public ushort sbBlockSize; + public readonly ushort sbBlockSize; /// Sectors of the disk - public uint sbBlocks; + public readonly uint sbBlocks; /// Device type - public ushort sbDevType; + public readonly ushort sbDevType; /// Device ID - public ushort sbDevId; + public readonly ushort sbDevId; /// Reserved - public uint sbData; + public readonly uint sbData; /// Number of entries of the driver descriptor - public ushort sbDrvrCount; + public readonly ushort sbDrvrCount; /// Entries of the driver descriptor [MarshalAs(UnmanagedType.ByValArray, SizeConst = 61)] public AppleDriverEntry[] sbMap; @@ -363,32 +363,32 @@ namespace DiscImageChef.Partitions struct AppleDriverEntry { /// First sector of the driver - public uint ddBlock; + public readonly uint ddBlock; /// Size in 512bytes sectors of the driver - public ushort ddSize; + public readonly ushort ddSize; /// Operating system (MacOS = 1) - public ushort ddType; + public readonly ushort ddType; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AppleOldDevicePartitionMap { /// Signature - public ushort pdSig; + public readonly ushort pdSig; /// Entries of the driver descriptor [MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)] - public AppleMapOldPartitionEntry[] pdMap; + public readonly AppleMapOldPartitionEntry[] pdMap; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AppleMapOldPartitionEntry { /// First sector of the partition - public uint pdStart; + public readonly uint pdStart; /// Number of sectors of the partition - public uint pdSize; + public readonly uint pdSize; /// Partition type - public uint pdFSID; + public readonly uint pdFSID; } [Flags] @@ -424,47 +424,47 @@ namespace DiscImageChef.Partitions struct AppleMapPartitionEntry { /// Signature - public ushort signature; + public readonly ushort signature; /// Reserved - public ushort reserved1; + public readonly ushort reserved1; /// Number of entries on the partition map, each one sector - public uint entries; + public readonly uint entries; /// First sector of the partition - public uint start; + public readonly uint start; /// Number of sectos of the partition - public uint sectors; + public readonly uint sectors; /// Partition name, 32 bytes, null-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] name; + public readonly byte[] name; /// Partition type. 32 bytes, null-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] type; + public readonly byte[] type; /// First sector of the data area - public uint first_data_block; + public readonly uint first_data_block; /// Number of sectors of the data area - public uint data_sectors; + public readonly uint data_sectors; /// Partition flags - public uint flags; + public readonly uint flags; /// First sector of the boot code - public uint first_boot_block; + public readonly uint first_boot_block; /// Size in bytes of the boot code - public uint boot_size; + public readonly uint boot_size; /// Load address of the boot code - public uint load_address; + public readonly uint load_address; /// Load address of the boot code - public uint load_address2; + public readonly uint load_address2; /// Entry point of the boot code - public uint entry_point; + public readonly uint entry_point; /// Entry point of the boot code - public uint entry_point2; + public readonly uint entry_point2; /// Boot code checksum - public uint checksum; + public readonly uint checksum; /// Processor type, 16 bytes, null-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] processor; + public readonly byte[] processor; /// Boot arguments [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public uint[] boot_arguments; + public readonly uint[] boot_arguments; } } } \ No newline at end of file