From: mistachkin Date: Mon, 11 Aug 2014 17:38:38 +0000 (+0000) Subject: Fix for #ifdef issue with GetVersionEx in the Win32 VFS. X-Git-Tag: version-3.8.6~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91d1249748846897684d285466c809a602ca57dc;p=thirdparty%2Fsqlite.git Fix for #ifdef issue with GetVersionEx in the Win32 VFS. FossilOrigin-Name: 1a0d466dd48163c86de4774035fe4a30c1c55311 --- diff --git a/manifest b/manifest index f7cef7e70f..8aa852cdf5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\sfew\smore\srequirements\stests. -D 2014-08-11T17:37:27.183 +C Fix\sfor\s#ifdef\sissue\swith\sGetVersionEx\sin\sthe\sWin32\sVFS. +D 2014-08-11T17:38:38.381 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -208,7 +208,7 @@ F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c 17e7ab0f9160a78c964d615b15b1658ab2090d42 -F src/os_win.c 3fca1bfdf78338705bf536059a407d0fb04016d5 +F src/os_win.c d37c3e70e85f9c9bfb2e0dad1b1d8714077fbf8d F src/os_win.h 057344a6720b4c8405d9bd98f58cb37a6ee46c25 F src/pager.c f6bb1fa6cdf2062f2d8aec3e64db302bca519ab8 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 @@ -1185,7 +1185,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 62d38308b519a5362f559b296a0cf1acccf8f673 -R 02be8e57f1690f8a6be367e01ea8228e -U drh -Z 0a8f19538bd793702427af9b3a2d2400 +P b5652439d5d770f0edeb80c8f55fa7cc515482e3 +R da55da95544cc788a74ff6acfb8e9051 +U mistachkin +Z 276e7597dfac53b7c7af380d74f891b3 diff --git a/manifest.uuid b/manifest.uuid index f63115401a..2da18ac2ad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b5652439d5d770f0edeb80c8f55fa7cc515482e3 \ No newline at end of file +1a0d466dd48163c86de4774035fe4a30c1c55311 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 5f1d84a3fb..0f391f9521 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -155,7 +155,7 @@ ** [sometimes] not used by the code (e.g. via conditional compilation). */ #ifndef UNUSED_VARIABLE_VALUE -# define UNUSED_VARIABLE_VALUE(x) (void)(x) +# define UNUSED_VARIABLE_VALUE(x) (void)(x) #endif /* @@ -1052,7 +1052,16 @@ static struct win_syscall { ** is really just a macro that uses a compiler intrinsic (e.g. x64). ** So do not try to make this is into a redefinable interface. */ +#if defined(InterlockedCompareExchange) + { "InterlockedCompareExchange", (SYSCALL)0, 0 }, + #define osInterlockedCompareExchange InterlockedCompareExchange +#else + { "InterlockedCompareExchange", (SYSCALL)InterlockedCompareExchange, 0 }, + +#define osInterlockedCompareExchange ((LONG(WINAPI*)(LONG volatile*, \ + LONG,LONG))aSyscall[76].pCurrent) +#endif /* defined(InterlockedCompareExchange) */ }; /* End of the overrideable system calls */ @@ -1312,12 +1321,14 @@ void sqlite3_win32_sleep(DWORD milliseconds){ ** based on the NT kernel. */ int sqlite3_win32_is_nt(void){ +#if defined(SQLITE_WIN32_GETVERSIONEX) && SQLITE_WIN32_GETVERSIONEX if( osInterlockedCompareExchange(&sqlite3_os_type, 0, 0)==0 ){ -#if defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WIN8 +#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \ + defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WIN8 OSVERSIONINFOW sInfo; sInfo.dwOSVersionInfoSize = sizeof(sInfo); osGetVersionExW(&sInfo); -#else +#elif defined(SQLITE_WIN32_HAS_ANSI) OSVERSIONINFOA sInfo; sInfo.dwOSVersionInfoSize = sizeof(sInfo); osGetVersionExA(&sInfo); @@ -1326,6 +1337,9 @@ int sqlite3_win32_is_nt(void){ (sInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) ? 2 : 1, 0); } return osInterlockedCompareExchange(&sqlite3_os_type, 2, 2)==2; +#else + return 1; +#endif } #ifdef SQLITE_WIN32_MALLOC @@ -5482,7 +5496,7 @@ int sqlite3_os_init(void){ /* Double-check that the aSyscall[] array has been constructed ** correctly. See ticket [bb3a86e890c8e96ab] */ - assert( ArraySize(aSyscall)==76 ); + assert( ArraySize(aSyscall)==77 ); /* get memory map allocation granularity */ memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));