[AaruFormat] Update sector handling to use uint instead of ushort for negative and overflow sectors

This commit is contained in:
2025-12-29 17:08:03 +00:00
parent 1842998372
commit b643bc7f07
3 changed files with 18 additions and 18 deletions

View File

@@ -251,15 +251,15 @@ public sealed partial class AaruFormat
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])] [UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
private static partial Status aaruf_get_readable_media_tags(IntPtr context, byte[] buffer, ref nuint length); private static partial Status aaruf_get_readable_media_tags(IntPtr context, byte[] buffer, ref nuint length);
// AARU_EXPORT int32_t AARU_CALL aaruf_get_negative_sectors(const void *context, uint16_t *sectors); // AARU_EXPORT int32_t AARU_CALL aaruf_get_negative_sectors(const void *context, uint32_t *sectors);
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_negative_sectors", SetLastError = true)] [LibraryImport("libaaruformat", EntryPoint = "aaruf_get_negative_sectors", SetLastError = true)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])] [UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
private static partial Status aaruf_get_negative_sectors(IntPtr context, ref ushort sectors); private static partial Status aaruf_get_negative_sectors(IntPtr context, ref uint sectors);
// AARU_EXPORT int32_t AARU_CALL aaruf_get_overflow_sectors(const void *context, uint16_t *sectors); // AARU_EXPORT int32_t AARU_CALL aaruf_get_overflow_sectors(const void *context, uint32_t *sectors);
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_overflow_sectors", SetLastError = true)] [LibraryImport("libaaruformat", EntryPoint = "aaruf_get_overflow_sectors", SetLastError = true)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])] [UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
private static partial Status aaruf_get_overflow_sectors(IntPtr context, ref ushort sectors); private static partial Status aaruf_get_overflow_sectors(IntPtr context, ref uint sectors);
#region IWritableOpticalImage Members #region IWritableOpticalImage Members

View File

@@ -64,9 +64,8 @@ public sealed partial class AaruFormat
// Convert array of booleans to List of enums // Convert array of booleans to List of enums
for(nuint i = 0; i < sizet_length; i++) for(nuint i = 0; i < sizet_length; i++)
{ if(sectorTagsBuffer[i] != 0)
if(sectorTagsBuffer[i] != 0) _imageInfo.ReadableSectorTags.Add((SectorTagType)i); _imageInfo.ReadableSectorTags.Add((SectorTagType)i);
}
sizet_length = 0; sizet_length = 0;
ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length); ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length);
@@ -80,9 +79,8 @@ public sealed partial class AaruFormat
// Convert array of booleans to List of enums // Convert array of booleans to List of enums
for(nuint i = 0; i < sizet_length; i++) for(nuint i = 0; i < sizet_length; i++)
{ if(mediaTagsBuffer[i] != 0)
if(mediaTagsBuffer[i] != 0) _imageInfo.ReadableMediaTags.Add((MediaTagType)i); _imageInfo.ReadableMediaTags.Add((MediaTagType)i);
}
ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence); ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence);
@@ -243,12 +241,12 @@ public sealed partial class AaruFormat
SetMetadataFromTags(); SetMetadataFromTags();
ushort negativeSectors = 0; uint negativeSectors = 0;
ret = aaruf_get_negative_sectors(_context, ref negativeSectors); ret = aaruf_get_negative_sectors(_context, ref negativeSectors);
if(ret == Status.Ok) _imageInfo.NegativeSectors = negativeSectors; if(ret == Status.Ok) _imageInfo.NegativeSectors = negativeSectors;
ushort overflowSectors = 0; uint overflowSectors = 0;
ret = aaruf_get_overflow_sectors(_context, ref overflowSectors); ret = aaruf_get_overflow_sectors(_context, ref overflowSectors);
if(ret == Status.Ok) _imageInfo.OverflowSectors = overflowSectors; if(ret == Status.Ok) _imageInfo.OverflowSectors = overflowSectors;

View File

@@ -288,8 +288,9 @@ public sealed partial class AaruFormat
// Convert array of booleans to List of enums // Convert array of booleans to List of enums
for(nuint i = 0; i < sizet_length; i++) for(nuint i = 0; i < sizet_length; i++)
if(sectorTagsBuffer[i] != 0) {
_imageInfo.ReadableSectorTags.Add((SectorTagType)i); if(sectorTagsBuffer[i] != 0) _imageInfo.ReadableSectorTags.Add((SectorTagType)i);
}
sizet_length = 0; sizet_length = 0;
ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length); ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length);
@@ -313,8 +314,9 @@ public sealed partial class AaruFormat
// Convert array of booleans to List of enums // Convert array of booleans to List of enums
for(nuint i = 0; i < sizet_length; i++) for(nuint i = 0; i < sizet_length; i++)
if(mediaTagsBuffer[i] != 0) {
_imageInfo.ReadableMediaTags.Add((MediaTagType)i); if(mediaTagsBuffer[i] != 0) _imageInfo.ReadableMediaTags.Add((MediaTagType)i);
}
ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence); ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence);
@@ -475,12 +477,12 @@ public sealed partial class AaruFormat
SetMetadataFromTags(); SetMetadataFromTags();
ushort infoNegativeSectors = 0; uint infoNegativeSectors = 0;
ret = aaruf_get_negative_sectors(_context, ref infoNegativeSectors); ret = aaruf_get_negative_sectors(_context, ref infoNegativeSectors);
if(ret == Status.Ok) _imageInfo.NegativeSectors = infoNegativeSectors; if(ret == Status.Ok) _imageInfo.NegativeSectors = infoNegativeSectors;
ushort infoOverflowSectors = 0; uint infoOverflowSectors = 0;
ret = aaruf_get_overflow_sectors(_context, ref infoOverflowSectors); ret = aaruf_get_overflow_sectors(_context, ref infoOverflowSectors);
if(ret == Status.Ok) _imageInfo.OverflowSectors = infoOverflowSectors; if(ret == Status.Ok) _imageInfo.OverflowSectors = infoOverflowSectors;