From 095ffc5806e412a81c1cd6e3fa8400b522aec961 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 21 Jun 2022 21:08:19 +0100 Subject: [PATCH] Disable mmap when not compiling in Linux. --- src/close.c | 5 +++++ src/open.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/close.c b/src/close.c index b090029..d3dfc81 100644 --- a/src/close.c +++ b/src/close.c @@ -19,7 +19,10 @@ #include #include #include + +#ifdef __linux__ #include +#endif #include @@ -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); diff --git a/src/open.c b/src/open.c index faeb10a..625233a 100644 --- a/src/open.c +++ b/src/open.c @@ -21,7 +21,10 @@ #include #include #include + +#ifdef __linux__ #include +#endif #include @@ -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...",