Disable mmap when not compiling in Linux.

This commit is contained in:
2022-06-21 21:08:19 +01:00
parent 9abfa4f68d
commit 095ffc5806
2 changed files with 15 additions and 0 deletions

View File

@@ -19,7 +19,10 @@
#include <errno.h>
#include <malloc.h>
#include <stdio.h>
#ifdef __linux__
#include <sys/mman.h>
#endif
#include <aaruformat.h>
@@ -70,7 +73,9 @@ int aaruf_close(void* context)
free(ctx->mediaTagsHead);
}
#ifdef __linux__ // TODO: Implement
if(!ctx->inMemoryDdt) { munmap(ctx->userDataDdt, ctx->mappedMemoryDdtSize); }
#endif
free(ctx->sectorPrefixDdt);
free(ctx->sectorSuffixDdt);

View File

@@ -21,7 +21,10 @@
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#ifdef __linux__
#include <sys/mman.h>
#endif
#include <aaruformat.h>
@@ -399,6 +402,7 @@ void* aaruf_open(const char* filepath)
switch(ddtHeader.compression)
{
case None:
#ifdef __linux__
ctx->mappedMemoryDdtSize = sizeof(uint64_t) * ddtHeader.entries;
ctx->userDataDdt = mmap(NULL,
ctx->mappedMemoryDdtSize,
@@ -416,6 +420,12 @@ void* aaruf_open(const char* filepath)
ctx->inMemoryDdt = false;
break;
#else // TODO: Implement
fprintf(stderr,
"libaaruformat: Uncompressed DDT not yet implemented...");
foundUserDataDdt = false;
break;
#endif
default:
fprintf(stderr,
"libaaruformat: Found unknown compression type %d, continuing...",