Implement support for reading file format header version 2.

This commit is contained in:
2025-08-02 20:23:32 +01:00
parent 9a5a994702
commit b504c8392d
10 changed files with 71 additions and 46 deletions

View File

@@ -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);