mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Fix some places where the DDT was still being used with 32-bit values.
This commit is contained in:
@@ -140,7 +140,7 @@ typedef struct TapePartitionHashEntry
|
|||||||
typedef struct TapeDdtHashEntry
|
typedef struct TapeDdtHashEntry
|
||||||
{
|
{
|
||||||
uint64_t key; ///< Key: sector address
|
uint64_t key; ///< Key: sector address
|
||||||
uint32_t value; ///< Value: DDT entry
|
uint64_t value; ///< Value: DDT entry
|
||||||
UT_hash_handle hh; ///< UTHASH handle
|
UT_hash_handle hh; ///< UTHASH handle
|
||||||
} TapeDdtHashEntry;
|
} TapeDdtHashEntry;
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ static int32_t write_cached_secondary_ddt(aaruformat_context *ctx)
|
|||||||
ddt_header.start = ctx->cached_ddt_position * items_per_ddt_entry;
|
ddt_header.start = ctx->cached_ddt_position * items_per_ddt_entry;
|
||||||
|
|
||||||
// Calculate data size
|
// Calculate data size
|
||||||
ddt_header.length = items_per_ddt_entry * sizeof(uint32_t);
|
ddt_header.length = items_per_ddt_entry * sizeof(uint64_t);
|
||||||
|
|
||||||
// Calculate CRC64 of the data
|
// Calculate CRC64 of the data
|
||||||
crc64_ctx *crc64_context = aaruf_crc64_init();
|
crc64_ctx *crc64_context = aaruf_crc64_init();
|
||||||
@@ -230,7 +230,7 @@ static int32_t write_cached_secondary_ddt(aaruformat_context *ctx)
|
|||||||
long saved_pos = ftell(ctx->imageStream);
|
long saved_pos = ftell(ctx->imageStream);
|
||||||
fseek(ctx->imageStream, ctx->primary_ddt_offset + sizeof(DdtHeader2), SEEK_SET);
|
fseek(ctx->imageStream, ctx->primary_ddt_offset + sizeof(DdtHeader2), SEEK_SET);
|
||||||
|
|
||||||
size_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint32_t);
|
size_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
|
||||||
|
|
||||||
size_t primary_written_bytes = 0;
|
size_t primary_written_bytes = 0;
|
||||||
primary_written_bytes = fwrite(ctx->user_data_ddt2, primary_table_size, 1, ctx->imageStream);
|
primary_written_bytes = fwrite(ctx->user_data_ddt2, primary_table_size, 1, ctx->imageStream);
|
||||||
@@ -322,7 +322,7 @@ static int32_t write_primary_ddt(aaruformat_context *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Then write the table data (position is already after the header)
|
// Then write the table data (position is already after the header)
|
||||||
size_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint32_t);
|
size_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
|
||||||
|
|
||||||
// Write the primary table data
|
// Write the primary table data
|
||||||
size_t written_bytes = 0;
|
size_t written_bytes = 0;
|
||||||
|
|||||||
@@ -519,7 +519,7 @@ void *aaruf_create(const char *filepath, const uint32_t media_type, const uint32
|
|||||||
TRACE("Primary DDT will be placed at offset %" PRIu64, ctx->primary_ddt_offset);
|
TRACE("Primary DDT will be placed at offset %" PRIu64, ctx->primary_ddt_offset);
|
||||||
|
|
||||||
// Calculate size of primary DDT table
|
// Calculate size of primary DDT table
|
||||||
const uint64_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint32_t);
|
const uint64_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
|
||||||
|
|
||||||
// Calculate where data blocks can start (after primary DDT + header)
|
// Calculate where data blocks can start (after primary DDT + header)
|
||||||
if(ctx->user_data_ddt_header.tableShift > 0)
|
if(ctx->user_data_ddt_header.tableShift > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user