From bed8b39af634cdfa79dbb210966aa99439d2bd63 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 4 Oct 2025 02:08:58 +0100 Subject: [PATCH] Rename sectorSubchannel to sector_subchannel for consistency across the codebase --- include/aaruformat/context.h | 2 +- src/blocks/data.c | 4 ++-- src/close.c | 4 ++-- src/read.c | 4 ++-- src/write.c | 18 ++++++++++-------- tool/info.c | 2 +- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/include/aaruformat/context.h b/include/aaruformat/context.h index c6e7d49..d845e74 100644 --- a/include/aaruformat/context.h +++ b/include/aaruformat/context.h @@ -160,7 +160,7 @@ typedef struct aaruformatContext uint8_t *sectorPrefixCorrected; ///< Corrected variant (post error correction) if stored. uint8_t *sector_suffix; ///< Raw per-sector suffix (EDC/ECC) uncorrected. uint8_t *sectorSuffixCorrected; ///< Corrected suffix if stored separately. - uint8_t *sectorSubchannel; ///< Raw 96-byte subchannel (if captured). + uint8_t *sector_subchannel; ///< Raw 96-byte subchannel (if captured). uint8_t *mode2_subheaders; ///< MODE2 Form1/Form2 8-byte subheaders (concatenated). uint8_t shift; ///< Legacy overall shift (deprecated by data_shift/table_shift). diff --git a/src/blocks/data.c b/src/blocks/data.c index 1eea095..2b3a6f0 100644 --- a/src/blocks/data.c +++ b/src/blocks/data.c @@ -324,13 +324,13 @@ int32_t process_data_block(aaruformatContext *ctx, IndexEntry *entry) ctx->readableSectorTags[CdSectorEdc] = true; break; case CdSectorSubchannel: - ctx->sectorSubchannel = data; + ctx->sector_subchannel = data; ctx->readableSectorTags[CdSectorSubchannel] = true; break; case AppleProfileTag: case AppleSonyTag: case PriamDataTowerTag: - ctx->sectorSubchannel = data; + ctx->sector_subchannel = data; ctx->readableSectorTags[AppleSectorTag] = true; break; case CompactDiscMode2Subheader: diff --git a/src/close.c b/src/close.c index 5636b6f..0198583 100644 --- a/src/close.c +++ b/src/close.c @@ -1307,8 +1307,8 @@ int aaruf_close(void *context) ctx->sector_suffix = NULL; free(ctx->sectorSuffixCorrected); ctx->sectorSuffixCorrected = NULL; - free(ctx->sectorSubchannel); - ctx->sectorSubchannel = NULL; + free(ctx->sector_subchannel); + ctx->sector_subchannel = NULL; free(ctx->mode2_subheaders); ctx->mode2_subheaders = NULL; diff --git a/src/read.c b/src/read.c index c802680..a8371e2 100644 --- a/src/read.c +++ b/src/read.c @@ -1006,7 +1006,7 @@ int32_t aaruf_read_sector_long(void *context, const uint64_t sector_address, boo case AppleSonyDS: case AppleWidget: case PriamDataTower: - if(ctx->sectorSubchannel == NULL) + if(ctx->sector_subchannel == NULL) return aaruf_read_sector(context, sector_address, negative, data, length); switch(ctx->imageInfo.MediaType) @@ -1063,7 +1063,7 @@ int32_t aaruf_read_sector_long(void *context, const uint64_t sector_address, boo return res; } - memcpy(data, ctx->sectorSubchannel + corrected_sector_address * tag_length, tag_length); + memcpy(data, ctx->sector_subchannel + corrected_sector_address * tag_length, tag_length); memcpy(data, bare_data, 512); free(bare_data); diff --git a/src/write.c b/src/write.c index 57a7450..fb287c7 100644 --- a/src/write.c +++ b/src/write.c @@ -343,7 +343,7 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative * - **Apple Widget**: 512-byte sectors with tag conversion support * - **Priam DataTower**: 512-byte sectors + 24-byte Priam tags * - Supports automatic tag format conversion between Sony (12), Profile (20), and Priam (24) byte formats - * - Tag data stored in sectorSubchannel buffer for preservation + * - Tag data stored in sector_subchannel buffer for preservation * * **Data Processing Pipeline:** * 1. **Context and Parameter Validation**: Verifies context magic, write permissions, and sector bounds @@ -360,7 +360,8 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative * * sectorPrefixDdtMini: Tracks prefix status and buffer offsets (high 4 bits = status, low 12 bits = offset/16) * * sectorSuffixDdtMini: Tracks suffix status and buffer offsets (high 4 bits = status, low 12 bits = offset/288) * - **Prefix Buffer**: Dynamically growing buffer storing non-standard 16-byte CD prefixes - * - **Suffix Buffer**: Dynamically growing buffer storing non-standard CD suffixes (288 bytes for Mode 1, 4 bytes for Mode 2 Form 2, 280 bytes for Mode 2 Form 1) + * - **Suffix Buffer**: Dynamically growing buffer storing non-standard CD suffixes (288 bytes for Mode 1, 4 bytes for + * Mode 2 Form 2, 280 bytes for Mode 2 Form 1) * - **Subheader Buffer**: Fixed-size buffer (8 bytes per sector) for Mode 2 subheaders * - **Subchannel Buffer**: Fixed-size buffer for block media tag data * - All buffers use doubling reallocation strategy when capacity exceeded @@ -457,7 +458,7 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative * - Failed to allocate or grow prefix buffer (sector_prefix) * - Failed to allocate or grow suffix buffer (sector_suffix) * - Failed to allocate subheader buffer (mode2_subheaders) - * - Failed to allocate subchannel buffer (sectorSubchannel) + * - Failed to allocate subchannel buffer (sector_subchannel) * - System out of memory during buffer reallocation * * @retval AARUF_ERROR_INCORRECT_MEDIA_TYPE (-26) Unsupported media type for long sectors. This occurs when: @@ -468,7 +469,8 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative * - User data DDT entry could not be updated * - DDT table corruption prevents entry modification * - * @retval AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER (-23) Block header write failed. Propagated from aaruf_write_sector() when: + * @retval AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER (-23) Block header write failed. Propagated from aaruf_write_sector() + * when: * - Automatic block closure triggered by user data write fails * - File system error prevents header write * @@ -1117,12 +1119,12 @@ int32_t aaruf_write_sector_long(void *context, uint64_t sector_address, bool neg if(newTagSize == 0) return aaruf_write_sector(context, sector_address, negative, data, sector_status, 512); - if(ctx->sectorSubchannel == NULL) + if(ctx->sector_subchannel == NULL) { - ctx->sectorSubchannel = + ctx->sector_subchannel = calloc(1, newTagSize * (ctx->imageInfo.Sectors + ctx->userDataDdtHeader.overflow)); - if(ctx->sectorSubchannel == NULL) + if(ctx->sector_subchannel == NULL) { FATAL("Could not allocate memory for sector subchannel DDT"); @@ -1133,7 +1135,7 @@ int32_t aaruf_write_sector_long(void *context, uint64_t sector_address, bool neg } } - memcpy(ctx->sectorSubchannel + sector_address * newTagSize, newTag, newTagSize); + memcpy(ctx->sector_subchannel + sector_address * newTagSize, newTag, newTagSize); free(newTag); return aaruf_write_sector(context, sector_address, negative, data, sector_status, 512); diff --git a/tool/info.c b/tool/info.c index 96081fc..6c4a1fa 100644 --- a/tool/info.c +++ b/tool/info.c @@ -73,7 +73,7 @@ int info(const char *path) if(ctx->sectorSuffixCorrected != NULL) printf("Sector suffix corrected array has been read.\n"); - if(ctx->sectorSubchannel != NULL) printf("Sector subchannel array has been read.\n"); + if(ctx->sector_subchannel != NULL) printf("Sector subchannel array has been read.\n"); if(ctx->mode2_subheaders != NULL) printf("Sector mode 2 subheaders array has been read.\n");