mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 11:14:39 +00:00
Disable mmap when not compiling in Linux.
This commit is contained in:
@@ -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);
|
||||
|
||||
10
src/open.c
10
src/open.c
@@ -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...",
|
||||
|
||||
Reference in New Issue
Block a user