win32: Updated some legacy APIs to use the newer extended versions
Updated the usage of some legacy APIs, that are preventing curl from compiling for Windows Store and Windows Phone build targets. Suggested-by: Stefan Neis Feature: http://sourceforge.net/p/curl/feature-requests/82/
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@@ -123,7 +123,12 @@ void Curl_thread_destroy(curl_thread_t hnd)
|
|||||||
|
|
||||||
int Curl_thread_join(curl_thread_t *hnd)
|
int Curl_thread_join(curl_thread_t *hnd)
|
||||||
{
|
{
|
||||||
|
#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
|
||||||
|
(_WIN32_WINNT < _WIN32_WINNT_VISTA)
|
||||||
int ret = (WaitForSingleObject(*hnd, INFINITE) == WAIT_OBJECT_0);
|
int ret = (WaitForSingleObject(*hnd, INFINITE) == WAIT_OBJECT_0);
|
||||||
|
#else
|
||||||
|
int ret = (WaitForSingleObjectEx(*hnd, INFINITE, FALSE) == WAIT_OBJECT_0);
|
||||||
|
#endif
|
||||||
|
|
||||||
Curl_thread_destroy(*hnd);
|
Curl_thread_destroy(*hnd);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@@ -37,7 +37,12 @@
|
|||||||
# define curl_mutex_t CRITICAL_SECTION
|
# define curl_mutex_t CRITICAL_SECTION
|
||||||
# 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) || \
|
||||||
|
(_WIN32_WINNT < _WIN32_WINNT_VISTA)
|
||||||
# define Curl_mutex_init(m) InitializeCriticalSection(m)
|
# define Curl_mutex_init(m) InitializeCriticalSection(m)
|
||||||
|
# else
|
||||||
|
# define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1)
|
||||||
|
# endif
|
||||||
# define Curl_mutex_acquire(m) EnterCriticalSection(m)
|
# define Curl_mutex_acquire(m) EnterCriticalSection(m)
|
||||||
# define Curl_mutex_release(m) LeaveCriticalSection(m)
|
# define Curl_mutex_release(m) LeaveCriticalSection(m)
|
||||||
# define Curl_mutex_destroy(m) DeleteCriticalSection(m)
|
# define Curl_mutex_destroy(m) DeleteCriticalSection(m)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@@ -32,9 +32,17 @@ struct timeval curlx_tvnow(void)
|
|||||||
** increases monotonically and wraps once 49.7 days have elapsed.
|
** increases monotonically and wraps once 49.7 days have elapsed.
|
||||||
*/
|
*/
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
|
#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
|
||||||
|
(_WIN32_WINNT < _WIN32_WINNT_VISTA)
|
||||||
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;
|
||||||
|
#else
|
||||||
|
ULONGLONG milliseconds = GetTickCount64();
|
||||||
|
now.tv_sec = (long) (milliseconds / 1000);
|
||||||
|
now.tv_usec = (long) (milliseconds % 1000) * 1000;
|
||||||
|
#endif
|
||||||
|
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user