From c51847b734ebc77ab19738d8b3582dfadb624ae4 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 31 Jul 2019 19:53:47 +0100 Subject: [PATCH] Fix TODOs and code cleanup. --- DiscImageChef.Filesystems/ISO9660/Date.cs | 10 +-- DiscImageChef.Filesystems/ISO9660/Dir.cs | 19 ++--- DiscImageChef.Filesystems/ISO9660/File.cs | 5 +- DiscImageChef.Filesystems/ISO9660/Info.cs | 51 +++++++------ .../ISO9660/Structs/Amiga.cs | 16 ++-- .../ISO9660/Structs/ElTorito.cs | 74 +++++++++---------- .../ISO9660/Structs/SUSP.cs | 62 ++++++++-------- .../ISO9660/Structs/XA.cs | 12 +-- .../ISO9660/Structs/Ziso.cs | 26 +++---- DiscImageChef.Filesystems/ISO9660/Super.cs | 17 ++--- DiscImageChef.Filesystems/ISO9660/Xattr.cs | 1 - 11 files changed, 143 insertions(+), 150 deletions(-) diff --git a/DiscImageChef.Filesystems/ISO9660/Date.cs b/DiscImageChef.Filesystems/ISO9660/Date.cs index 72f60aae0..147ccb6e4 100644 --- a/DiscImageChef.Filesystems/ISO9660/Date.cs +++ b/DiscImageChef.Filesystems/ISO9660/Date.cs @@ -5,7 +5,7 @@ namespace DiscImageChef.Filesystems.ISO9660 { public partial class ISO9660 { - DateTime? DecodeIsoDateTime(byte[] timestamp) + static DateTime? DecodeIsoDateTime(byte[] timestamp) { switch(timestamp?.Length) { @@ -15,7 +15,7 @@ namespace DiscImageChef.Filesystems.ISO9660 } } - DateTime? DecodeIsoDateTime(IsoTimestamp timestamp) + static DateTime? DecodeIsoDateTime(IsoTimestamp timestamp) { try { @@ -26,14 +26,14 @@ namespace DiscImageChef.Filesystems.ISO9660 return TimeZoneInfo.ConvertTimeToUtc(date, TimeZoneInfo.FindSystemTimeZoneById("GMT")); } - catch(Exception e) + catch(Exception) { // ISO says timestamp can be unspecified return null; } } - DateTime? DecodeHighSierraDateTime(HighSierraTimestamp timestamp) + static DateTime? DecodeHighSierraDateTime(HighSierraTimestamp timestamp) { try { @@ -42,7 +42,7 @@ namespace DiscImageChef.Filesystems.ISO9660 return TimeZoneInfo.ConvertTimeToUtc(date, TimeZoneInfo.FindSystemTimeZoneById("GMT")); } - catch(Exception e) + catch(Exception) { // ISO says timestamp can be unspecified, suppose same for High Sierra return null; diff --git a/DiscImageChef.Filesystems/ISO9660/Dir.cs b/DiscImageChef.Filesystems/ISO9660/Dir.cs index 531794d32..de12451e3 100644 --- a/DiscImageChef.Filesystems/ISO9660/Dir.cs +++ b/DiscImageChef.Filesystems/ISO9660/Dir.cs @@ -13,7 +13,6 @@ namespace DiscImageChef.Filesystems.ISO9660 { Dictionary> directoryCache; - // TODO: Implement path table traversal public Errno ReadDir(string path, out List contents) { contents = null; @@ -86,7 +85,6 @@ namespace DiscImageChef.Filesystems.ISO9660 directoryBuffer = ms.ToArray(); } - // TODO: Decode Joliet currentDirectory = cdi ? DecodeCdiDirectory(directoryBuffer, entry.Value.XattrLength) : highSierra @@ -132,10 +130,10 @@ namespace DiscImageChef.Filesystems.ISO9660 return contents; } - Dictionary DecodeCdiDirectory(byte[] data, byte XattrLength) + Dictionary DecodeCdiDirectory(byte[] data, byte xattrLength) { Dictionary entries = new Dictionary(); - int entryOff = XattrLength; + int entryOff = xattrLength; while(entryOff + CdiDirectoryRecordSize < data.Length) { @@ -190,10 +188,10 @@ namespace DiscImageChef.Filesystems.ISO9660 return entries; } - Dictionary DecodeHighSierraDirectory(byte[] data, byte XattrLength) + Dictionary DecodeHighSierraDirectory(byte[] data, byte xattrLength) { Dictionary entries = new Dictionary(); - int entryOff = XattrLength; + int entryOff = xattrLength; while(entryOff + DirectoryRecordSize < data.Length) { @@ -240,10 +238,10 @@ namespace DiscImageChef.Filesystems.ISO9660 return entries; } - Dictionary DecodeIsoDirectory(byte[] data, byte XattrLength) + Dictionary DecodeIsoDirectory(byte[] data, byte xattrLength) { Dictionary entries = new Dictionary(); - int entryOff = XattrLength; + int entryOff = xattrLength; while(entryOff + DirectoryRecordSize < data.Length) { @@ -298,7 +296,6 @@ namespace DiscImageChef.Filesystems.ISO9660 if(joliet && entry.Filename.EndsWith(";1", StringComparison.Ordinal)) entry.Filename = entry.Filename.Substring(0, entry.Filename.Length - 2); - // TODO: XA int systemAreaStart = entryOff + record.name_len + DirectoryRecordSize; int systemAreaLength = record.length - record.name_len - DirectoryRecordSize; @@ -748,7 +745,6 @@ namespace DiscImageChef.Filesystems.ISO9660 systemAreaOff += nmLength; break; case RRIP_CHILDLINK: - // TODO byte clLength = data[systemAreaOff + 2]; // If we are not in Rock Ridge namespace, or we are using the Path Table, skip it @@ -926,7 +922,7 @@ namespace DiscImageChef.Filesystems.ISO9660 PathTableEntryInternal[] GetPathTableEntries(string path) { - IEnumerable tableEntries = new PathTableEntryInternal[0]; + IEnumerable tableEntries; List pathTableList = new List(pathTable); if(path == "" || path == "/") tableEntries = pathTable.Where(p => p.Parent == 1 && p != pathTable[0]); @@ -1028,7 +1024,6 @@ namespace DiscImageChef.Filesystems.ISO9660 if(record.size != 0) entry.Extents = new List<(uint extent, uint size)> {(record.extent, record.size)}; - // TODO: XA int systemAreaStart = record.name_len + DirectoryRecordSize; int systemAreaLength = record.length - record.name_len - DirectoryRecordSize; diff --git a/DiscImageChef.Filesystems/ISO9660/File.cs b/DiscImageChef.Filesystems/ISO9660/File.cs index df5d07f9f..4dd1c9002 100644 --- a/DiscImageChef.Filesystems/ISO9660/File.cs +++ b/DiscImageChef.Filesystems/ISO9660/File.cs @@ -69,7 +69,6 @@ namespace DiscImageChef.Filesystems.ISO9660 offset += entry.XattrLength; - // TODO: XA long firstSector = offset / 2048; long offsetInSector = offset % 2048; long sizeInSectors = (size + offsetInSector) / 2048; @@ -227,7 +226,6 @@ namespace DiscImageChef.Filesystems.ISO9660 if(entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.OwnerRead)) stat.Mode |= 256; } - // TODO: XA uint eaSizeInSectors = (uint)(entry.XattrLength / 2048); if(entry.XattrLength % 2048 > 0) eaSizeInSectors++; @@ -270,7 +268,7 @@ namespace DiscImageChef.Filesystems.ISO9660 { entry = null; - string cutPath = path.StartsWith("/") + string cutPath = path.StartsWith("/", StringComparison.Ordinal) ? path.Substring(1).ToLower(CultureInfo.CurrentUICulture) : path.ToLower(CultureInfo.CurrentUICulture); string[] pieces = cutPath.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); @@ -296,7 +294,6 @@ namespace DiscImageChef.Filesystems.ISO9660 if(string.IsNullOrEmpty(dirent.Key)) { - // TODO: RRIP if(!joliet && !pieces[pieces.Length - 1].EndsWith(";1", StringComparison.Ordinal)) { dirent = parent.FirstOrDefault(t => t.Key.ToLower(CultureInfo.CurrentUICulture) == diff --git a/DiscImageChef.Filesystems/ISO9660/Info.cs b/DiscImageChef.Filesystems/ISO9660/Info.cs index 65570193e..bf191dad8 100644 --- a/DiscImageChef.Filesystems/ISO9660/Info.cs +++ b/DiscImageChef.Filesystems/ISO9660/Info.cs @@ -106,12 +106,12 @@ namespace DiscImageChef.Filesystems.ISO9660 byte[] vdSector = imagePlugin.ReadSector(16 + counter + partition.Start); int xaOff = vdSector.Length == 2336 ? 8 : 0; Array.Copy(vdSector, 0x009 + xaOff, hsMagic, 0, 5); - bool highSierra = Encoding.GetString(hsMagic) == HIGH_SIERRA_MAGIC; - int hsOff = 0; - if(highSierra) hsOff = 8; - bool cdi = false; - bool evd = false; - bool vpd = false; + bool highSierraInfo = Encoding.GetString(hsMagic) == HIGH_SIERRA_MAGIC; + int hsOff = 0; + if(highSierraInfo) hsOff = 8; + bool cdiInfo = false; + bool evd = false; + bool vpd = false; while(true) { @@ -144,7 +144,7 @@ namespace DiscImageChef.Filesystems.ISO9660 break; } - cdi |= Encoding.GetString(vdMagic) == CDI_MAGIC; + cdiInfo |= Encoding.GetString(vdMagic) == CDI_MAGIC; switch(vdType) { @@ -167,10 +167,10 @@ namespace DiscImageChef.Filesystems.ISO9660 case 1: { - if(highSierra) + if(highSierraInfo) hsvd = Marshal .ByteArrayToStructureLittleEndian(vdSector); - else if(cdi) + else if(cdiInfo) fsvd = Marshal.ByteArrayToStructureBigEndian(vdSector); else pvd = Marshal.ByteArrayToStructureLittleEndian(vdSector); @@ -218,9 +218,9 @@ namespace DiscImageChef.Filesystems.ISO9660 return; } - if(highSierra) decodedVd = DecodeVolumeDescriptor(hsvd.Value); - else if(cdi) decodedVd = DecodeVolumeDescriptor(fsvd.Value); - else decodedVd = DecodeVolumeDescriptor(pvd.Value); + if(highSierraInfo) decodedVd = DecodeVolumeDescriptor(hsvd.Value); + else if(cdiInfo) decodedVd = DecodeVolumeDescriptor(fsvd.Value); + else decodedVd = DecodeVolumeDescriptor(pvd.Value); if(jolietvd != null) decodedJolietVd = DecodeJolietDescriptor(jolietvd.Value); @@ -228,13 +228,13 @@ namespace DiscImageChef.Filesystems.ISO9660 uint rootSize = 0; // No need to read root on CD-i, as extensions are not supported... - if(!cdi) + if(!cdiInfo) { - rootLocation = highSierra + rootLocation = highSierraInfo ? hsvd.Value.root_directory_record.extent : pvd.Value.root_directory_record.extent; - if(highSierra) + if(highSierraInfo) { rootSize = hsvd.Value.root_directory_record.size / hsvd.Value.logical_block_size; if(hsvd.Value.root_directory_record.size % hsvd.Value.logical_block_size > 0) rootSize++; @@ -263,7 +263,7 @@ namespace DiscImageChef.Filesystems.ISO9660 rootDir = imagePlugin.ReadSectors(rootLocation, rootSize); // Walk thru root directory to see system area extensions in use - while(rootOff + Marshal.SizeOf() < rootDir.Length && !cdi) + while(rootOff + Marshal.SizeOf() < rootDir.Length && !cdiInfo) { DirectoryRecord record = Marshal.ByteArrayToStructureLittleEndian(rootDir, rootOff, @@ -397,9 +397,9 @@ namespace DiscImageChef.Filesystems.ISO9660 foreach(ContinuationArea ca in contareas) { uint caLen = (ca.ca_length_be + ca.offset_be) / - (highSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size); + (highSierraInfo ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size); if((ca.ca_length_be + ca.offset_be) % - (highSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size) > 0) caLen++; + (highSierraInfo ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size) > 0) caLen++; byte[] caSectors = imagePlugin.ReadSectors(ca.block_be, caLen); byte[] caData = new byte[ca.ca_length_be]; @@ -469,9 +469,9 @@ namespace DiscImageChef.Filesystems.ISO9660 Dreamcast.IPBin? dreamcast = Dreamcast.DecodeIPBin(ipbinSector); string fsFormat; - if(highSierra) fsFormat = "High Sierra Format"; - else if(cdi) fsFormat = "CD-i"; - else fsFormat = "ISO9660"; + if(highSierraInfo) fsFormat = "High Sierra Format"; + else if(cdiInfo) fsFormat = "CD-i"; + else fsFormat = "ISO9660"; isoMetadata.AppendFormat("{0} file system", fsFormat).AppendLine(); if(xaExtensions) isoMetadata.AppendLine("CD-ROM XA extensions present."); @@ -504,9 +504,12 @@ namespace DiscImageChef.Filesystems.ISO9660 isoMetadata.AppendLine(Dreamcast.Prettify(dreamcast)); } - isoMetadata.AppendFormat("{0}------------------------------", cdi ? "---------------" : "").AppendLine(); - isoMetadata.AppendFormat("{0}VOLUME DESCRIPTOR INFORMATION:", cdi ? "FILE STRUCTURE " : "").AppendLine(); - isoMetadata.AppendFormat("{0}------------------------------", cdi ? "---------------" : "").AppendLine(); + isoMetadata.AppendFormat("{0}------------------------------", cdiInfo ? "---------------" : "") + .AppendLine(); + isoMetadata.AppendFormat("{0}VOLUME DESCRIPTOR INFORMATION:", cdiInfo ? "FILE STRUCTURE " : "") + .AppendLine(); + isoMetadata.AppendFormat("{0}------------------------------", cdiInfo ? "---------------" : "") + .AppendLine(); isoMetadata.AppendFormat("System identifier: {0}", decodedVd.SystemIdentifier).AppendLine(); isoMetadata.AppendFormat("Volume identifier: {0}", decodedVd.VolumeIdentifier).AppendLine(); isoMetadata.AppendFormat("Volume set identifier: {0}", decodedVd.VolumeSetIdentifier).AppendLine(); diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs index 0b4be088d..40d5c015e 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs @@ -39,10 +39,10 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AmigaEntry { - public ushort signature; - public byte length; - public byte version; - public AmigaFlags flags; + public readonly ushort signature; + public readonly byte length; + public readonly byte version; + public readonly AmigaFlags flags; // Followed by AmigaProtection if present // Followed by length-prefixed string for comment if present } @@ -50,10 +50,10 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AmigaProtection { - public byte User; - public byte Reserved; - public AmigaMultiuser Multiuser; - public AmigaAttributes Protection; + public readonly byte User; + public readonly byte Reserved; + public readonly AmigaMultiuser Multiuser; + public readonly AmigaAttributes Protection; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs b/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs index 3ae9edae2..084c63e55 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs @@ -39,77 +39,77 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ElToritoBootRecord { - public byte type; + public readonly byte type; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; - public byte version; + public readonly byte[] id; + public readonly byte version; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; + public readonly byte[] system_id; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] boot_id; - public uint catalog_sector; + public readonly byte[] boot_id; + public readonly uint catalog_sector; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1974)] - public byte[] boot_use; + public readonly byte[] boot_use; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ElToritoValidationEntry { - public ElToritoIndicator header_id; - public ElToritoPlatform platform_id; - public ushort reserved; + public readonly ElToritoIndicator header_id; + public readonly ElToritoPlatform platform_id; + public readonly ushort reserved; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] developer_id; - public ushort checksum; - public ushort signature; + public readonly byte[] developer_id; + public readonly ushort checksum; + public readonly ushort signature; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ElToritoInitialEntry { - public ElToritoIndicator bootable; - public ElToritoEmulation boot_type; - public ushort load_seg; - public byte system_type; - public byte reserved1; - public ushort sector_count; - public uint load_rba; + public readonly ElToritoIndicator bootable; + public ElToritoEmulation boot_type; + public readonly ushort load_seg; + public readonly byte system_type; + public readonly byte reserved1; + public readonly ushort sector_count; + public readonly uint load_rba; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] reserved2; + public readonly byte[] reserved2; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ElToritoSectionHeaderEntry { - public ElToritoIndicator header_id; - public ElToritoPlatform platform_id; - public ushort entries; + public readonly ElToritoIndicator header_id; + public readonly ElToritoPlatform platform_id; + public readonly ushort entries; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] - public byte[] identifier; + public readonly byte[] identifier; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ElToritoSectionEntry { - public ElToritoIndicator bootable; - public ElToritoEmulation boot_type; - public ushort load_seg; - public byte system_type; - public byte reserved1; - public ushort sector_count; - public uint load_rba; - public byte selection_criteria_type; + public readonly ElToritoIndicator bootable; + public readonly ElToritoEmulation boot_type; + public readonly ushort load_seg; + public readonly byte system_type; + public readonly byte reserved1; + public readonly ushort sector_count; + public readonly uint load_rba; + public readonly byte selection_criteria_type; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] - public byte[] selection_criterias; + public readonly byte[] selection_criterias; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ElToritoSectionEntryExtension { - public ElToritoIndicator extension_indicator; - public ElToritoFlags extension_flags; + public readonly ElToritoIndicator extension_indicator; + public readonly ElToritoFlags extension_flags; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)] - public byte[] selection_criterias; + public readonly byte[] selection_criterias; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs b/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs index 4445c0b2f..908cf54d3 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs @@ -39,53 +39,53 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ContinuationArea { - public ushort signature; - public byte length; - public byte version; - public uint block; - public uint block_be; - public uint offset; - public uint offset_be; - public uint ca_length; - public uint ca_length_be; + public readonly ushort signature; + public readonly byte length; + public readonly byte version; + public readonly uint block; + public readonly uint block_be; + public readonly uint offset; + public readonly uint offset_be; + public readonly uint ca_length; + public readonly uint ca_length_be; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PaddingArea { - public ushort signature; - public byte length; - public byte version; + public readonly ushort signature; + public readonly byte length; + public readonly byte version; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct IndicatorArea { - public ushort signature; - public byte length; - public byte version; - public ushort magic; - public byte skipped; + public readonly ushort signature; + public readonly byte length; + public readonly byte version; + public readonly ushort magic; + public readonly byte skipped; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct TerminatorArea { - public ushort signature; - public byte length; - public byte version; + public readonly ushort signature; + public readonly byte length; + public readonly byte version; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ReferenceArea { - public ushort signature; - public byte length; - public byte version; - public byte id_len; - public byte des_len; - public byte src_len; - public byte ext_ver; + public readonly ushort signature; + public readonly byte length; + public readonly byte version; + public readonly byte id_len; + public readonly byte des_len; + public readonly byte src_len; + public readonly byte ext_ver; // Follows extension identifier for id_len bytes // Follows extension descriptor for des_len bytes // Follows extension source for src_len bytes @@ -94,10 +94,10 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SelectorArea { - public ushort signature; - public byte length; - public byte version; - public byte sequence; + public readonly ushort signature; + public readonly byte length; + public readonly byte version; + public readonly byte sequence; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs b/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs index ddfdb150f..6f47d3d87 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs @@ -40,13 +40,13 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CdromXa { - public XaAttributes attributes; - public byte filenumber; - public ushort group; + public readonly XaAttributes attributes; + public readonly byte filenumber; + public readonly ushort group; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] reserved; - public ushort signature; - public ushort user; + public readonly byte[] reserved; + public readonly ushort signature; + public readonly ushort user; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs index 7142becd3..5f66fd2cf 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs @@ -39,24 +39,24 @@ namespace DiscImageChef.Filesystems.ISO9660 [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZisofsHeader { - public ulong magic; - public uint uncomp_len; - public uint uncomp_len_be; - public byte header_size; // Shifted >> 2 - public byte block_size_log; // log2(block_size) + public readonly ulong magic; + public readonly uint uncomp_len; + public readonly uint uncomp_len_be; + public readonly byte header_size; // Shifted >> 2 + public readonly byte block_size_log; // log2(block_size) } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZisofsEntry { - public ushort signature; - public byte length; - public byte version; - public ushort alogirhtm; - public byte header_size; // Shifted >> 2 - public byte block_size_log; // log2(block_size) - public uint uncomp_len; - public uint uncomp_len_be; + public readonly ushort signature; + public readonly byte length; + public readonly byte version; + public readonly ushort alogirhtm; + public readonly byte header_size; // Shifted >> 2 + public readonly byte block_size_log; // log2(block_size) + public readonly uint uncomp_len; + public readonly uint uncomp_len_be; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ISO9660/Super.cs b/DiscImageChef.Filesystems/ISO9660/Super.cs index 04e1e7786..177d7f9b1 100644 --- a/DiscImageChef.Filesystems/ISO9660/Super.cs +++ b/DiscImageChef.Filesystems/ISO9660/Super.cs @@ -199,7 +199,7 @@ namespace DiscImageChef.Filesystems.ISO9660 string fsFormat; byte[] pathTableData; - uint pathTableSizeInSectors = 0; + uint pathTableSizeInSectors; uint pathTableMsbLocation; uint pathTableLsbLocation = 0; // Initialize to 0 as ignored in CD-i @@ -253,8 +253,8 @@ namespace DiscImageChef.Filesystems.ISO9660 if(jolietvd is null && this.@namespace == Namespace.Joliet) this.@namespace = Namespace.Normal; - uint rootLocation = 0; - uint rootSize = 0; + uint rootLocation; + uint rootSize; byte rootXattrLength = 0; if(!cdi) @@ -341,11 +341,10 @@ namespace DiscImageChef.Filesystems.ISO9660 rootDirectoryCache.Add("$PATH_TABLE.LSB", new DecodedDirectoryEntry { - Extents = - new List<(uint extent, uint size)> - { - (rootLocation, (uint)pathTableData.Length) - }, + Extents = new List<(uint extent, uint size)> + { + (pathTableLsbLocation, (uint)pathTableData.Length) + }, Filename = "$PATH_TABLE.LSB", Size = (uint)pathTableData.Length, Timestamp = decodedVd.CreationTime @@ -357,7 +356,7 @@ namespace DiscImageChef.Filesystems.ISO9660 Extents = new List<(uint extent, uint size)> { - (rootLocation, (uint)pathTableData.Length) + (pathTableMsbLocation, (uint)pathTableData.Length) }, Filename = "$PATH_TABLE.MSB", Size = (uint)pathTableData.Length, diff --git a/DiscImageChef.Filesystems/ISO9660/Xattr.cs b/DiscImageChef.Filesystems/ISO9660/Xattr.cs index 5d7aa98d2..c9309b28d 100644 --- a/DiscImageChef.Filesystems/ISO9660/Xattr.cs +++ b/DiscImageChef.Filesystems/ISO9660/Xattr.cs @@ -43,7 +43,6 @@ namespace DiscImageChef.Filesystems.ISO9660 if(entry.Extents is null) return Errno.InvalidArgument; - // TODO: XA uint eaSizeInSectors = (uint)(entry.XattrLength / 2048); if(entry.XattrLength % 2048 > 0) eaSizeInSectors++;