mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
[refactor] Initialize variables to default values in multiple files
This commit is contained in:
@@ -28,9 +28,9 @@
|
|||||||
|
|
||||||
int aaruf_close(void *context)
|
int aaruf_close(void *context)
|
||||||
{
|
{
|
||||||
int i;
|
int i = 0;
|
||||||
mediaTagEntry *mediaTag;
|
mediaTagEntry *mediaTag = NULL;
|
||||||
mediaTagEntry *tmpMediaTag;
|
mediaTagEntry *tmpMediaTag = NULL;
|
||||||
|
|
||||||
if(context == NULL)
|
if(context == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
AARU_EXPORT crc64_ctx *AARU_CALL aaruf_crc64_init(void)
|
AARU_EXPORT crc64_ctx *AARU_CALL aaruf_crc64_init(void)
|
||||||
{
|
{
|
||||||
int i, slice;
|
|
||||||
crc64_ctx *ctx = (crc64_ctx *)malloc(sizeof(crc64_ctx));
|
crc64_ctx *ctx = (crc64_ctx *)malloc(sizeof(crc64_ctx));
|
||||||
|
|
||||||
if(!ctx) return NULL;
|
if(!ctx) return NULL;
|
||||||
@@ -68,7 +67,7 @@ AARU_EXPORT void AARU_CALL aaruf_crc64_slicing(uint64_t *previous_crc, const uin
|
|||||||
|
|
||||||
if(len > 4)
|
if(len > 4)
|
||||||
{
|
{
|
||||||
const uint8_t *limit;
|
const uint8_t *limit = NULL;
|
||||||
|
|
||||||
while((uintptr_t)(data) & 3)
|
while((uintptr_t)(data) & 3)
|
||||||
{
|
{
|
||||||
|
|||||||
25
src/cst.c
25
src/cst.c
@@ -24,15 +24,22 @@
|
|||||||
|
|
||||||
int32_t aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, size_t length)
|
int32_t aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, size_t length)
|
||||||
{
|
{
|
||||||
uint8_t *p, *q, *r, *s, *t, *u, *v, *w;
|
uint8_t *p = NULL;
|
||||||
size_t qStart;
|
uint8_t *q = NULL;
|
||||||
size_t rStart;
|
uint8_t *r = NULL;
|
||||||
size_t sStart;
|
uint8_t *s = NULL;
|
||||||
size_t tStart;
|
uint8_t *t = NULL;
|
||||||
size_t uStart;
|
uint8_t *u = NULL;
|
||||||
size_t vStart;
|
uint8_t *v = NULL;
|
||||||
size_t wStart;
|
uint8_t *w = NULL;
|
||||||
size_t i;
|
size_t qStart = 0;
|
||||||
|
size_t rStart = 0;
|
||||||
|
size_t sStart = 0;
|
||||||
|
size_t tStart = 0;
|
||||||
|
size_t uStart = 0;
|
||||||
|
size_t vStart = 0;
|
||||||
|
size_t wStart = 0;
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
if(interleaved == NULL || sequential == NULL) return AARUF_ERROR_BUFFER_TOO_SMALL;
|
if(interleaved == NULL || sequential == NULL) return AARUF_ERROR_BUFFER_TOO_SMALL;
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
void *aaruf_ecc_cd_init()
|
void *aaruf_ecc_cd_init()
|
||||||
{
|
{
|
||||||
CdEccContext *context;
|
CdEccContext *context = NULL;
|
||||||
uint32_t edc, i, j;
|
uint32_t edc = 0, i = 0, j = 0;
|
||||||
|
|
||||||
context = (CdEccContext *)malloc(sizeof(CdEccContext));
|
context = (CdEccContext *)malloc(sizeof(CdEccContext));
|
||||||
|
|
||||||
|
|||||||
16
src/flac.c
16
src/flac.c
@@ -37,10 +37,10 @@ static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecod
|
|||||||
AARU_EXPORT size_t AARU_CALL aaruf_flac_decode_redbook_buffer(uint8_t *dst_buffer, size_t dst_size,
|
AARU_EXPORT size_t AARU_CALL aaruf_flac_decode_redbook_buffer(uint8_t *dst_buffer, size_t dst_size,
|
||||||
const uint8_t *src_buffer, size_t src_size)
|
const uint8_t *src_buffer, size_t src_size)
|
||||||
{
|
{
|
||||||
FLAC__StreamDecoder *decoder;
|
FLAC__StreamDecoder *decoder = NULL;
|
||||||
FLAC__StreamDecoderInitStatus init_status;
|
FLAC__StreamDecoderInitStatus init_status = FLAC__STREAM_DECODER_INIT_STATUS_OK;
|
||||||
aaru_flac_ctx *ctx = (aaru_flac_ctx *)malloc(sizeof(aaru_flac_ctx));
|
aaru_flac_ctx *ctx = (aaru_flac_ctx *)malloc(sizeof(aaru_flac_ctx));
|
||||||
size_t ret_size;
|
size_t ret_size = 0;
|
||||||
|
|
||||||
memset(ctx, 0, sizeof(aaru_flac_ctx));
|
memset(ctx, 0, sizeof(aaru_flac_ctx));
|
||||||
|
|
||||||
@@ -148,12 +148,12 @@ AARU_EXPORT size_t AARU_CALL aaruf_flac_encode_redbook_buffer(
|
|||||||
uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id,
|
uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id,
|
||||||
uint32_t application_id_len)
|
uint32_t application_id_len)
|
||||||
{
|
{
|
||||||
FLAC__StreamEncoder *encoder;
|
FLAC__StreamEncoder *encoder = NULL;
|
||||||
aaru_flac_ctx *ctx = (aaru_flac_ctx *)malloc(sizeof(aaru_flac_ctx));
|
aaru_flac_ctx *ctx = (aaru_flac_ctx *)malloc(sizeof(aaru_flac_ctx));
|
||||||
FLAC__StreamEncoderInitStatus init_status;
|
FLAC__StreamEncoderInitStatus init_status = FLAC__STREAM_ENCODER_INIT_STATUS_OK;
|
||||||
size_t ret_size;
|
size_t ret_size = 0;
|
||||||
FLAC__int32 *pcm;
|
FLAC__int32 *pcm = NULL;
|
||||||
int i;
|
int i = 0;
|
||||||
int16_t *buffer16 = (int16_t *)src_buffer;
|
int16_t *buffer16 = (int16_t *)src_buffer;
|
||||||
FLAC__StreamMetadata *metadata[1];
|
FLAC__StreamMetadata *metadata[1];
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
int aaruf_identify(const char *filename)
|
int aaruf_identify(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *stream;
|
FILE *stream = NULL;
|
||||||
|
|
||||||
stream = fopen(filename, "rb");
|
stream = fopen(filename, "rb");
|
||||||
|
|
||||||
|
|||||||
32
src/open.c
32
src/open.c
@@ -30,25 +30,25 @@
|
|||||||
|
|
||||||
void *aaruf_open(const char *filepath)
|
void *aaruf_open(const char *filepath)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx;
|
aaruformatContext *ctx = NULL;
|
||||||
int errorNo;
|
int errorNo = 0;
|
||||||
size_t readBytes;
|
size_t readBytes = 0;
|
||||||
long pos;
|
long pos = 0;
|
||||||
IndexHeader idxHeader;
|
IndexHeader idxHeader;
|
||||||
IndexEntry *idxEntries;
|
IndexEntry *idxEntries = NULL;
|
||||||
uint8_t *data;
|
uint8_t *data = NULL;
|
||||||
uint8_t *cmpData;
|
uint8_t *cmpData = NULL;
|
||||||
uint8_t *cstData;
|
uint8_t *cstData = NULL;
|
||||||
uint32_t *cdDdt;
|
uint32_t *cdDdt = NULL;
|
||||||
uint64_t crc64;
|
uint64_t crc64 = 0;
|
||||||
int i, j, k;
|
int i = 0, j = 0, k = 0;
|
||||||
uint16_t e;
|
uint16_t e = 0;
|
||||||
uint8_t lzmaProperties[LZMA_PROPERTIES_LENGTH];
|
uint8_t lzmaProperties[LZMA_PROPERTIES_LENGTH];
|
||||||
size_t lzmaSize;
|
size_t lzmaSize = 0;
|
||||||
ChecksumHeader checksum_header;
|
ChecksumHeader checksum_header;
|
||||||
ChecksumEntry *checksum_entry;
|
ChecksumEntry const *checksum_entry = NULL;
|
||||||
mediaTagEntry *mediaTag;
|
mediaTagEntry *mediaTag = NULL;
|
||||||
mediaTagEntry *oldMediaTag;
|
mediaTagEntry *oldMediaTag = NULL;
|
||||||
|
|
||||||
ctx = (aaruformatContext *)malloc(sizeof(aaruformatContext));
|
ctx = (aaruformatContext *)malloc(sizeof(aaruformatContext));
|
||||||
memset(ctx, 0, sizeof(aaruformatContext));
|
memset(ctx, 0, sizeof(aaruformatContext));
|
||||||
|
|||||||
36
src/read.c
36
src/read.c
@@ -55,18 +55,18 @@ int32_t aaruf_read_media_tag(void *context, uint8_t *data, int32_t tag, uint32_t
|
|||||||
|
|
||||||
int32_t aaruf_read_sector(void *context, uint64_t sectorAddress, uint8_t *data, uint32_t *length)
|
int32_t aaruf_read_sector(void *context, uint64_t sectorAddress, uint8_t *data, uint32_t *length)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx;
|
aaruformatContext *ctx = NULL;
|
||||||
uint64_t ddtEntry;
|
uint64_t ddtEntry = 0;
|
||||||
uint32_t offsetMask;
|
uint32_t offsetMask = 0;
|
||||||
uint64_t offset;
|
uint64_t offset = 0;
|
||||||
uint64_t blockOffset;
|
uint64_t blockOffset = 0;
|
||||||
BlockHeader *blockHeader;
|
BlockHeader *blockHeader = NULL;
|
||||||
uint8_t *block;
|
uint8_t *block = NULL;
|
||||||
size_t readBytes;
|
size_t readBytes = 0;
|
||||||
uint8_t lzmaProperties[LZMA_PROPERTIES_LENGTH];
|
uint8_t lzmaProperties[LZMA_PROPERTIES_LENGTH];
|
||||||
size_t lzmaSize;
|
size_t lzmaSize = 0;
|
||||||
uint8_t *cmpData;
|
uint8_t *cmpData = NULL;
|
||||||
int errorNo;
|
int errorNo = 0;
|
||||||
|
|
||||||
if(context == NULL) return AARUF_ERROR_NOT_AARUFORMAT;
|
if(context == NULL) return AARUF_ERROR_NOT_AARUFORMAT;
|
||||||
|
|
||||||
@@ -279,14 +279,14 @@ int32_t aaruf_read_track_sector(void *context, uint8_t *data, uint64_t sectorAdd
|
|||||||
|
|
||||||
int32_t aaruf_read_sector_long(void *context, uint64_t sectorAddress, uint8_t *data, uint32_t *length)
|
int32_t aaruf_read_sector_long(void *context, uint64_t sectorAddress, uint8_t *data, uint32_t *length)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx;
|
aaruformatContext *ctx = NULL;
|
||||||
uint32_t bareLength;
|
uint32_t bareLength = 0;
|
||||||
uint32_t tagLength;
|
uint32_t tagLength = 0;
|
||||||
uint8_t *bareData;
|
uint8_t *bareData = NULL;
|
||||||
int32_t res;
|
int32_t res = 0;
|
||||||
TrackEntry trk;
|
TrackEntry trk;
|
||||||
int i;
|
int i = 0;
|
||||||
bool trkFound;
|
bool trkFound = false;
|
||||||
|
|
||||||
if(context == NULL) return AARUF_ERROR_NOT_AARUFORMAT;
|
if(context == NULL) return AARUF_ERROR_NOT_AARUFORMAT;
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ int have_avx2()
|
|||||||
#if(defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)) && defined(__APPLE__)
|
#if(defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)) && defined(__APPLE__)
|
||||||
int have_neon_apple()
|
int have_neon_apple()
|
||||||
{
|
{
|
||||||
int value;
|
int value = 0;
|
||||||
size_t len = sizeof(int);
|
size_t len = sizeof(int);
|
||||||
int ret = sysctlbyname("hw.optional.neon", &value, &len, NULL, 0);
|
int ret = sysctlbyname("hw.optional.neon", &value, &len, NULL, 0);
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ int have_neon_apple()
|
|||||||
|
|
||||||
int have_crc32_apple()
|
int have_crc32_apple()
|
||||||
{
|
{
|
||||||
int value;
|
int value = 0;
|
||||||
size_t len = sizeof(int);
|
size_t len = sizeof(int);
|
||||||
int ret = sysctlbyname("hw.optional.crc32", &value, &len, NULL, 0);
|
int ret = sysctlbyname("hw.optional.crc32", &value, &len, NULL, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -50,10 +50,9 @@ AARU_EXPORT spamsum_ctx *AARU_CALL aaruf_spamsum_init(void)
|
|||||||
|
|
||||||
AARU_EXPORT int AARU_CALL aaruf_spamsum_update(spamsum_ctx *ctx, const uint8_t *data, uint32_t len)
|
AARU_EXPORT int AARU_CALL aaruf_spamsum_update(spamsum_ctx *ctx, const uint8_t *data, uint32_t len)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
if(!ctx || !data) return -1;
|
if(!ctx || !data) return -1;
|
||||||
|
|
||||||
for(i = 0; i < len; i++) fuzzy_engine_step(ctx, data[i]);
|
for (int i = 0; i < len; i++) fuzzy_engine_step(ctx, data[i]);
|
||||||
|
|
||||||
ctx->total_size += len;
|
ctx->total_size += len;
|
||||||
|
|
||||||
@@ -71,7 +70,7 @@ AARU_EXPORT void AARU_CALL aaruf_spamsum_free(spamsum_ctx *ctx)
|
|||||||
|
|
||||||
AARU_LOCAL inline void fuzzy_engine_step(spamsum_ctx *ctx, uint8_t c)
|
AARU_LOCAL inline void fuzzy_engine_step(spamsum_ctx *ctx, uint8_t c)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i = 0;
|
||||||
/* At each character we update the rolling hash and the normal hashes.
|
/* At each character we update the rolling hash and the normal hashes.
|
||||||
* When the rolling hash hits a reset value then we emit a normal hash
|
* When the rolling hash hits a reset value then we emit a normal hash
|
||||||
* as a element of the signature and reset the normal hash. */
|
* as a element of the signature and reset the normal hash. */
|
||||||
|
|||||||
20
src/verify.c
20
src/verify.c
@@ -24,16 +24,16 @@
|
|||||||
|
|
||||||
int32_t aaruf_verify_image(void *context)
|
int32_t aaruf_verify_image(void *context)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx;
|
aaruformatContext *ctx = NULL;
|
||||||
uint64_t crc64;
|
uint64_t crc64 = 0;
|
||||||
int i;
|
int i = 0;
|
||||||
IndexHeader index_header;
|
IndexHeader index_header;
|
||||||
IndexEntry *index_entries;
|
IndexEntry *index_entries = NULL;
|
||||||
size_t read_bytes;
|
size_t read_bytes = 0;
|
||||||
void *buffer;
|
void *buffer = NULL;
|
||||||
crc64_ctx *crc64_context;
|
crc64_ctx *crc64_context = NULL;
|
||||||
BlockHeader block_header;
|
BlockHeader block_header;
|
||||||
uint64_t verified_bytes;
|
uint64_t verified_bytes = 0;
|
||||||
DdtHeader ddt_header;
|
DdtHeader ddt_header;
|
||||||
TracksHeader tracks_header;
|
TracksHeader tracks_header;
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ int32_t aaruf_verify_image(void *context)
|
|||||||
|
|
||||||
if(crc64 != index_header.crc64)
|
if(crc64 != index_header.crc64)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Expected index CRC 0x%16llX but got 0x%16lX.\n", index_header.crc64, crc64);
|
fprintf(stderr, "Expected index CRC 0x%16llX but got 0x%16llX.\n", index_header.crc64, crc64);
|
||||||
free(index_entries);
|
free(index_entries);
|
||||||
return AARUF_ERROR_INVALID_BLOCK_CRC;
|
return AARUF_ERROR_INVALID_BLOCK_CRC;
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ int32_t aaruf_verify_image(void *context)
|
|||||||
|
|
||||||
if(crc64 != block_header.cmpCrc64)
|
if(crc64 != block_header.cmpCrc64)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Expected block CRC 0x%16llX but got 0x%16lX.\n", block_header.cmpCrc64, crc64);
|
fprintf(stderr, "Expected block CRC 0x%16llX but got 0x%16llX.\n", block_header.cmpCrc64, crc64);
|
||||||
free(index_entries);
|
free(index_entries);
|
||||||
return AARUF_ERROR_INVALID_BLOCK_CRC;
|
return AARUF_ERROR_INVALID_BLOCK_CRC;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,9 @@
|
|||||||
bool check_cd_sector_channel(CdEccContext *context, uint8_t *sector, bool *unknown, bool *has_edc, bool *edc_correct,
|
bool check_cd_sector_channel(CdEccContext *context, uint8_t *sector, bool *unknown, bool *has_edc, bool *edc_correct,
|
||||||
bool *has_ecc_p, bool *ecc_p_correct, bool *has_ecc_q, bool *ecc_q_correct)
|
bool *has_ecc_p, bool *ecc_p_correct, bool *has_ecc_q, bool *ecc_q_correct)
|
||||||
{
|
{
|
||||||
int i;
|
int i = 0;
|
||||||
uint32_t storedEdc, edc, calculatedEdc;
|
uint32_t storedEdc = 0, edc = 0, calculatedEdc = 0;
|
||||||
int size, pos;
|
int size = 0, pos = 0;
|
||||||
uint8_t zeroaddress[4];
|
uint8_t zeroaddress[4];
|
||||||
|
|
||||||
*has_edc = false;
|
*has_edc = false;
|
||||||
|
|||||||
@@ -25,15 +25,14 @@
|
|||||||
char *byte_array_to_hex_string(const unsigned char *array, int array_size)
|
char *byte_array_to_hex_string(const unsigned char *array, int array_size)
|
||||||
{
|
{
|
||||||
char *hex_string = NULL;
|
char *hex_string = NULL;
|
||||||
int j;
|
int j = 0;
|
||||||
int i;
|
|
||||||
|
|
||||||
hex_string = malloc(array_size * 2 + 1);
|
hex_string = malloc(array_size * 2 + 1);
|
||||||
|
|
||||||
if(hex_string == NULL) return NULL;
|
if(hex_string == NULL) return NULL;
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
for(i = 0; i < array_size; i++)
|
for (int i = 0; i < array_size; i++)
|
||||||
{
|
{
|
||||||
hex_string[j] = (array[i] >> 4) + '0';
|
hex_string[j] = (array[i] >> 4) + '0';
|
||||||
if(hex_string[j] > '9') hex_string[j] += 0x7;
|
if(hex_string[j] > '9') hex_string[j] += 0x7;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
int identify(char *path)
|
int identify(char *path)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
ret = aaruf_identify(path);
|
ret = aaruf_identify(path);
|
||||||
|
|
||||||
|
|||||||
10
tool/info.c
10
tool/info.c
@@ -29,12 +29,12 @@
|
|||||||
|
|
||||||
int info(char *path)
|
int info(char *path)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx;
|
aaruformatContext *ctx = NULL;
|
||||||
char *strBuffer;
|
char *strBuffer = NULL;
|
||||||
UErrorCode u_error_code = U_ZERO_ERROR;
|
UErrorCode u_error_code = U_ZERO_ERROR;
|
||||||
uint i, j;
|
uint i = 0, j = 0;
|
||||||
mediaTagEntry *mediaTag;
|
mediaTagEntry const *mediaTag = NULL;
|
||||||
mediaTagEntry *tmpMediaTag;
|
mediaTagEntry const *tmpMediaTag = NULL;
|
||||||
UChar ustr[128];
|
UChar ustr[128];
|
||||||
|
|
||||||
ctx = aaruf_open(path);
|
ctx = aaruf_open(path);
|
||||||
|
|||||||
@@ -27,16 +27,16 @@ int printhex(unsigned char *array, unsigned int length, int width, bool color)
|
|||||||
char length_hex[17];
|
char length_hex[17];
|
||||||
char str[256];
|
char str[256];
|
||||||
char format[256];
|
char format[256];
|
||||||
int rows;
|
int rows = 0;
|
||||||
int last;
|
int last = 0;
|
||||||
int offset_length;
|
int offset_length = 0;
|
||||||
int str_length = strlen("Offset");
|
int str_length = strlen("Offset");
|
||||||
int i;
|
int i = 0;
|
||||||
int b;
|
int b = 0;
|
||||||
int last_bytes;
|
int last_bytes = 0;
|
||||||
int last_spaces;
|
int last_spaces = 0;
|
||||||
int j;
|
int j = 0;
|
||||||
unsigned char v;
|
unsigned char v = 0;
|
||||||
|
|
||||||
if(array == NULL) return 0;
|
if(array == NULL) return 0;
|
||||||
|
|
||||||
|
|||||||
16
tool/read.c
16
tool/read.c
@@ -26,10 +26,10 @@
|
|||||||
|
|
||||||
int read(unsigned long long sector_no, char *path)
|
int read(unsigned long long sector_no, char *path)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx;
|
aaruformatContext *ctx = NULL;
|
||||||
int32_t res;
|
int32_t res = 0;
|
||||||
uint32_t length;
|
uint32_t length = 0;
|
||||||
uint8_t *data;
|
uint8_t *data = NULL;
|
||||||
|
|
||||||
ctx = aaruf_open(path);
|
ctx = aaruf_open(path);
|
||||||
|
|
||||||
@@ -76,10 +76,10 @@ int read(unsigned long long sector_no, char *path)
|
|||||||
|
|
||||||
int read_long(unsigned long long sector_no, char *path)
|
int read_long(unsigned long long sector_no, char *path)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx;
|
aaruformatContext *ctx = NULL;
|
||||||
int32_t res;
|
int32_t res = 0;
|
||||||
uint32_t length;
|
uint32_t length = 0;
|
||||||
uint8_t *data;
|
uint8_t *data = NULL;
|
||||||
|
|
||||||
ctx = aaruf_open(path);
|
ctx = aaruf_open(path);
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
int verify(char *path)
|
int verify(char *path)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx;
|
aaruformatContext *ctx = NULL;
|
||||||
uint32_t res;
|
uint32_t res = 0;
|
||||||
|
|
||||||
ctx = aaruf_open(path);
|
ctx = aaruf_open(path);
|
||||||
|
|
||||||
@@ -50,17 +50,18 @@ int verify(char *path)
|
|||||||
|
|
||||||
int verify_sectors(char *path)
|
int verify_sectors(char *path)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx;
|
aaruformatContext *ctx = NULL;
|
||||||
uint64_t s;
|
uint8_t *buffer = NULL;
|
||||||
uint8_t *buffer;
|
|
||||||
uint32_t buffer_len = 2352;
|
uint32_t buffer_len = 2352;
|
||||||
int32_t res;
|
int32_t res = 0;
|
||||||
CdEccContext *cd_ecc_context;
|
CdEccContext *cd_ecc_context = NULL;
|
||||||
ctx = aaruf_open(path);
|
ctx = aaruf_open(path);
|
||||||
bool verify_result;
|
bool verify_result = false;
|
||||||
bool unknown, has_edc, edc_correct, has_ecc_p, ecc_p_correct, has_ecc_q, ecc_q_correct;
|
bool has_edc = false, has_ecc_p = false, ecc_p_correct = false, has_ecc_q = false, ecc_q_correct = false;
|
||||||
uint64_t errors, unknowns;
|
bool edc_correct = false;
|
||||||
bool any_error;
|
bool unknown = false;
|
||||||
|
uint64_t errors = 0, unknowns = 0;
|
||||||
|
bool any_error = false;
|
||||||
|
|
||||||
if(ctx == NULL)
|
if(ctx == NULL)
|
||||||
{
|
{
|
||||||
@@ -79,7 +80,7 @@ int verify_sectors(char *path)
|
|||||||
unknowns = 0;
|
unknowns = 0;
|
||||||
any_error = false;
|
any_error = false;
|
||||||
|
|
||||||
for(s = 0; s < ctx->imageInfo.Sectors; s++)
|
for (uint64_t s = 0; s < ctx->imageInfo.Sectors; s++)
|
||||||
{
|
{
|
||||||
printf("\rVerifying sector %llu...", s);
|
printf("\rVerifying sector %llu...", s);
|
||||||
res = aaruf_read_sector_long(ctx, s, buffer, &buffer_len);
|
res = aaruf_read_sector_long(ctx, s, buffer, &buffer_len);
|
||||||
|
|||||||
Reference in New Issue
Block a user