mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Disable mmap when not compiling in Linux.
This commit is contained in:
@@ -19,7 +19,10 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <aaruformat.h>
|
#include <aaruformat.h>
|
||||||
|
|
||||||
@@ -70,7 +73,9 @@ int aaruf_close(void* context)
|
|||||||
free(ctx->mediaTagsHead);
|
free(ctx->mediaTagsHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __linux__ // TODO: Implement
|
||||||
if(!ctx->inMemoryDdt) { munmap(ctx->userDataDdt, ctx->mappedMemoryDdtSize); }
|
if(!ctx->inMemoryDdt) { munmap(ctx->userDataDdt, ctx->mappedMemoryDdtSize); }
|
||||||
|
#endif
|
||||||
|
|
||||||
free(ctx->sectorPrefixDdt);
|
free(ctx->sectorPrefixDdt);
|
||||||
free(ctx->sectorSuffixDdt);
|
free(ctx->sectorSuffixDdt);
|
||||||
|
|||||||
10
src/open.c
10
src/open.c
@@ -21,7 +21,10 @@
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <aaruformat.h>
|
#include <aaruformat.h>
|
||||||
|
|
||||||
@@ -399,6 +402,7 @@ void* aaruf_open(const char* filepath)
|
|||||||
switch(ddtHeader.compression)
|
switch(ddtHeader.compression)
|
||||||
{
|
{
|
||||||
case None:
|
case None:
|
||||||
|
#ifdef __linux__
|
||||||
ctx->mappedMemoryDdtSize = sizeof(uint64_t) * ddtHeader.entries;
|
ctx->mappedMemoryDdtSize = sizeof(uint64_t) * ddtHeader.entries;
|
||||||
ctx->userDataDdt = mmap(NULL,
|
ctx->userDataDdt = mmap(NULL,
|
||||||
ctx->mappedMemoryDdtSize,
|
ctx->mappedMemoryDdtSize,
|
||||||
@@ -416,6 +420,12 @@ void* aaruf_open(const char* filepath)
|
|||||||
|
|
||||||
ctx->inMemoryDdt = false;
|
ctx->inMemoryDdt = false;
|
||||||
break;
|
break;
|
||||||
|
#else // TODO: Implement
|
||||||
|
fprintf(stderr,
|
||||||
|
"libaaruformat: Uncompressed DDT not yet implemented...");
|
||||||
|
foundUserDataDdt = false;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"libaaruformat: Found unknown compression type %d, continuing...",
|
"libaaruformat: Found unknown compression type %d, continuing...",
|
||||||
|
|||||||
Reference in New Issue
Block a user