From 4b26ef148b419bda504344aebc8d3f1933b16921 Mon Sep 17 00:00:00 2001 From: KoKoKotlin Date: Wed, 5 Jan 2022 16:49:34 +0100 Subject: [PATCH] made lib windows compatible --- bitmap.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bitmap.c b/bitmap.c index f3c7267..09fd075 100644 --- a/bitmap.c +++ b/bitmap.c @@ -11,8 +11,13 @@ #include #include -//Includes from POSIX: -#include +#ifdef __unix__ + #include +#endif + +// Constants R_OK and W_OK in windows not defined => redefinition here +#define READ_PERM 0x02 +#define WRITE_PERM 0x04 //Constants: #define BITMAP_MAGIC_NUMBER 0x4D42 @@ -1652,7 +1657,7 @@ bitmap_error_t bitmapCreateFile(bitmap_t* bitmap, const char* filePath, bitmap_b bitmapLog(BITMAP_LOGGING_VERBOSE, "Going to create file \"%s\" ...", filePath); //Check the access to the file path: - if (access(filePath, R_OK | W_OK) == 0) + if (access(filePath, READ_PERM | WRITE_PERM) == 0) { //The file already exists. Is that allowed? if (!overwriteExisting)