Rename mode2Subheaders to mode2_subheaders for consistency in context.h, data.c, close.c, read.c, and info.c

This commit is contained in:
2025-10-03 19:19:31 +01:00
parent 8c9c0c8678
commit cc56c2cc34
5 changed files with 10 additions and 11 deletions

View File

@@ -132,7 +132,7 @@ typedef struct mediaTagEntry
* *
* Field grouping: * Field grouping:
* - Core & header: magic, library*Version, imageStream, header. * - Core & header: magic, library*Version, imageStream, header.
* - Optical sector adjuncts: sectorPrefix/sectorSuffix/subchannel plus corrected variants & mode2Subheaders. * - Optical sector adjuncts: sectorPrefix/sectorSuffix/subchannel plus corrected variants & mode2_subheaders.
* - Deduplication: inMemoryDdt, userDataDdt*, userDataDdtHeader, mini/big/cached secondary arrays, version tags. * - Deduplication: inMemoryDdt, userDataDdt*, userDataDdtHeader, mini/big/cached secondary arrays, version tags.
* - Metadata & geometry: geometryBlock, metadataBlockHeader+metadataBlock, cicmBlockHeader+cicmBlock, tracksHeader. * - Metadata & geometry: geometryBlock, metadataBlockHeader+metadataBlock, cicmBlockHeader+cicmBlock, tracksHeader.
* - Tracks & hardware: trackEntries, dataTracks, dumpHardwareHeader, dumpHardwareEntriesWithData. * - Tracks & hardware: trackEntries, dataTracks, dumpHardwareHeader, dumpHardwareEntriesWithData.
@@ -161,7 +161,7 @@ typedef struct aaruformatContext
uint8_t *sectorSuffix; ///< Raw per-sector suffix (EDC/ECC) uncorrected. uint8_t *sectorSuffix; ///< Raw per-sector suffix (EDC/ECC) uncorrected.
uint8_t *sectorSuffixCorrected; ///< Corrected suffix if stored separately. uint8_t *sectorSuffixCorrected; ///< Corrected suffix if stored separately.
uint8_t *sectorSubchannel; ///< Raw 96-byte subchannel (if captured). uint8_t *sectorSubchannel; ///< Raw 96-byte subchannel (if captured).
uint8_t *mode2Subheaders; ///< MODE2 Form1/Form2 8-byte subheaders (concatenated). uint8_t *mode2_subheaders; ///< MODE2 Form1/Form2 8-byte subheaders (concatenated).
uint8_t shift; ///< Legacy overall shift (deprecated by data_shift/table_shift). uint8_t shift; ///< Legacy overall shift (deprecated by data_shift/table_shift).
bool inMemoryDdt; ///< True if primary (and possibly secondary) DDT loaded. bool inMemoryDdt; ///< True if primary (and possibly secondary) DDT loaded.
@@ -238,7 +238,6 @@ typedef struct aaruformatContext
size_t sectorSuffixBufferLength; ///< Length of sectorSuffixBuffer size_t sectorSuffixBufferLength; ///< Length of sectorSuffixBuffer
size_t sectorPrefixBufferOffset; ///< Current position in sectorPrefixBuffer size_t sectorPrefixBufferOffset; ///< Current position in sectorPrefixBuffer
size_t sectorSuffixBufferOffset; ///< Current position in sectorSuffixBuffer size_t sectorSuffixBufferOffset; ///< Current position in sectorSuffixBuffer
uint8_t *mode2_subheaders; ///< Buffer for storing MODE2 subheaders when writing MODE2 tracks
} aaruformatContext; } aaruformatContext;
/** \struct DumpHardwareEntriesWithData /** \struct DumpHardwareEntriesWithData

View File

@@ -334,7 +334,7 @@ int32_t process_data_block(aaruformatContext *ctx, IndexEntry *entry)
ctx->readableSectorTags[AppleSectorTag] = true; ctx->readableSectorTags[AppleSectorTag] = true;
break; break;
case CompactDiscMode2Subheader: case CompactDiscMode2Subheader:
ctx->mode2Subheaders = data; ctx->mode2_subheaders = data;
break; break;
default: default:
media_tag = (mediaTagEntry *)malloc(sizeof(mediaTagEntry)); media_tag = (mediaTagEntry *)malloc(sizeof(mediaTagEntry));

View File

@@ -884,8 +884,8 @@ int aaruf_close(void *context)
ctx->sectorSuffixCorrected = NULL; ctx->sectorSuffixCorrected = NULL;
free(ctx->sectorSubchannel); free(ctx->sectorSubchannel);
ctx->sectorSubchannel = NULL; ctx->sectorSubchannel = NULL;
free(ctx->mode2Subheaders); free(ctx->mode2_subheaders);
ctx->mode2Subheaders = NULL; ctx->mode2_subheaders = NULL;
TRACE("Freeing media tags"); TRACE("Freeing media tags");
if(ctx->mediaTags != NULL) HASH_ITER(hh, ctx->mediaTags, media_tag, tmp_media_tag) if(ctx->mediaTags != NULL) HASH_ITER(hh, ctx->mediaTags, media_tag, tmp_media_tag)

View File

@@ -959,9 +959,9 @@ int32_t aaruf_read_sector_long(void *context, const uint64_t sector_address, boo
if(res != AARUF_STATUS_OK) return res; if(res != AARUF_STATUS_OK) return res;
if(ctx->mode2Subheaders != NULL && ctx->sectorSuffixDdt != NULL) if(ctx->mode2_subheaders != NULL && ctx->sectorSuffixDdt != NULL)
{ {
memcpy(data + 16, ctx->mode2Subheaders + corrected_sector_address * 8, 8); memcpy(data + 16, ctx->mode2_subheaders + corrected_sector_address * 8, 8);
if((ctx->sectorSuffixDdt[corrected_sector_address] & CD_XFIX_MASK) == Mode2Form1Ok) if((ctx->sectorSuffixDdt[corrected_sector_address] & CD_XFIX_MASK) == Mode2Form1Ok)
{ {
@@ -981,9 +981,9 @@ int32_t aaruf_read_sector_long(void *context, const uint64_t sector_address, boo
// Mode 2 where ECC failed // Mode 2 where ECC failed
memcpy(data + 24, bare_data, 2328); memcpy(data + 24, bare_data, 2328);
} }
else if(ctx->mode2Subheaders != NULL) else if(ctx->mode2_subheaders != NULL)
{ {
memcpy(data + 16, ctx->mode2Subheaders + corrected_sector_address * 8, 8); memcpy(data + 16, ctx->mode2_subheaders + corrected_sector_address * 8, 8);
memcpy(data + 24, bare_data, 2328); memcpy(data + 24, bare_data, 2328);
} }
else else

View File

@@ -75,7 +75,7 @@ int info(const char *path)
if(ctx->sectorSubchannel != NULL) printf("Sector subchannel array has been read.\n"); if(ctx->sectorSubchannel != NULL) printf("Sector subchannel array has been read.\n");
if(ctx->mode2Subheaders != NULL) printf("Sector mode 2 subheaders array has been read.\n"); if(ctx->mode2_subheaders != NULL) printf("Sector mode 2 subheaders array has been read.\n");
printf("Shift is %d (%d bytes).\n", ctx->shift, 1 << ctx->shift); printf("Shift is %d (%d bytes).\n", ctx->shift, 1 << ctx->shift);