mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Compare commits
5 Commits
v1.0.0-alp
...
v1.0.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
e28b1209c8
|
|||
|
0e51337e30
|
|||
|
56bb631872
|
|||
|
58788beed1
|
|||
|
176cab648b
|
@@ -2,7 +2,7 @@
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>libaaruformat</id>
|
||||
<version>1.0.0-alpha.11</version>
|
||||
<version>1.0.0-alpha.13</version>
|
||||
<description>Library for management of AaruFormat images.</description>
|
||||
<authors>claunia</authors>
|
||||
<projectUrl>https://github.com/aaru-dps/libaaruformat</projectUrl>
|
||||
|
||||
@@ -217,26 +217,26 @@ int32_t process_ddt_v1(aaruformat_context *ctx, IndexEntry *entry, bool *found_u
|
||||
break;
|
||||
// TODO: Check CRC
|
||||
case None:
|
||||
#ifdef __linux__
|
||||
TRACE("Memory mapping deduplication table at position %" PRIu64, entry->offset + sizeof(ddt_header));
|
||||
ctx->mapped_memory_ddt_size = sizeof(uint64_t) * ddt_header.entries;
|
||||
ctx->user_data_ddt = mmap(NULL, ctx->mapped_memory_ddt_size, PROT_READ, MAP_SHARED,
|
||||
fileno(ctx->imageStream), entry->offset + sizeof(ddt_header));
|
||||
|
||||
if(ctx->user_data_ddt == MAP_FAILED)
|
||||
ctx->user_data_ddt = (uint64_t *)malloc(ddt_header.length);
|
||||
if(ctx->user_data_ddt == NULL)
|
||||
{
|
||||
*found_user_data_ddt = false;
|
||||
FATAL("Could not read map deduplication table.");
|
||||
TRACE("Cannot allocate memory for DDT, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
ctx->in_memory_ddt = false;
|
||||
read_bytes = fread(ctx->user_data_ddt, 1, ddt_header.entries * sizeof(uint64_t), ctx->imageStream);
|
||||
|
||||
if(read_bytes != ddt_header.entries * sizeof(uint64_t))
|
||||
{
|
||||
free(ctx->user_data_ddt);
|
||||
TRACE("Could not read deduplication table, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
ctx->in_memory_ddt = true;
|
||||
*found_user_data_ddt = true;
|
||||
|
||||
break;
|
||||
#else // TODO: Implement
|
||||
TRACE("Uncompressed DDT not yet implemented...");
|
||||
*found_user_data_ddt = false;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
TRACE("Found unknown compression type %d, continuing...", ddt_header.compression);
|
||||
*found_user_data_ddt = false;
|
||||
|
||||
@@ -297,7 +297,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_read_sector(void *context, const uint64_t se
|
||||
return AARUF_ERROR_NOT_AARUFORMAT;
|
||||
}
|
||||
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative - 1)
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative)
|
||||
{
|
||||
FATAL("Sector address out of bounds");
|
||||
|
||||
@@ -868,7 +868,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_read_sector_long(void *context, const uint64
|
||||
return AARUF_ERROR_NOT_AARUFORMAT;
|
||||
}
|
||||
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative - 1)
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative)
|
||||
{
|
||||
FATAL("Sector address out of bounds");
|
||||
|
||||
@@ -1509,7 +1509,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_read_sector_tag(const void *context, const u
|
||||
return AARUF_ERROR_NOT_AARUFORMAT;
|
||||
}
|
||||
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative - 1)
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative)
|
||||
{
|
||||
FATAL("Sector address out of bounds");
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector(void *context, uint64_t sector_
|
||||
return AARUF_READ_ONLY;
|
||||
}
|
||||
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative - 1)
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative)
|
||||
{
|
||||
FATAL("Sector address out of bounds");
|
||||
|
||||
@@ -569,7 +569,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
|
||||
return AARUF_READ_ONLY;
|
||||
}
|
||||
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative - 1)
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative)
|
||||
{
|
||||
FATAL("Sector address out of bounds");
|
||||
|
||||
@@ -2101,7 +2101,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_tag(void *context, const uint64
|
||||
return AARUF_READ_ONLY;
|
||||
}
|
||||
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative - 1)
|
||||
if(negative && sector_address > ctx->user_data_ddt_header.negative)
|
||||
{
|
||||
FATAL("Sector address out of bounds");
|
||||
|
||||
|
||||
10
tool/info.c
10
tool/info.c
@@ -576,16 +576,8 @@ 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)
|
||||
{
|
||||
strBuffer = malloc(65);
|
||||
memset(strBuffer, 0, 65);
|
||||
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);
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
Reference in New Issue
Block a user