Rename field names for consistency across the codebase

This commit is contained in:
2025-10-09 02:33:35 +01:00
parent 5e346e6fd5
commit b884cfe8ea
27 changed files with 1929 additions and 1904 deletions

View File

@@ -28,18 +28,18 @@
int cli_compare(const char *path1, const char *path2)
{
aaruformatContext *ctx1 = NULL;
aaruformatContext *ctx2 = NULL;
uint8_t *buffer1 = NULL;
uint8_t *buffer2 = NULL;
uint32_t buffer1_length = 0;
uint32_t buffer2_length = 0;
uint64_t total_sectors = 0;
uint64_t different_sectors = 0;
uint64_t sectors_processed = 0;
int result = 0;
int32_t read_result1 = 0;
int32_t read_result2 = 0;
aaruformat_context *ctx1 = NULL;
aaruformat_context *ctx2 = NULL;
uint8_t *buffer1 = NULL;
uint8_t *buffer2 = NULL;
uint32_t buffer1_length = 0;
uint32_t buffer2_length = 0;
uint64_t total_sectors = 0;
uint64_t different_sectors = 0;
uint64_t sectors_processed = 0;
int result = 0;
int32_t read_result1 = 0;
int32_t read_result2 = 0;
printf("Opening first image: %s\n", path1);
ctx1 = aaruf_open(path1);
@@ -60,32 +60,32 @@ int cli_compare(const char *path1, const char *path2)
// Access image information through context structure
printf("\nImage Information:\n");
printf("Image 1: %llu sectors, %u bytes per sector\n", (unsigned long long)ctx1->imageInfo.Sectors,
ctx1->imageInfo.SectorSize);
printf("Image 2: %llu sectors, %u bytes per sector\n", (unsigned long long)ctx2->imageInfo.Sectors,
ctx2->imageInfo.SectorSize);
printf("Image 1: %llu sectors, %u bytes per sector\n", (unsigned long long)ctx1->image_info.Sectors,
ctx1->image_info.SectorSize);
printf("Image 2: %llu sectors, %u bytes per sector\n", (unsigned long long)ctx2->image_info.Sectors,
ctx2->image_info.SectorSize);
if(ctx1->imageInfo.Sectors != ctx2->imageInfo.Sectors)
if(ctx1->image_info.Sectors != ctx2->image_info.Sectors)
{
fprintf(stderr, "Warning: Images have different number of sectors\n");
total_sectors =
ctx1->imageInfo.Sectors < ctx2->imageInfo.Sectors ? ctx1->imageInfo.Sectors : ctx2->imageInfo.Sectors;
ctx1->image_info.Sectors < ctx2->image_info.Sectors ? ctx1->image_info.Sectors : ctx2->image_info.Sectors;
printf("Will compare first %llu sectors\n", (unsigned long long)total_sectors);
}
else { total_sectors = ctx1->imageInfo.Sectors; }
else { total_sectors = ctx1->image_info.Sectors; }
if(ctx1->imageInfo.SectorSize != ctx2->imageInfo.SectorSize)
if(ctx1->image_info.SectorSize != ctx2->image_info.SectorSize)
{
fprintf(stderr, "Error: Images have different sector sizes (%u vs %u)\n", ctx1->imageInfo.SectorSize,
ctx2->imageInfo.SectorSize);
fprintf(stderr, "Error: Images have different sector sizes (%u vs %u)\n", ctx1->image_info.SectorSize,
ctx2->image_info.SectorSize);
aaruf_close(ctx1);
aaruf_close(ctx2);
return -1;
}
// Allocate buffers for sector data
buffer1 = malloc(ctx1->imageInfo.SectorSize);
buffer2 = malloc(ctx2->imageInfo.SectorSize);
buffer1 = malloc(ctx1->image_info.SectorSize);
buffer2 = malloc(ctx2->image_info.SectorSize);
if(buffer1 == NULL || buffer2 == NULL)
{
fprintf(stderr, "Error: Could not allocate memory for sector buffers\n");
@@ -103,8 +103,8 @@ int cli_compare(const char *path1, const char *path2)
// Compare sectors
for(uint64_t sector = 0; sector < total_sectors; sector++)
{
buffer1_length = ctx1->imageInfo.SectorSize;
buffer2_length = ctx2->imageInfo.SectorSize;
buffer1_length = ctx1->image_info.SectorSize;
buffer2_length = ctx2->image_info.SectorSize;
read_result1 = aaruf_read_sector(ctx1, sector, false, buffer1, &buffer1_length);
read_result2 = aaruf_read_sector(ctx2, sector, false, buffer2, &buffer2_length);

View File

@@ -44,24 +44,24 @@ void draw_progress_bar(int row, int percent)
int compare(const char *path1, const char *path2)
{
int ret = AARUF_STATUS_OK;
aaruformatContext *ctx1 = NULL;
aaruformatContext *ctx2 = NULL;
bool imagesAreDifferent = false;
char *strBuffer = NULL;
UErrorCode u_error_code = U_ZERO_ERROR;
int lr = 0;
int rr = 0;
uintattr_t appVerColor = TB_WHITE;
uintattr_t imageVerColor = TB_WHITE;
uintattr_t mediaTypeColor = TB_WHITE;
uintattr_t creationTimeColor = TB_WHITE;
uintattr_t lastWrittenTimeColor = TB_WHITE;
uintattr_t partitionsColor = TB_WHITE;
uintattr_t sessionsColor = TB_WHITE;
uintattr_t sectorsColor = TB_WHITE;
uintattr_t sectorSizeColor = TB_WHITE;
uintattr_t versionColor = TB_WHITE;
int ret = AARUF_STATUS_OK;
aaruformat_context *ctx1 = NULL;
aaruformat_context *ctx2 = NULL;
bool imagesAreDifferent = false;
char *strBuffer = NULL;
UErrorCode u_error_code = U_ZERO_ERROR;
int lr = 0;
int rr = 0;
uintattr_t appVerColor = TB_WHITE;
uintattr_t imageVerColor = TB_WHITE;
uintattr_t mediaTypeColor = TB_WHITE;
uintattr_t creationTimeColor = TB_WHITE;
uintattr_t lastWrittenTimeColor = TB_WHITE;
uintattr_t partitionsColor = TB_WHITE;
uintattr_t sessionsColor = TB_WHITE;
uintattr_t sectorsColor = TB_WHITE;
uintattr_t sectorSizeColor = TB_WHITE;
uintattr_t versionColor = TB_WHITE;
// Initialize termbox2
if(tb_init() != 0) return 1;
@@ -229,8 +229,8 @@ int compare(const char *path1, const char *path2)
// Compare ImageInfo
u_error_code = U_ZERO_ERROR;
u_error_code = u_strCompare((const UChar *)ctx1->imageInfo.Application, -1,
(const UChar *)ctx2->imageInfo.Application, -1, false);
u_error_code = u_strCompare((const UChar *)ctx1->image_info.Application, -1,
(const UChar *)ctx2->image_info.Application, -1, false);
if(u_error_code != U_ZERO_ERROR) imagesAreDifferent = true;
// Current left row
@@ -238,73 +238,73 @@ int compare(const char *path1, const char *path2)
// Current right row
rr = 9;
if(ctx1->imageInfo.HasPartitions != ctx2->imageInfo.HasPartitions)
if(ctx1->image_info.HasPartitions != ctx2->image_info.HasPartitions)
{
imagesAreDifferent = true;
partitionsColor = TB_RED;
}
if(ctx1->imageInfo.HasSessions != ctx2->imageInfo.HasSessions)
if(ctx1->image_info.HasSessions != ctx2->image_info.HasSessions)
{
imagesAreDifferent = true;
sessionsColor = TB_RED;
}
if(ctx1->imageInfo.Sectors != ctx2->imageInfo.Sectors)
if(ctx1->image_info.Sectors != ctx2->image_info.Sectors)
{
imagesAreDifferent = true;
sectorsColor = TB_RED;
}
if(ctx1->imageInfo.SectorSize != ctx2->imageInfo.SectorSize)
if(ctx1->image_info.SectorSize != ctx2->image_info.SectorSize)
{
imagesAreDifferent = true;
sectorSizeColor = TB_RED;
}
if(ctx1->imageInfo.Version != ctx2->imageInfo.Version)
if(ctx1->image_info.Version != ctx2->image_info.Version)
{
imagesAreDifferent = true;
versionColor = TB_RED;
}
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Has partitions?: ");
tb_printf(19, lr++, partitionsColor, TB_BLUE, "%s", ctx1->imageInfo.HasPartitions ? "yes" : "no");
tb_printf(19, lr++, partitionsColor, TB_BLUE, "%s", ctx1->image_info.HasPartitions ? "yes" : "no");
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Has sessions?: ");
tb_printf(17, lr++, sessionsColor, TB_BLUE, "%s", ctx1->imageInfo.HasSessions ? "yes" : "no");
tb_printf(17, lr++, sessionsColor, TB_BLUE, "%s", ctx1->image_info.HasSessions ? "yes" : "no");
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Image size without headers: ");
tb_printf(30, lr++, TB_WHITE, TB_BLUE, "%llu bytes", ctx1->imageInfo.ImageSize);
tb_printf(30, lr++, TB_WHITE, TB_BLUE, "%llu bytes", ctx1->image_info.ImageSize);
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Image contains: ");
tb_printf(18, lr++, sectorsColor, TB_BLUE, "%llu sectors", ctx1->imageInfo.Sectors);
tb_printf(18, lr++, sectorsColor, TB_BLUE, "%llu sectors", ctx1->image_info.Sectors);
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Biggest sector is: ");
tb_printf(21, lr++, sectorSizeColor, TB_BLUE, "%d bytes", ctx1->imageInfo.SectorSize);
tb_printf(21, lr++, sectorSizeColor, TB_BLUE, "%d bytes", ctx1->image_info.SectorSize);
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Image version: ");
tb_printf(17, lr++, versionColor, TB_BLUE, "%s", ctx1->imageInfo.Version);
tb_printf(17, lr++, versionColor, TB_BLUE, "%s", ctx1->image_info.Version);
tb_present();
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Has partitions?: ");
tb_printf(mid_x + 19, rr++, partitionsColor, TB_BLUE, "%s", ctx2->imageInfo.HasPartitions ? "yes" : "no");
tb_printf(mid_x + 19, rr++, partitionsColor, TB_BLUE, "%s", ctx2->image_info.HasPartitions ? "yes" : "no");
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Has sessions?: ");
tb_printf(mid_x + 17, rr++, sessionsColor, TB_BLUE, "%s", ctx2->imageInfo.HasSessions ? "yes" : "no");
tb_printf(mid_x + 17, rr++, sessionsColor, TB_BLUE, "%s", ctx2->image_info.HasSessions ? "yes" : "no");
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Image size without headers: ");
tb_printf(mid_x + 30, rr++, TB_WHITE, TB_BLUE, "%llu bytes", ctx2->imageInfo.ImageSize);
tb_printf(mid_x + 30, rr++, TB_WHITE, TB_BLUE, "%llu bytes", ctx2->image_info.ImageSize);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Image contains: ");
tb_printf(mid_x + 18, rr++, sectorsColor, TB_BLUE, "%llu sectors", ctx2->imageInfo.Sectors);
tb_printf(mid_x + 18, rr++, sectorsColor, TB_BLUE, "%llu sectors", ctx2->image_info.Sectors);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Biggest sector is: ");
tb_printf(mid_x + 21, rr++, sectorSizeColor, TB_BLUE, "%d bytes", ctx2->imageInfo.SectorSize);
tb_printf(mid_x + 21, rr++, sectorSizeColor, TB_BLUE, "%d bytes", ctx2->image_info.SectorSize);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Image version: ");
tb_printf(mid_x + 17, rr++, versionColor, TB_BLUE, "%s", ctx2->imageInfo.Version);
tb_printf(mid_x + 17, rr++, versionColor, TB_BLUE, "%s", ctx2->image_info.Version);
tb_present();
if(ctx1->imageInfo.Application != NULL || ctx2->imageInfo.Application != NULL)
if(ctx1->image_info.Application != NULL || ctx2->image_info.Application != NULL)
{
strBuffer = malloc(65);
memset(strBuffer, 0, 65);
u_error_code = U_ZERO_ERROR; // Reset error code before conversion
ucnv_convert(NULL, "UTF-16LE", strBuffer, 64, (const char *)ctx1->imageInfo.Application, 64, &u_error_code);
ucnv_convert(NULL, "UTF-16LE", strBuffer, 64, (const char *)ctx1->image_info.Application, 64, &u_error_code);
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Application: ");
if(u_error_code == U_ZERO_ERROR) tb_printf(15, lr, TB_WHITE, TB_BLUE, "%s", strBuffer);
lr++;
memset(strBuffer, 0, 65);
u_error_code = U_ZERO_ERROR; // Reset error code before conversion
ucnv_convert(NULL, "UTF-16LE", strBuffer, 64, (const char *)ctx2->imageInfo.Application, 64, &u_error_code);
ucnv_convert(NULL, "UTF-16LE", strBuffer, 64, (const char *)ctx2->image_info.Application, 64, &u_error_code);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Application: ");
if(u_error_code == U_ZERO_ERROR) tb_printf(mid_x + 15, rr, TB_WHITE, TB_BLUE, "%s", strBuffer);
rr++;
@@ -313,155 +313,156 @@ int compare(const char *path1, const char *path2)
tb_present();
}
if(ctx1->imageInfo.ApplicationVersion != NULL || ctx2->imageInfo.ApplicationVersion != NULL)
if(ctx1->image_info.ApplicationVersion != NULL || ctx2->image_info.ApplicationVersion != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Application version: ");
tb_printf(23, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->imageInfo.ApplicationVersion);
tb_printf(23, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->image_info.ApplicationVersion);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Application version: ");
tb_printf(mid_x + 23, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->imageInfo.ApplicationVersion);
tb_printf(mid_x + 23, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->image_info.ApplicationVersion);
}
if(ctx1->Creator != NULL || ctx2->Creator != NULL)
if(ctx1->creator != NULL || ctx2->creator != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Creator: ");
tb_printf(11, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->Creator);
tb_printf(11, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->creator);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Creator: ");
tb_printf(mid_x + 11, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->Creator);
tb_printf(mid_x + 11, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->creator);
}
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Creation time: ");
tb_printf(17, lr++, TB_WHITE, TB_BLUE, "%lld", ctx1->imageInfo.CreationTime);
tb_printf(17, lr++, TB_WHITE, TB_BLUE, "%lld", ctx1->image_info.CreationTime);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Creation time: ");
tb_printf(mid_x + 17, rr++, TB_WHITE, TB_BLUE, "%lld", ctx2->imageInfo.CreationTime);
tb_printf(mid_x + 17, rr++, TB_WHITE, TB_BLUE, "%lld", ctx2->image_info.CreationTime);
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Last written time: ");
tb_printf(21, lr++, TB_WHITE, TB_BLUE, "%lld", ctx1->imageInfo.LastModificationTime);
tb_printf(21, lr++, TB_WHITE, TB_BLUE, "%lld", ctx1->image_info.LastModificationTime);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Last written time: ");
tb_printf(mid_x + 21, rr++, TB_WHITE, TB_BLUE, "%lld", ctx2->imageInfo.LastModificationTime);
tb_printf(mid_x + 21, rr++, TB_WHITE, TB_BLUE, "%lld", ctx2->image_info.LastModificationTime);
if(ctx1->Comments != NULL || ctx2->Comments != NULL)
if(ctx1->comments != NULL || ctx2->comments != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Comments: ");
tb_printf(12, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->Comments);
tb_printf(12, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->comments);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Comments: ");
tb_printf(mid_x + 12, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->Comments);
tb_printf(mid_x + 12, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->comments);
}
if(ctx1->MediaTitle != NULL || ctx2->MediaTitle != NULL)
if(ctx1->media_title != NULL || ctx2->media_title != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Media title: ");
tb_printf(15, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->MediaTitle);
tb_printf(15, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->media_title);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Media title: ");
tb_printf(mid_x + 15, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->MediaTitle);
tb_printf(mid_x + 15, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->media_title);
}
if(ctx1->MediaManufacturer != NULL || ctx2->MediaManufacturer != NULL)
if(ctx1->media_manufacturer != NULL || ctx2->media_manufacturer != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Media manufacturer: ");
tb_printf(22, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->MediaManufacturer);
tb_printf(22, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->media_manufacturer);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Media manufacturer: ");
tb_printf(mid_x + 22, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->MediaManufacturer);
tb_printf(mid_x + 22, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->media_manufacturer);
}
if(ctx1->MediaSerialNumber != NULL || ctx2->MediaSerialNumber != NULL)
if(ctx1->media_serial_number != NULL || ctx2->media_serial_number != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Media serial number: ");
tb_printf(23, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->MediaSerialNumber);
tb_printf(23, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->media_serial_number);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Media serial number: ");
tb_printf(mid_x + 23, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->MediaSerialNumber);
tb_printf(mid_x + 23, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->media_serial_number);
}
if(ctx1->MediaBarcode != NULL || ctx2->MediaBarcode != NULL)
if(ctx1->media_barcode != NULL || ctx2->media_barcode != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Media barcode: ");
tb_printf(17, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->MediaBarcode);
tb_printf(17, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->media_barcode);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Media barcode: ");
tb_printf(mid_x + 17, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->MediaBarcode);
tb_printf(mid_x + 17, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->media_barcode);
}
if(ctx1->MediaPartNumber != NULL || ctx2->MediaPartNumber != NULL)
if(ctx1->media_part_number != NULL || ctx2->media_part_number != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Media part number: ");
tb_printf(21, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->MediaPartNumber);
tb_printf(21, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->media_part_number);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Media part number: ");
tb_printf(mid_x + 21, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->MediaPartNumber);
tb_printf(mid_x + 21, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->media_part_number);
}
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Media type: ");
tb_printf(14, lr++, TB_WHITE, TB_BLUE, "%u", ctx1->imageInfo.MediaType);
tb_printf(14, lr++, TB_WHITE, TB_BLUE, "%u", ctx1->image_info.MediaType);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Media type: ");
tb_printf(mid_x + 14, rr++, TB_WHITE, TB_BLUE, "%u", ctx2->imageInfo.MediaType);
tb_printf(mid_x + 14, rr++, TB_WHITE, TB_BLUE, "%u", ctx2->image_info.MediaType);
if(ctx1->MediaSequence > 0 || ctx1->LastMediaSequence > 0 || ctx2->MediaSequence > 0 || ctx2->LastMediaSequence > 0)
if(ctx1->media_sequence > 0 || ctx1->last_media_sequence > 0 || ctx2->media_sequence > 0 ||
ctx2->last_media_sequence > 0)
{
tb_printf(2, lr++, TB_WHITE | TB_BOLD, TB_BLUE, "Media is number %d in a set of %d media", ctx1->MediaSequence,
ctx1->LastMediaSequence);
tb_printf(2, lr++, TB_WHITE | TB_BOLD, TB_BLUE, "Media is number %d in a set of %d media", ctx1->media_sequence,
ctx1->last_media_sequence);
tb_printf(mid_x + 2, rr++, TB_WHITE | TB_BOLD, TB_BLUE, "Media is number %d in a set of %d media",
ctx2->MediaSequence, ctx2->LastMediaSequence);
ctx2->media_sequence, ctx2->last_media_sequence);
}
if(ctx1->DriveManufacturer != NULL || ctx2->DriveManufacturer != NULL)
if(ctx1->drive_manufacturer != NULL || ctx2->drive_manufacturer != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Drive manufacturer: ");
tb_printf(22, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->DriveManufacturer);
tb_printf(22, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->drive_manufacturer);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Drive manufacturer: ");
tb_printf(mid_x + 22, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->DriveManufacturer);
tb_printf(mid_x + 22, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->drive_manufacturer);
}
if(ctx1->DriveModel != NULL || ctx2->DriveModel != NULL)
if(ctx1->drive_model != NULL || ctx2->drive_model != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Drive model: ");
tb_printf(15, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->DriveModel);
tb_printf(15, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->drive_model);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Drive model: ");
tb_printf(mid_x + 15, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->DriveModel);
tb_printf(mid_x + 15, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->drive_model);
}
if(ctx1->DriveSerialNumber != NULL || ctx2->DriveSerialNumber != NULL)
if(ctx1->drive_serial_number != NULL || ctx2->drive_serial_number != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Drive serial number: ");
tb_printf(23, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->DriveSerialNumber);
tb_printf(23, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->drive_serial_number);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Drive serial number: ");
tb_printf(mid_x + 23, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->DriveSerialNumber);
tb_printf(mid_x + 23, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->drive_serial_number);
}
if(ctx1->DriveFirmwareRevision != NULL || ctx2->DriveFirmwareRevision != NULL)
if(ctx1->drive_firmware_revision != NULL || ctx2->drive_firmware_revision != NULL)
{
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "Drive firmware revision: ");
tb_printf(27, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->DriveFirmwareRevision);
tb_printf(27, lr++, TB_WHITE, TB_BLUE, "%s", ctx1->drive_firmware_revision);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "Drive firmware revision: ");
tb_printf(mid_x + 27, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->DriveFirmwareRevision);
tb_printf(mid_x + 27, rr++, TB_WHITE, TB_BLUE, "%s", ctx2->drive_firmware_revision);
}
tb_printf(2, lr, TB_WHITE | TB_BOLD, TB_BLUE, "XML media type: ");
tb_printf(18, lr++, TB_WHITE, TB_BLUE, "%d", ctx1->imageInfo.MetadataMediaType);
tb_printf(18, lr++, TB_WHITE, TB_BLUE, "%d", ctx1->image_info.MetadataMediaType);
tb_printf(mid_x + 2, rr, TB_WHITE | TB_BOLD, TB_BLUE, "XML media type: ");
tb_printf(mid_x + 18, rr++, TB_WHITE, TB_BLUE, "%d", ctx2->imageInfo.MetadataMediaType);
tb_printf(mid_x + 18, rr++, TB_WHITE, TB_BLUE, "%d", ctx2->image_info.MetadataMediaType);
if(ctx1->Cylinders > 0 || ctx1->Heads > 0 || ctx1->SectorsPerTrack > 0 || ctx2->Cylinders > 0 || ctx2->Heads > 0 ||
ctx2->SectorsPerTrack > 0)
if(ctx1->cylinders > 0 || ctx1->heads > 0 || ctx1->sectors_per_track > 0 || ctx2->cylinders > 0 ||
ctx2->heads > 0 || ctx2->sectors_per_track > 0)
{
tb_printf(2, lr++, TB_WHITE | TB_BOLD, TB_BLUE, "Media has %d cylinders, %d heads and %d sectors per track",
ctx1->Cylinders, ctx1->Heads, ctx1->SectorsPerTrack);
ctx1->cylinders, ctx1->heads, ctx1->sectors_per_track);
tb_printf(mid_x + 2, rr++, TB_WHITE | TB_BOLD, TB_BLUE,
"Media has %d cylinders, %d heads and %d sectors per track", ctx2->Cylinders, ctx2->Heads,
ctx2->SectorsPerTrack);
"Media has %d cylinders, %d heads and %d sectors per track", ctx2->cylinders, ctx2->heads,
ctx2->sectors_per_track);
}
tb_present();
lr++;
uint64_t sectors = ctx1->imageInfo.Sectors;
if(ctx2->imageInfo.Sectors < sectors) sectors = ctx2->imageInfo.Sectors;
uint64_t sectors = ctx1->image_info.Sectors;
if(ctx2->image_info.Sectors < sectors) sectors = ctx2->image_info.Sectors;
bool imageContentsAreDifferent = false;
uint32_t sectorSize = ctx1->imageInfo.SectorSize;
if(ctx2->imageInfo.SectorSize > sectorSize) sectorSize = ctx2->imageInfo.SectorSize;
uint32_t sectorSize = ctx1->image_info.SectorSize;
if(ctx2->image_info.SectorSize > sectorSize) sectorSize = ctx2->image_info.SectorSize;
uint8_t *buffer1 = malloc(sectorSize);
if(buffer1 == NULL)

View File

@@ -30,12 +30,12 @@
int convert(const char *input_path, const char *output_path)
{
aaruformatContext *input_ctx = NULL;
aaruformatContext *output_ctx = NULL;
int32_t res = 0;
uint32_t sector_size = 0;
uint64_t total_sectors = 0;
uint8_t *sector_data = NULL;
aaruformat_context *input_ctx = NULL;
aaruformat_context *output_ctx = NULL;
int32_t res = 0;
uint32_t sector_size = 0;
uint64_t total_sectors = 0;
uint8_t *sector_data = NULL;
printf("Converting image from %s to %s...\n", input_path, output_path);
@@ -48,8 +48,8 @@ int convert(const char *input_path, const char *output_path)
}
// Get image information from input
total_sectors = input_ctx->imageInfo.Sectors;
sector_size = input_ctx->imageInfo.SectorSize;
total_sectors = input_ctx->image_info.Sectors;
sector_size = input_ctx->image_info.SectorSize;
printf("Input image has %llu sectors of %u bytes each.\n", total_sectors, sector_size);
@@ -93,7 +93,7 @@ int convert(const char *input_path, const char *output_path)
free(app_name_utf16);
// Create output image
output_ctx = aaruf_create(output_path, input_ctx->imageInfo.MediaType, sector_size, total_sectors,
output_ctx = aaruf_create(output_path, input_ctx->image_info.MediaType, sector_size, total_sectors,
0, // negative sectors
0, // overflow sectors
NULL, // options

View File

@@ -69,7 +69,7 @@ static const char *format_filetime(uint64_t filetime)
int info(const char *path)
{
aaruformatContext *ctx = NULL;
aaruformat_context *ctx = NULL;
char *strBuffer = NULL;
UErrorCode u_error_code = U_ZERO_ERROR;
uint i = 0;
@@ -86,7 +86,7 @@ int info(const char *path)
printf("AaruFormat context information:\n");
printf("Magic number: %8.8s\n", (char *)&ctx->magic);
printf("Library version: %d.%d\n", ctx->libraryMajorVersion, ctx->libraryMinorVersion);
printf("Library version: %d.%d\n", ctx->library_major_version, ctx->library_minor_version);
printf("AaruFormat header:\n");
printf("\tIdentifier: %8.8s\n", (char *)&ctx->header.identifier);
@@ -107,11 +107,11 @@ int info(const char *path)
if(ctx->sector_prefix != NULL) printf("Sector prefix array has been read.\n");
if(ctx->sectorPrefixCorrected != NULL) printf("Sector prefix corrected array has been read.\n");
if(ctx->sector_prefix_corrected != NULL) printf("Sector prefix corrected array has been read.\n");
if(ctx->sector_suffix != NULL) printf("Sector suffix array has been read.\n");
if(ctx->sectorSuffixCorrected != NULL) printf("Sector suffix corrected array has been read.\n");
if(ctx->sector_suffix_corrected != NULL) printf("Sector suffix corrected array has been read.\n");
if(ctx->sector_subchannel != NULL) printf("Sector subchannel array has been read.\n");
@@ -119,15 +119,15 @@ int info(const char *path)
printf("Shift is %d (%d bytes).\n", ctx->shift, 1 << ctx->shift);
if(ctx->inMemoryDdt) printf("User-data DDT resides in memory.\n");
if(ctx->in_memory_ddt) printf("User-data DDT resides in memory.\n");
if(ctx->userDataDdt != NULL) printf("User-data DDT has been read to memory.\n");
if(ctx->user_data_ddt != NULL) printf("User-data DDT has been read to memory.\n");
if(ctx->mappedMemoryDdtSize > 0) printf("Mapped memory DDT has %zu bytes", ctx->mappedMemoryDdtSize);
if(ctx->mapped_memory_ddt_size > 0) printf("Mapped memory DDT has %zu bytes", ctx->mapped_memory_ddt_size);
if(ctx->sectorPrefixDdt != NULL) printf("Sector prefix DDT has been read to memory.\n");
if(ctx->sector_prefix_ddt != NULL) printf("Sector prefix DDT has been read to memory.\n");
if(ctx->sectorPrefixDdt != NULL) printf("Sector suffix DDT has been read to memory.\n");
if(ctx->sector_prefix_ddt != NULL) printf("Sector suffix DDT has been read to memory.\n");
uint32_t cylinders = 0;
uint32_t heads = 0;
@@ -421,181 +421,183 @@ int info(const char *path)
}
// TODO: Table format?
if(ctx->tracksHeader.identifier == TracksBlock)
if(ctx->tracks_header.identifier == TracksBlock)
{
printf("Tracks block:\n");
for(i = 0; i < ctx->tracksHeader.entries; i++)
for(i = 0; i < ctx->tracks_header.entries; i++)
{
printf("\tTrack entry %d:\n", i);
printf("\t\tSequence: %d\n", ctx->trackEntries[i].sequence);
printf("\t\tType: %d\n", ctx->trackEntries[i].type);
printf("\t\tStart: %lld\n", ctx->trackEntries[i].start);
printf("\t\tEnd: %lld\n", ctx->trackEntries[i].end);
printf("\t\tPregap: %lld\n", ctx->trackEntries[i].pregap);
printf("\t\tSession: %d\n", ctx->trackEntries[i].session);
printf("\t\tISRC: %.13s\n", ctx->trackEntries[i].isrc);
printf("\t\tFlags: %d\n", ctx->trackEntries[i].flags);
printf("\t\tSequence: %d\n", ctx->track_entries[i].sequence);
printf("\t\tType: %d\n", ctx->track_entries[i].type);
printf("\t\tStart: %lld\n", ctx->track_entries[i].start);
printf("\t\tEnd: %lld\n", ctx->track_entries[i].end);
printf("\t\tPregap: %lld\n", ctx->track_entries[i].pregap);
printf("\t\tSession: %d\n", ctx->track_entries[i].session);
printf("\t\tISRC: %.13s\n", ctx->track_entries[i].isrc);
printf("\t\tFlags: %d\n", ctx->track_entries[i].flags);
}
}
if(ctx->cicmBlockHeader.identifier == CicmBlock)
if(ctx->cicm_block_header.identifier == CicmBlock)
{
printf("CICM block:\n");
printf("%s", ctx->cicmBlock);
printf("%s", ctx->cicm_block);
}
// TODO: Table format?
if(ctx->dumpHardwareHeader.identifier == DumpHardwareBlock)
if(ctx->dump_hardware_header.identifier == DumpHardwareBlock)
{
printf("Dump hardware block:\n");
for(i = 0; i < ctx->dumpHardwareHeader.entries; i++)
for(i = 0; i < ctx->dump_hardware_header.entries; i++)
{
printf("\tDump hardware entry %d\n", i);
if(ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength > 0)
if(ctx->dump_hardware_entries_with_data[i].entry.manufacturerLength > 0)
{
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength + 1);
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength + 1);
strBuffer = malloc(ctx->dump_hardware_entries_with_data[i].entry.manufacturerLength + 1);
memset(strBuffer, 0, ctx->dump_hardware_entries_with_data[i].entry.manufacturerLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer,
(int)ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength,
(char *)ctx->dumpHardwareEntriesWithData[i].manufacturer,
(int)ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength, &u_error_code);
(int)ctx->dump_hardware_entries_with_data[i].entry.manufacturerLength,
(char *)ctx->dump_hardware_entries_with_data[i].manufacturer,
(int)ctx->dump_hardware_entries_with_data[i].entry.manufacturerLength, &u_error_code);
printf("\t\tManufacturer: %s\n", strBuffer);
free(strBuffer);
}
if(ctx->dumpHardwareEntriesWithData[i].entry.modelLength > 0)
if(ctx->dump_hardware_entries_with_data[i].entry.modelLength > 0)
{
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.modelLength + 1);
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.modelLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.modelLength,
(char *)ctx->dumpHardwareEntriesWithData[i].model,
(int)ctx->dumpHardwareEntriesWithData[i].entry.modelLength, &u_error_code);
strBuffer = malloc(ctx->dump_hardware_entries_with_data[i].entry.modelLength + 1);
memset(strBuffer, 0, ctx->dump_hardware_entries_with_data[i].entry.modelLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dump_hardware_entries_with_data[i].entry.modelLength,
(char *)ctx->dump_hardware_entries_with_data[i].model,
(int)ctx->dump_hardware_entries_with_data[i].entry.modelLength, &u_error_code);
printf("\t\tModel: %s\n", strBuffer);
free(strBuffer);
}
if(ctx->dumpHardwareEntriesWithData[i].entry.revisionLength > 0)
if(ctx->dump_hardware_entries_with_data[i].entry.revisionLength > 0)
{
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.revisionLength + 1);
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.revisionLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.revisionLength,
(char *)ctx->dumpHardwareEntriesWithData[i].revision,
(int)ctx->dumpHardwareEntriesWithData[i].entry.revisionLength, &u_error_code);
strBuffer = malloc(ctx->dump_hardware_entries_with_data[i].entry.revisionLength + 1);
memset(strBuffer, 0, ctx->dump_hardware_entries_with_data[i].entry.revisionLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer,
(int)ctx->dump_hardware_entries_with_data[i].entry.revisionLength,
(char *)ctx->dump_hardware_entries_with_data[i].revision,
(int)ctx->dump_hardware_entries_with_data[i].entry.revisionLength, &u_error_code);
printf("\t\tRevision: %s\n", strBuffer);
free(strBuffer);
}
if(ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength > 0)
if(ctx->dump_hardware_entries_with_data[i].entry.firmwareLength > 0)
{
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength + 1);
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength,
(char *)ctx->dumpHardwareEntriesWithData[i].firmware,
(int)ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength, &u_error_code);
strBuffer = malloc(ctx->dump_hardware_entries_with_data[i].entry.firmwareLength + 1);
memset(strBuffer, 0, ctx->dump_hardware_entries_with_data[i].entry.firmwareLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer,
(int)ctx->dump_hardware_entries_with_data[i].entry.firmwareLength,
(char *)ctx->dump_hardware_entries_with_data[i].firmware,
(int)ctx->dump_hardware_entries_with_data[i].entry.firmwareLength, &u_error_code);
printf("\t\tFirmware version: %s\n", strBuffer);
free(strBuffer);
}
if(ctx->dumpHardwareEntriesWithData[i].entry.serialLength > 0)
if(ctx->dump_hardware_entries_with_data[i].entry.serialLength > 0)
{
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.serialLength + 1);
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.serialLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.serialLength,
(char *)ctx->dumpHardwareEntriesWithData[i].serial,
(int)ctx->dumpHardwareEntriesWithData[i].entry.serialLength, &u_error_code);
strBuffer = malloc(ctx->dump_hardware_entries_with_data[i].entry.serialLength + 1);
memset(strBuffer, 0, ctx->dump_hardware_entries_with_data[i].entry.serialLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dump_hardware_entries_with_data[i].entry.serialLength,
(char *)ctx->dump_hardware_entries_with_data[i].serial,
(int)ctx->dump_hardware_entries_with_data[i].entry.serialLength, &u_error_code);
printf("\t\tSerial number: %s\n", strBuffer);
free(strBuffer);
}
if(ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength > 0)
if(ctx->dump_hardware_entries_with_data[i].entry.softwareNameLength > 0)
{
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength + 1);
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength + 1);
strBuffer = malloc(ctx->dump_hardware_entries_with_data[i].entry.softwareNameLength + 1);
memset(strBuffer, 0, ctx->dump_hardware_entries_with_data[i].entry.softwareNameLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer,
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength,
(char *)ctx->dumpHardwareEntriesWithData[i].softwareName,
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength, &u_error_code);
(int)ctx->dump_hardware_entries_with_data[i].entry.softwareNameLength,
(char *)ctx->dump_hardware_entries_with_data[i].softwareName,
(int)ctx->dump_hardware_entries_with_data[i].entry.softwareNameLength, &u_error_code);
printf("\t\tSoftware name: %s\n", strBuffer);
free(strBuffer);
}
if(ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength > 0)
if(ctx->dump_hardware_entries_with_data[i].entry.softwareVersionLength > 0)
{
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength + 1);
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength + 1);
strBuffer = malloc(ctx->dump_hardware_entries_with_data[i].entry.softwareVersionLength + 1);
memset(strBuffer, 0, ctx->dump_hardware_entries_with_data[i].entry.softwareVersionLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer,
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength,
(char *)ctx->dumpHardwareEntriesWithData[i].softwareVersion,
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength, &u_error_code);
(int)ctx->dump_hardware_entries_with_data[i].entry.softwareVersionLength,
(char *)ctx->dump_hardware_entries_with_data[i].softwareVersion,
(int)ctx->dump_hardware_entries_with_data[i].entry.softwareVersionLength, &u_error_code);
printf("\t\tSoftware version: %s\n", strBuffer);
free(strBuffer);
}
if(ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength > 0)
if(ctx->dump_hardware_entries_with_data[i].entry.softwareOperatingSystemLength > 0)
{
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength + 1);
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength + 1);
strBuffer = malloc(ctx->dump_hardware_entries_with_data[i].entry.softwareOperatingSystemLength + 1);
memset(strBuffer, 0, ctx->dump_hardware_entries_with_data[i].entry.softwareOperatingSystemLength + 1);
ucnv_convert(NULL, "UTF-8", strBuffer,
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength,
(char *)ctx->dumpHardwareEntriesWithData[i].softwareOperatingSystem,
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength,
(int)ctx->dump_hardware_entries_with_data[i].entry.softwareOperatingSystemLength,
(char *)ctx->dump_hardware_entries_with_data[i].softwareOperatingSystem,
(int)ctx->dump_hardware_entries_with_data[i].entry.softwareOperatingSystemLength,
&u_error_code);
printf("\t\tSoftware operating system: %s\n", strBuffer);
free(strBuffer);
}
for(uint j = 0; j < ctx->dumpHardwareEntriesWithData[i].entry.extents; j++)
for(uint j = 0; j < ctx->dump_hardware_entries_with_data[i].entry.extents; j++)
{
printf("\t\tExtent %d:\n", j);
printf("\t\t\tStart: %llu\n", ctx->dumpHardwareEntriesWithData[i].extents[j].start);
printf("\t\t\tEnd: %llu\n", ctx->dumpHardwareEntriesWithData[i].extents[j].end);
printf("\t\t\tStart: %llu\n", ctx->dump_hardware_entries_with_data[i].extents[j].start);
printf("\t\t\tEnd: %llu\n", ctx->dump_hardware_entries_with_data[i].extents[j].end);
}
}
}
if(ctx->eccCdContext != NULL) printf("CD ECC has been initialized.\n");
if(ctx->ecc_cd_context != NULL) printf("CD ECC has been initialized.\n");
printf("There are %d data tracks.\n", ctx->numberOfDataTracks);
printf("There are %d data tracks.\n", ctx->number_of_data_tracks);
// TODO: ctx->readableSectorTags;
if(ctx->blockHeaderCache.max_items > 0)
if(ctx->block_header_cache.max_items > 0)
{
if(ctx->blockHeaderCache.cache != NULL) printf("Block header cache has been initialized.\n");
printf("Block header cache can contain a maximum of %llu items.\n", ctx->blockHeaderCache.max_items);
if(ctx->block_header_cache.cache != NULL) printf("Block header cache has been initialized.\n");
printf("Block header cache can contain a maximum of %llu items.\n", ctx->block_header_cache.max_items);
}
if(ctx->blockCache.max_items > 0)
if(ctx->block_cache.max_items > 0)
{
if(ctx->blockCache.cache != NULL) printf("Block cache has been initialized.\n");
printf("Block cache can contain a maximum of %llu items.\n", ctx->blockCache.max_items);
if(ctx->block_cache.cache != NULL) printf("Block cache has been initialized.\n");
printf("Block cache can contain a maximum of %llu items.\n", ctx->block_cache.max_items);
}
printf("Aaru's ImageInfo:\n");
printf("\tHas partitions?: %s\n", ctx->imageInfo.HasPartitions ? "yes" : "no");
printf("\tHas sessions?: %s\n", ctx->imageInfo.HasSessions ? "yes" : "no");
printf("\tImage size without headers: %llu bytes\n", ctx->imageInfo.ImageSize);
printf("\tImage contains %llu sectors\n", ctx->imageInfo.Sectors);
printf("\tBiggest sector is %d bytes\n", ctx->imageInfo.SectorSize);
printf("\tImage version: %s\n", ctx->imageInfo.Version);
printf("\tHas partitions?: %s\n", ctx->image_info.HasPartitions ? "yes" : "no");
printf("\tHas sessions?: %s\n", ctx->image_info.HasSessions ? "yes" : "no");
printf("\tImage size without headers: %llu bytes\n", ctx->image_info.ImageSize);
printf("\tImage contains %llu sectors\n", ctx->image_info.Sectors);
printf("\tBiggest sector is %d bytes\n", ctx->image_info.SectorSize);
printf("\tImage version: %s\n", ctx->image_info.Version);
if(ctx->imageInfo.Application != NULL)
if(ctx->image_info.Application != NULL)
{
strBuffer = malloc(65);
memset(strBuffer, 0, 65);
ucnv_convert(NULL, "UTF-16LE", strBuffer, 64, (const char *)ctx->imageInfo.Application, 64, &u_error_code);
ucnv_convert(NULL, "UTF-16LE", strBuffer, 64, (const char *)ctx->image_info.Application, 64, &u_error_code);
if(u_error_code == U_ZERO_ERROR) printf("\tApplication: %s\n", strBuffer);
free(strBuffer);
}
if(ctx->imageInfo.ApplicationVersion != NULL)
printf("\tApplication version: %s\n", ctx->imageInfo.ApplicationVersion);
printf("\tCreation time: %s\n", format_filetime(ctx->imageInfo.CreationTime));
printf("\tLast written time: %s\n", format_filetime(ctx->imageInfo.LastModificationTime));
printf("\tMedia type: %u (%s)\n", ctx->imageInfo.MediaType, media_type_to_string(ctx->imageInfo.MediaType));
printf("\tXML media type: %d\n", ctx->imageInfo.MetadataMediaType);
if(ctx->image_info.ApplicationVersion != NULL)
printf("\tApplication version: %s\n", ctx->image_info.ApplicationVersion);
printf("\tCreation time: %s\n", format_filetime(ctx->image_info.CreationTime));
printf("\tLast written time: %s\n", format_filetime(ctx->image_info.LastModificationTime));
printf("\tMedia type: %u (%s)\n", ctx->image_info.MediaType, media_type_to_string(ctx->image_info.MediaType));
printf("\tXML media type: %d\n", ctx->image_info.MetadataMediaType);
if(ctx->checksums.hasMd5)
{

View File

@@ -26,10 +26,10 @@
int read(const unsigned long long sector_no, const char *path)
{
aaruformatContext *ctx = NULL;
int32_t res = 0;
uint32_t length = 0;
uint8_t *data = NULL;
aaruformat_context *ctx = NULL;
int32_t res = 0;
uint32_t length = 0;
uint8_t *data = NULL;
ctx = aaruf_open(path);
@@ -78,10 +78,10 @@ int read(const unsigned long long sector_no, const char *path)
int read_long(const unsigned long long sector_no, const char *path)
{
aaruformatContext *ctx = NULL;
int32_t res = 0;
uint32_t length = 0;
uint8_t *data = NULL;
aaruformat_context *ctx = NULL;
int32_t res = 0;
uint32_t length = 0;
uint8_t *data = NULL;
ctx = aaruf_open(path);

View File

@@ -25,8 +25,8 @@
int verify(const char *path)
{
aaruformatContext *ctx = NULL;
uint32_t res = 0;
aaruformat_context *ctx = NULL;
uint32_t res = 0;
ctx = aaruf_open(path);
@@ -50,13 +50,13 @@ int verify(const char *path)
int verify_sectors(const char *path)
{
aaruformatContext *ctx = NULL;
uint8_t *buffer = NULL;
uint32_t buffer_len = 2352;
int32_t res = 0;
CdEccContext *cd_ecc_context = NULL;
ctx = aaruf_open(path);
bool verify_result = false;
aaruformat_context *ctx = NULL;
uint8_t *buffer = NULL;
uint32_t buffer_len = 2352;
int32_t res = 0;
CdEccContext *cd_ecc_context = NULL;
ctx = aaruf_open(path);
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;
@@ -69,7 +69,7 @@ int verify_sectors(const char *path)
return errno;
}
if(ctx->imageInfo.MetadataMediaType != OpticalDisc)
if(ctx->image_info.MetadataMediaType != OpticalDisc)
{
printf("Image sectors do not contain checksums, cannot verify.\n");
return 0;
@@ -80,7 +80,7 @@ int verify_sectors(const char *path)
unknowns = 0;
any_error = false;
for(uint64_t s = 0; s < ctx->imageInfo.Sectors; s++)
for(uint64_t s = 0; s < ctx->image_info.Sectors; s++)
{
printf("\rVerifying sector %llu...", s);
res = aaruf_read_sector_long(ctx, s, buffer, false, &buffer_len);
@@ -118,7 +118,7 @@ int verify_sectors(const char *path)
else
printf("\rAll sector checksums are correct.\n");
printf("Total sectors........... %llu\n", ctx->imageInfo.Sectors);
printf("Total sectors........... %llu\n", ctx->image_info.Sectors);
printf("Total errors............ %llu\n", errors);
printf("Total unknowns.......... %llu\n", unknowns);
printf("Total errors+unknowns... %llu\n", errors + unknowns);