mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Refactor switch cases in write.c to improve readability by adding braces
And because not using them is apparently something introduced in C23.
This commit is contained in:
10
src/write.c
10
src/write.c
@@ -583,6 +583,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
|
|||||||
switch(ctx->image_info.MetadataMediaType)
|
switch(ctx->image_info.MetadataMediaType)
|
||||||
{
|
{
|
||||||
case OpticalDisc:
|
case OpticalDisc:
|
||||||
|
{
|
||||||
TrackEntry track = {0};
|
TrackEntry track = {0};
|
||||||
|
|
||||||
for(int i = 0; i < ctx->tracks_header.entries; i++)
|
for(int i = 0; i < ctx->tracks_header.entries; i++)
|
||||||
@@ -1069,6 +1070,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case BlockMedia:
|
case BlockMedia:
|
||||||
switch(ctx->image_info.MediaType)
|
switch(ctx->image_info.MediaType)
|
||||||
{
|
{
|
||||||
@@ -1078,6 +1080,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
|
|||||||
case AppleSonySS:
|
case AppleSonySS:
|
||||||
case AppleWidget:
|
case AppleWidget:
|
||||||
case PriamDataTower:
|
case PriamDataTower:
|
||||||
|
{
|
||||||
uint8_t *newTag;
|
uint8_t *newTag;
|
||||||
int newTagSize = 0;
|
int newTagSize = 0;
|
||||||
|
|
||||||
@@ -1085,6 +1088,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
|
|||||||
{
|
{
|
||||||
// Sony tag
|
// Sony tag
|
||||||
case 12:
|
case 12:
|
||||||
|
{
|
||||||
const sony_tag decoded_sony_tag = bytes_to_sony_tag(data + 512);
|
const sony_tag decoded_sony_tag = bytes_to_sony_tag(data + 512);
|
||||||
|
|
||||||
if(ctx->image_info.MediaType == AppleProfile || ctx->image_info.MediaType == AppleFileWare)
|
if(ctx->image_info.MediaType == AppleProfile || ctx->image_info.MediaType == AppleFileWare)
|
||||||
@@ -1107,8 +1111,10 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
|
|||||||
newTagSize = 12;
|
newTagSize = 12;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
// Profile tag
|
// Profile tag
|
||||||
case 20:
|
case 20:
|
||||||
|
{
|
||||||
const profile_tag decoded_profile_tag = bytes_to_profile_tag(data + 512);
|
const profile_tag decoded_profile_tag = bytes_to_profile_tag(data + 512);
|
||||||
|
|
||||||
if(ctx->image_info.MediaType == AppleProfile || ctx->image_info.MediaType == AppleFileWare)
|
if(ctx->image_info.MediaType == AppleProfile || ctx->image_info.MediaType == AppleFileWare)
|
||||||
@@ -1131,8 +1137,10 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
|
|||||||
newTagSize = 12;
|
newTagSize = 12;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
// Priam tag
|
// Priam tag
|
||||||
case 24:
|
case 24:
|
||||||
|
{
|
||||||
const priam_tag decoded_priam_tag = bytes_to_priam_tag(data + 512);
|
const priam_tag decoded_priam_tag = bytes_to_priam_tag(data + 512);
|
||||||
if(ctx->image_info.MediaType == AppleProfile || ctx->image_info.MediaType == AppleFileWare)
|
if(ctx->image_info.MediaType == AppleProfile || ctx->image_info.MediaType == AppleFileWare)
|
||||||
{
|
{
|
||||||
@@ -1154,6 +1162,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
|
|||||||
newTagSize = 12;
|
newTagSize = 12;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 0:
|
case 0:
|
||||||
newTagSize = 0;
|
newTagSize = 0;
|
||||||
break;
|
break;
|
||||||
@@ -1186,6 +1195,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
|
|||||||
free(newTag);
|
free(newTag);
|
||||||
|
|
||||||
return aaruf_write_sector(context, sector_address, negative, data, sector_status, 512);
|
return aaruf_write_sector(context, sector_address, negative, data, sector_status, 512);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return AARUF_ERROR_INCORRECT_MEDIA_TYPE;
|
return AARUF_ERROR_INCORRECT_MEDIA_TYPE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user