1
0
mirror of https://github.com/moparisthebest/curl synced 2025-01-11 05:58:01 -05:00

Windows: fixes for MinGW targeting Windows Vista

Classic MinGW has neither InitializeCriticalSectionEx nor
GetTickCount64, independent of the target Windows version.

Closes https://github.com/curl/curl/pull/3113
This commit is contained in:
Marcel Raad 2018-10-07 21:46:56 +02:00
parent 6450a55721
commit 940e1c1e74
No known key found for this signature in database
GPG Key ID: 07ADACB610D796DA
4 changed files with 8 additions and 4 deletions

View File

@ -38,7 +38,8 @@
# define curl_thread_t HANDLE # define curl_thread_t HANDLE
# define curl_thread_t_null (HANDLE)0 # define curl_thread_t_null (HANDLE)0
# if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \ # if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
(_WIN32_WINNT < _WIN32_WINNT_VISTA) (_WIN32_WINNT < _WIN32_WINNT_VISTA) || \
(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
# define Curl_mutex_init(m) InitializeCriticalSection(m) # define Curl_mutex_init(m) InitializeCriticalSection(m)
# else # else
# define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1) # define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1)

View File

@ -33,7 +33,8 @@ struct curltime Curl_now(void)
*/ */
struct curltime now; struct curltime now;
#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \ #if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
(_WIN32_WINNT < _WIN32_WINNT_VISTA) (_WIN32_WINNT < _WIN32_WINNT_VISTA) || \
(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
DWORD milliseconds = GetTickCount(); DWORD milliseconds = GetTickCount();
now.tv_sec = milliseconds / 1000; now.tv_sec = milliseconds / 1000;
now.tv_usec = (milliseconds % 1000) * 1000; now.tv_usec = (milliseconds % 1000) * 1000;

View File

@ -40,7 +40,8 @@ struct timeval tvnow(void)
** is typically in the range of 10 milliseconds to 16 milliseconds. ** is typically in the range of 10 milliseconds to 16 milliseconds.
*/ */
struct timeval now; struct timeval now;
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && \
(!defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR))
ULONGLONG milliseconds = GetTickCount64(); ULONGLONG milliseconds = GetTickCount64();
#else #else
DWORD milliseconds = GetTickCount(); DWORD milliseconds = GetTickCount();

View File

@ -414,7 +414,8 @@ static struct timeval tvnow(void)
** is typically in the range of 10 milliseconds to 16 milliseconds. ** is typically in the range of 10 milliseconds to 16 milliseconds.
*/ */
struct timeval now; struct timeval now;
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && \
(!defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR))
ULONGLONG milliseconds = GetTickCount64(); ULONGLONG milliseconds = GetTickCount64();
#else #else
DWORD milliseconds = GetTickCount(); DWORD milliseconds = GetTickCount();