From 1ec199b49e3ccf80989911813540c8abe2634d89 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 21 Oct 2025 02:49:32 +0100 Subject: [PATCH] [Cram] Use new source generator based big endian marshaller --- Aaru.Filesystems/Cram/Info.cs | 2 +- Aaru.Filesystems/Cram/Structs.cs | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Aaru.Filesystems/Cram/Info.cs b/Aaru.Filesystems/Cram/Info.cs index a965a98a2..1ad8e2233 100644 --- a/Aaru.Filesystems/Cram/Info.cs +++ b/Aaru.Filesystems/Cram/Info.cs @@ -83,7 +83,7 @@ public sealed partial class Cram break; case CRAM_CIGAM: - crSb = Marshal.ByteArrayToStructureBigEndian(sector); + crSb = Marshal.ByteArrayToStructureBigEndianGenerated(sector); littleEndian = false; break; diff --git a/Aaru.Filesystems/Cram/Structs.cs b/Aaru.Filesystems/Cram/Structs.cs index 7135af755..ba41b1405 100644 --- a/Aaru.Filesystems/Cram/Structs.cs +++ b/Aaru.Filesystems/Cram/Structs.cs @@ -30,6 +30,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +using Aaru.CommonTypes.Attributes; namespace Aaru.Filesystems; @@ -41,20 +42,21 @@ public sealed partial class Cram #region Nested type: SuperBlock [StructLayout(LayoutKind.Sequential, Pack = 1)] - readonly struct SuperBlock + [SwapEndian] + partial struct SuperBlock { - public readonly uint magic; - public readonly uint size; - public readonly uint flags; - public readonly uint future; + public uint magic; + public uint size; + public uint flags; + public uint future; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public readonly byte[] signature; - public readonly uint crc; - public readonly uint edition; - public readonly uint blocks; - public readonly uint files; + public byte[] signature; + public uint crc; + public uint edition; + public uint blocks; + public uint files; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public readonly byte[] name; + public byte[] name; } #endregion