mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Implement support for reading file format header version 2.
This commit is contained in:
15
src/open.c
15
src/open.c
@@ -76,6 +76,21 @@ void *aaruf_open(const char *filepath)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Read new header version
|
||||
if(ctx->header.imageMajorVersion >= AARUF_VERSION_V2)
|
||||
{
|
||||
fseek(ctx->imageStream, 0, SEEK_SET);
|
||||
readBytes = fread(&ctx->header, 1, sizeof(AaruHeaderV2), ctx->imageStream);
|
||||
|
||||
if(readBytes != sizeof(AaruHeaderV2))
|
||||
{
|
||||
free(ctx);
|
||||
errno = AARUF_ERROR_FILE_TOO_SMALL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if(ctx->header.imageMajorVersion > AARUF_VERSION)
|
||||
{
|
||||
free(ctx);
|
||||
|
||||
Reference in New Issue
Block a user