mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 11:14:39 +00:00
Fixed metadata block not being printed correctly in aaruformattool.
This commit is contained in:
53
tool/info.c
53
tool/info.c
@@ -48,7 +48,10 @@ static const char *format_filetime(uint64_t filetime)
|
||||
snprintf(buf, sizeof(buf), "%04d-%02d-%02d %02d:%02d:%02d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute,
|
||||
st.wSecond);
|
||||
}
|
||||
else { snprintf(buf, sizeof(buf), "%llu", filetime); }
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%llu", filetime);
|
||||
}
|
||||
return buf;
|
||||
#else
|
||||
time_t t;
|
||||
@@ -132,11 +135,11 @@ int info(const char *path)
|
||||
int32_t sequence = 0;
|
||||
int32_t lastSequence = 0;
|
||||
|
||||
printf("Metadata block:\n");
|
||||
if(aaruf_get_media_sequence(ctx, &sequence, &lastSequence) == AARUF_STATUS_OK && sequence > 0)
|
||||
{
|
||||
printf("Metadata block:\n");
|
||||
printf("\tMedia is no. %d in a set of %d media\n", sequence, lastSequence);
|
||||
|
||||
}
|
||||
int32_t length = 0;
|
||||
if(aaruf_get_creator(ctx, NULL, &length) == AARUF_ERROR_BUFFER_TOO_SMALL && length > 0)
|
||||
{
|
||||
@@ -150,8 +153,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -173,8 +175,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tComments: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -196,8 +197,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tMedia title: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -219,8 +219,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tMedia manufacturer: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -242,8 +241,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tMedia model: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -265,8 +263,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tMedia serial number: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -288,8 +285,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tMedia barcode: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -311,8 +307,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tMedia part number: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -334,8 +329,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tDrive manufacturer: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -357,8 +351,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tDrive model: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -380,8 +373,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tDrive serial number: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -403,8 +395,7 @@ int info(const char *path)
|
||||
{
|
||||
memset(strBuffer, 0, length + 1);
|
||||
u_error_code = U_ZERO_ERROR;
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length,
|
||||
&u_error_code);
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, length, (const char *)utf16Buffer, length, &u_error_code);
|
||||
if(u_error_code == U_ZERO_ERROR) printf("\tDrive firmware revision: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -412,7 +403,6 @@ int info(const char *path)
|
||||
free(utf16Buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Table format?
|
||||
if(ctx->tracks_header.identifier == TracksBlock)
|
||||
@@ -576,8 +566,7 @@ int info(const char *path)
|
||||
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->image_info.Application != NULL)
|
||||
printf("\tApplication: %s\n", ctx->image_info.Application);
|
||||
if(ctx->image_info.Application != NULL) printf("\tApplication: %s\n", ctx->image_info.Application);
|
||||
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));
|
||||
@@ -612,9 +601,7 @@ int info(const char *path)
|
||||
{
|
||||
printf("Media tags:\n");
|
||||
HASH_ITER(hh, ctx->mediaTags, mediaTag, tmpMediaTag)
|
||||
{
|
||||
printf("\tType %d is %d bytes long.\n", mediaTag->type, mediaTag->length);
|
||||
}
|
||||
{ printf("\tType %d is %d bytes long.\n", mediaTag->type, mediaTag->length); }
|
||||
}
|
||||
|
||||
aaruf_close(ctx);
|
||||
|
||||
Reference in New Issue
Block a user