mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 11:14:39 +00:00
[refactor] Initialize variables to default values in multiple files
This commit is contained in:
@@ -25,9 +25,9 @@
|
||||
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)
|
||||
{
|
||||
int i;
|
||||
uint32_t storedEdc, edc, calculatedEdc;
|
||||
int size, pos;
|
||||
int i = 0;
|
||||
uint32_t storedEdc = 0, edc = 0, calculatedEdc = 0;
|
||||
int size = 0, pos = 0;
|
||||
uint8_t zeroaddress[4];
|
||||
|
||||
*has_edc = false;
|
||||
|
||||
@@ -25,15 +25,14 @@
|
||||
char *byte_array_to_hex_string(const unsigned char *array, int array_size)
|
||||
{
|
||||
char *hex_string = NULL;
|
||||
int j;
|
||||
int i;
|
||||
int j = 0;
|
||||
|
||||
hex_string = malloc(array_size * 2 + 1);
|
||||
|
||||
if(hex_string == NULL) return NULL;
|
||||
|
||||
j = 0;
|
||||
for(i = 0; i < array_size; i++)
|
||||
for (int i = 0; i < array_size; i++)
|
||||
{
|
||||
hex_string[j] = (array[i] >> 4) + '0';
|
||||
if(hex_string[j] > '9') hex_string[j] += 0x7;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
int identify(char *path)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
ret = aaruf_identify(path);
|
||||
|
||||
|
||||
10
tool/info.c
10
tool/info.c
@@ -29,12 +29,12 @@
|
||||
|
||||
int info(char *path)
|
||||
{
|
||||
aaruformatContext *ctx;
|
||||
char *strBuffer;
|
||||
aaruformatContext *ctx = NULL;
|
||||
char *strBuffer = NULL;
|
||||
UErrorCode u_error_code = U_ZERO_ERROR;
|
||||
uint i, j;
|
||||
mediaTagEntry *mediaTag;
|
||||
mediaTagEntry *tmpMediaTag;
|
||||
uint i = 0, j = 0;
|
||||
mediaTagEntry const *mediaTag = NULL;
|
||||
mediaTagEntry const *tmpMediaTag = NULL;
|
||||
UChar ustr[128];
|
||||
|
||||
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 str[256];
|
||||
char format[256];
|
||||
int rows;
|
||||
int last;
|
||||
int offset_length;
|
||||
int rows = 0;
|
||||
int last = 0;
|
||||
int offset_length = 0;
|
||||
int str_length = strlen("Offset");
|
||||
int i;
|
||||
int b;
|
||||
int last_bytes;
|
||||
int last_spaces;
|
||||
int j;
|
||||
unsigned char v;
|
||||
int i = 0;
|
||||
int b = 0;
|
||||
int last_bytes = 0;
|
||||
int last_spaces = 0;
|
||||
int j = 0;
|
||||
unsigned char v = 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)
|
||||
{
|
||||
aaruformatContext *ctx;
|
||||
int32_t res;
|
||||
uint32_t length;
|
||||
uint8_t *data;
|
||||
aaruformatContext *ctx = NULL;
|
||||
int32_t res = 0;
|
||||
uint32_t length = 0;
|
||||
uint8_t *data = NULL;
|
||||
|
||||
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)
|
||||
{
|
||||
aaruformatContext *ctx;
|
||||
int32_t res;
|
||||
uint32_t length;
|
||||
uint8_t *data;
|
||||
aaruformatContext *ctx = NULL;
|
||||
int32_t res = 0;
|
||||
uint32_t length = 0;
|
||||
uint8_t *data = NULL;
|
||||
|
||||
ctx = aaruf_open(path);
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
int verify(char *path)
|
||||
{
|
||||
aaruformatContext *ctx;
|
||||
uint32_t res;
|
||||
aaruformatContext *ctx = NULL;
|
||||
uint32_t res = 0;
|
||||
|
||||
ctx = aaruf_open(path);
|
||||
|
||||
@@ -50,17 +50,18 @@ int verify(char *path)
|
||||
|
||||
int verify_sectors(char *path)
|
||||
{
|
||||
aaruformatContext *ctx;
|
||||
uint64_t s;
|
||||
uint8_t *buffer;
|
||||
aaruformatContext *ctx = NULL;
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t buffer_len = 2352;
|
||||
int32_t res;
|
||||
CdEccContext *cd_ecc_context;
|
||||
int32_t res = 0;
|
||||
CdEccContext *cd_ecc_context = NULL;
|
||||
ctx = aaruf_open(path);
|
||||
bool verify_result;
|
||||
bool unknown, has_edc, edc_correct, has_ecc_p, ecc_p_correct, has_ecc_q, ecc_q_correct;
|
||||
uint64_t errors, unknowns;
|
||||
bool any_error;
|
||||
bool verify_result = false;
|
||||
bool has_edc = false, has_ecc_p = false, ecc_p_correct = false, has_ecc_q = false, ecc_q_correct = false;
|
||||
bool edc_correct = false;
|
||||
bool unknown = false;
|
||||
uint64_t errors = 0, unknowns = 0;
|
||||
bool any_error = false;
|
||||
|
||||
if(ctx == NULL)
|
||||
{
|
||||
@@ -79,7 +80,7 @@ int verify_sectors(char *path)
|
||||
unknowns = 0;
|
||||
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);
|
||||
res = aaruf_read_sector_long(ctx, s, buffer, &buffer_len);
|
||||
|
||||
Reference in New Issue
Block a user