Fix typo in secondary DDTv2 identifier (back-compatible until out of alpha).

This commit is contained in:
2025-12-30 11:12:00 +00:00
parent bc7c660a85
commit 3385caac5d
4 changed files with 18 additions and 14 deletions

View File

@@ -142,7 +142,8 @@ typedef enum
DataBlock = 0x4B4C4244, ///< Block containing data.
DeDuplicationTable = 0x2A544444, ///< Block containing a deduplication table (v1).
DeDuplicationTable2 = 0x32544444, ///< Block containing a deduplication table v2.
DeDuplicationTableSecondary = 0x53545444, ///< Block containing a secondary deduplication table (v2).
DeDuplicationTableSAlpha = 0x53545444, ///< Block containing a secondary deduplication table (v2) (mistake).
DeDuplicationTableSecondary = 0x53544444, ///< Block containing a secondary deduplication table (v2).
IndexBlock = 0x58444E49, ///< Block containing the index (v1).
IndexBlock2 = 0x32584449, ///< Block containing the index v2.
IndexBlock3 = 0x33584449, ///< Block containing the index v3.

View File

@@ -212,7 +212,8 @@ static int32_t write_cached_secondary_ddt(aaruformat_context *ctx)
{
entry = (IndexEntry *)utarray_eltptr(ctx->index_entries, k);
if(entry && entry->offset == ctx->cached_ddt_offset &&
entry->blockType == DeDuplicationTableSecondary)
(entry->blockType == DeDuplicationTableSecondary ||
entry->blockType == DeDuplicationTableSAlpha))
{
TRACE("Found old DDT index entry at position %u, removing", k);
utarray_erase(ctx->index_entries, k, 1);
@@ -517,8 +518,7 @@ static int32_t write_single_level_ddt(aaruformat_context *ctx)
TRACE("Failed to write single-level DDT table data to file");
// Free compression buffer if it was allocated
if(ctx->user_data_ddt_header.compression != None && cmp_buffer != (uint8_t *)ctx->user_data_ddt2)
free(cmp_buffer);
if(ctx->user_data_ddt_header.compression != None && cmp_buffer != (uint8_t *)ctx->user_data_ddt2) free(cmp_buffer);
return AARUF_STATUS_OK;
}
@@ -4596,8 +4596,8 @@ AARU_EXPORT int AARU_CALL aaruf_close(void *context)
free(ctx->sector_edc);
// Free DDT allocations (v1 and v2)
free(ctx->user_data_ddt); // Legacy v1 DDT
free(ctx->user_data_ddt2); // v2 DDT primary/secondary
free(ctx->user_data_ddt); // Legacy v1 DDT
free(ctx->user_data_ddt2); // v2 DDT primary/secondary
free(ctx->cached_secondary_ddt2); // Cached secondary DDT (read operations)
// Free LRU caches (uses cache->free_func to free cached values)

View File

@@ -787,7 +787,9 @@ int32_t decode_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_addre
return AARUF_ERROR_CANNOT_READ_BLOCK;
}
if(ddt_header.identifier != DeDuplicationTableSecondary || ddt_header.type != UserData)
if((ddt_header.identifier != DeDuplicationTableSecondary &&
ddt_header.identifier != DeDuplicationTableSAlpha) ||
ddt_header.type != UserData)
{
FATAL("Invalid block header at %" PRIu64 "", secondary_ddt_offset);
TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
@@ -1504,7 +1506,8 @@ bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bo
for(unsigned int i = 0; i < utarray_len(ctx->index_entries); i++)
{
entry = (IndexEntry *)utarray_eltptr(ctx->index_entries, i);
if(entry && entry->offset == ctx->cached_ddt_offset && entry->blockType == DeDuplicationTableSecondary)
if(entry && entry->offset == ctx->cached_ddt_offset &&
(entry->blockType == DeDuplicationTableSecondary || entry->blockType == DeDuplicationTableSAlpha))
{
TRACE("Found old DDT index entry at position %u, removing", i);
utarray_erase(ctx->index_entries, i, 1);

View File

@@ -588,7 +588,7 @@ enum <uint> MediaType
ODC1500R = 784,
ODC3300R = 785,
ODC5500R = 786,
ECMA_322_1k = 800,
ECMA_322_512 = 801,
ISO_14517 = 802,
@@ -709,7 +709,7 @@ enum <uint> BlockType
DataBlock = 0x4B4C4244,
DeDuplicationTable = 0X2A544444,
DeDuplicationTable2 = 0x32544444,
DeDuplicationTableSecondary = 0x53545444,
DeDuplicationTableSecondary = 0x53544444,
IndexBlock = 0X58444E49,
IndexBlock2 = 0x32584449,
IndexBlock3 = 0x33584449,
@@ -761,18 +761,18 @@ typedef struct
byte imageMajorVersion;
byte imageMinorVersion;
// Go back to application name
FSeek(0x08);
if(imageMajorVersion >= 2)
char application[64];
else
wchar_t application[32];
// Move to after image version
FSeek(0x4A);
byte applicationMajorVersion;
byte applicationMinorVersion;
MediaType mediaType;