mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 11:14:39 +00:00
Rename sectorSubchannel to sector_subchannel for consistency across the codebase
This commit is contained in:
@@ -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).
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
18
src/write.c
18
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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user