Add write functionality for sectors and implement block closing logic

This commit is contained in:
2025-08-13 16:17:45 +01:00
parent c15c7fb577
commit 64c58c0300
10 changed files with 188 additions and 28 deletions

View File

@@ -26,10 +26,12 @@
#include <aaruformat.h>
#include "internal.h"
int aaruf_close(void *context)
{
int i = 0;
mediaTagEntry *mediaTag = NULL;
int i = 0;
mediaTagEntry *mediaTag = NULL;
mediaTagEntry *tmpMediaTag = NULL;
if(context == NULL)
@@ -55,9 +57,17 @@ int aaruf_close(void *context)
{
fclose(ctx->imageStream);
ctx->imageStream = NULL;
errno = AARUF_ERROR_CANNOT_WRITE_HEADER;
errno = AARUF_ERROR_CANNOT_WRITE_HEADER;
return -1;
}
// Close current block first
if(ctx->writingBuffer != NULL)
{
int error = aaruf_close_current_block(ctx);
if(error != AARUF_STATUS_OK) return error;
}
}
// This may do nothing if imageStream is NULL, but as the behaviour is undefined, better sure than sorry