Refactor zeroaddress initialization and remove redundant memset call

This commit is contained in:
2025-10-10 23:24:43 +01:00
parent 9a94c36a43
commit 692e4d4790

View File

@@ -167,7 +167,7 @@ bool aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector)
TRACE("Entering aaruf_ecc_cd_is_suffix_correct_mode2(%p, %p)", context, sector);
uint32_t edc;
int size, pos;
uint8_t zeroaddress[4];
uint8_t zeroaddress[4] = {0};
if(context == NULL || sector == NULL)
{
@@ -183,7 +183,7 @@ bool aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector)
return false;
}
memset(&zeroaddress, 4, sizeof(uint8_t));
const int form2 = sector[0x12] & 0x20;
const bool correct_ecc_p = aaruf_ecc_cd_check(context, zeroaddress, sector, 86, 24, 2, 86, sector, 0, 0x10, 0x81C);
if(!correct_ecc_p)
@@ -200,8 +200,6 @@ bool aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector)
return false;
}
const int form2 = (sector[0x12] & 0x20);
uint32_t stored_edc;
memcpy(&stored_edc, form2 ? sector + 0x92C : sector + 0x818, 4);
const uint32_t calculated_edc = aaruf_edc_cd_compute(context, 0, sector, form2 ? 0x91C : 0x808, 0x10);