mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Refactor verify functions to use const char* for path parameters
This commit is contained in:
@@ -29,8 +29,8 @@ char *byte_array_to_hex_string(const unsigned char *array, int array_size);
|
|||||||
int read(unsigned long long sector_no, char *path);
|
int read(unsigned long long sector_no, char *path);
|
||||||
int printhex(unsigned char *array, unsigned int length, int width, bool color);
|
int printhex(unsigned char *array, unsigned int length, int width, bool color);
|
||||||
int read_long(unsigned long long sector_no, char *path);
|
int read_long(unsigned long long sector_no, char *path);
|
||||||
int verify(char *path);
|
int verify(const char *path);
|
||||||
int verify_sectors(char *path);
|
int verify_sectors(const char *path);
|
||||||
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 compare(char *path1, char *path2);
|
int compare(char *path1, char *path2);
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ void draw_progress_bar(int row, int percent)
|
|||||||
int compare(char *path1, char *path2)
|
int compare(char *path1, char *path2)
|
||||||
{
|
{
|
||||||
int ret = AARUF_STATUS_OK;
|
int ret = AARUF_STATUS_OK;
|
||||||
aaruformatContext const *ctx1 = NULL;
|
aaruformatContext *ctx1 = NULL;
|
||||||
aaruformatContext const *ctx2 = NULL;
|
aaruformatContext *ctx2 = NULL;
|
||||||
bool imagesAreDifferent = false;
|
bool imagesAreDifferent = false;
|
||||||
char *strBuffer = NULL;
|
char *strBuffer = NULL;
|
||||||
UErrorCode u_error_code = U_ZERO_ERROR;
|
UErrorCode u_error_code = U_ZERO_ERROR;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "aaruformattool.h"
|
#include "aaruformattool.h"
|
||||||
|
|
||||||
int verify(char *path)
|
int verify(const char *path)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx = NULL;
|
aaruformatContext *ctx = NULL;
|
||||||
uint32_t res = 0;
|
uint32_t res = 0;
|
||||||
@@ -48,7 +48,7 @@ int verify(char *path)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int verify_sectors(char *path)
|
int verify_sectors(const char *path)
|
||||||
{
|
{
|
||||||
aaruformatContext *ctx = NULL;
|
aaruformatContext *ctx = NULL;
|
||||||
uint8_t *buffer = NULL;
|
uint8_t *buffer = NULL;
|
||||||
@@ -80,7 +80,7 @@ int verify_sectors(char *path)
|
|||||||
unknowns = 0;
|
unknowns = 0;
|
||||||
any_error = false;
|
any_error = false;
|
||||||
|
|
||||||
for (uint64_t 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);
|
||||||
@@ -103,11 +103,11 @@ int verify_sectors(char *path)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_edc && !edc_correct) printf("\rSector %llu has an incorrect EDC value.\n", s);
|
if(has_edc && !edc_correct) printf("\rSector %llu has an incorrect EDC value.\n", s);
|
||||||
|
|
||||||
if (has_ecc_p && !ecc_p_correct) printf("\rSector %llu has an incorrect EDC value.\n", s);
|
if(has_ecc_p && !ecc_p_correct) printf("\rSector %llu has an incorrect EDC value.\n", s);
|
||||||
|
|
||||||
if (has_ecc_q && !ecc_q_correct) printf("\rSector %llu has an incorrect EDC value.\n", s);
|
if(has_ecc_q && !ecc_q_correct) printf("\rSector %llu has an incorrect EDC value.\n", s);
|
||||||
|
|
||||||
errors++;
|
errors++;
|
||||||
any_error = true;
|
any_error = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user