]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
windows: target version macro tidy-ups
authorViktor Szakats <commit@vsz.me>
Sun, 20 Jul 2025 21:24:26 +0000 (23:24 +0200)
committerViktor Szakats <commit@vsz.me>
Wed, 23 Jul 2025 20:43:52 +0000 (22:43 +0200)
- autotools: stop checking for `WINVER` to detect thread-safety.
  To sync with implementation in `easy_lock.h` and with cmake.

- replace numeric version with `_WIN32_WINNT_VISTA`.

- `_WIN32_WINNT_VISTA` is always defined via `setup-win32.h`,
  don't check for it.

Closes #17981

configure.ac
lib/curl_threads.c
lib/curl_threads.h
lib/idn.c
lib/rand.c

index 2d04f91051c3c091b6468463571a27d4c4c939df..acf253eadceb0f64529e2aaa26d0ad438d7635a7 100644 (file)
@@ -5382,7 +5382,7 @@ else
     AC_LANG_PROGRAM([[
       #include <windows.h>
     ]],[[
-      #if (WINVER < 0x600) && (_WIN32_WINNT < 0x600)
+      #if (_WIN32_WINNT < 0x600)
       #error
       #endif
     ]])
index 24561a6dde3763442a610ed57205341aaa18b319..ed1ad30e73634d1e8ceb78694a2ecfb0b1f10fbd 100644 (file)
@@ -142,8 +142,7 @@ void Curl_thread_destroy(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)
+#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < _WIN32_WINNT_VISTA)
   int ret = (WaitForSingleObject(*hnd, INFINITE) == WAIT_OBJECT_0);
 #else
   int ret = (WaitForSingleObjectEx(*hnd, INFINITE, FALSE) == WAIT_OBJECT_0);
index fb74561ffa18f799cd6d404745b62d6015e58e95..3428fcd968027d9160c6489634490a6ace03120f 100644 (file)
@@ -39,8 +39,7 @@
 #  define curl_mutex_t           CRITICAL_SECTION
 #  define curl_thread_t          HANDLE
 #  define curl_thread_t_null     (HANDLE)0
-#  if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
-      (_WIN32_WINNT < _WIN32_WINNT_VISTA)
+#  if !defined(_WIN32_WINNT) || (_WIN32_WINNT < _WIN32_WINNT_VISTA)
 #    define Curl_mutex_init(m)   InitializeCriticalSection(m)
 #  else
 #    define Curl_mutex_init(m)   InitializeCriticalSectionEx(m, 0, 1)
index 798c9aaef1ab5a190d9f95430775de5a5312addd..2d56043293bed486a19de8e77db6effe3f9bbb83 100644 (file)
--- a/lib/idn.c
+++ b/lib/idn.c
@@ -152,7 +152,7 @@ static CURLcode mac_ascii_to_idn(const char *in, char **out)
 #ifdef USE_WIN32_IDN
 /* using Windows kernel32 and normaliz libraries. */
 
-#if (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x600) && \
+#if (!defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_VISTA) && \
   (!defined(WINVER) || WINVER < 0x600)
 WINBASEAPI int WINAPI IdnToAscii(DWORD dwFlags,
                                  const WCHAR *lpUnicodeCharStr,
index 72545e086770408e6d5b7c3d55b5055d0d8861e0..4bff30d6775777b832d78d267ae6129678abdf39 100644 (file)
@@ -48,7 +48,7 @@
 
 #ifdef _WIN32
 
-#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600 && \
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_VISTA && \
   !defined(CURL_WINDOWS_UWP)
 #  define HAVE_WIN_BCRYPTGENRANDOM
 #  include <bcrypt.h>