From c9e3dc373beaaa78b439bc65d94f34db0c665ef0 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sat, 6 Oct 2018 19:28:16 +0300 Subject: [PATCH] mdbx-windows: more for WindowsXP support. Change-Id: Ide34048720989fc010f48e086569e12e8c1edca1 --- src/osal.c | 9 +++++++++ src/osal.h | 4 ++-- src/tools/wingetopt.c | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/osal.c b/src/osal.c index 2a037447..4dbc7f01 100644 --- a/src/osal.c +++ b/src/osal.c @@ -137,6 +137,15 @@ typedef struct _FILE_PROVIDER_EXTERNAL_INFO_V1 { #define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS)0xC0000010L) #endif +#ifndef FILE_DEVICE_FILE_SYSTEM +#define FILE_DEVICE_FILE_SYSTEM 0x00000009 +#endif + +#ifndef FSCTL_GET_EXTERNAL_BACKING +#define FSCTL_GET_EXTERNAL_BACKING \ + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 196, METHOD_BUFFERED, FILE_ANY_ACCESS) +#endif + #endif /* _WIN32 || _WIN64 */ /*----------------------------------------------------------------------------*/ diff --git a/src/osal.h b/src/osal.h index 0f3da8a8..c447bf44 100644 --- a/src/osal.h +++ b/src/osal.h @@ -649,7 +649,7 @@ static __inline uint32_t mdbx_atomic_add32(volatile uint32_t *p, uint32_t v) { return __sync_fetch_and_add(p, v); #else #ifdef _MSC_VER - return _InterlockedExchangeAdd(p, v); + return _InterlockedExchangeAdd((volatile long *)p, v); #endif #ifdef __APPLE__ return OSAtomicAdd32(v, (volatile int32_t *)p); @@ -689,7 +689,7 @@ static __inline bool mdbx_atomic_compare_and_swap32(volatile uint32_t *p, return __sync_bool_compare_and_swap(p, c, v); #else #ifdef _MSC_VER - return c == _InterlockedCompareExchange(p, v, c); + return c == _InterlockedCompareExchange((volatile long *)p, v, c); #endif #ifdef __APPLE__ return c == OSAtomicCompareAndSwap32Barrier(c, v, (volatile int32_t *)p); diff --git a/src/tools/wingetopt.c b/src/tools/wingetopt.c index 1dd0d069..7feb223f 100644 --- a/src/tools/wingetopt.c +++ b/src/tools/wingetopt.c @@ -55,7 +55,7 @@ char *optarg; int getopt(int argc, char *const argv[], const char *opts) { static int sp = 1; int c; - char *cp; + const char *cp; if (sp == 1) { if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0')