[vlc-commits] modules: set the forced _WIN32_WINNT right after including config.h

Steve Lhomme git at videolan.org
Wed Apr 8 23:58:11 CEST 2020


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Apr  2 13:38:17 2020 +0200| [7aee3dad987c792570bfb3c67c22c9ecb688692c] | committer: Martin Storsjo

modules: set the forced _WIN32_WINNT right after including config.h

config.h and vlc_fixups.h don't include files that use _WIN32_WINNT but any
other VLC or system these files require will likely use this value that is
found in config.h.

Partially cherry-picked from 4cb707be548fd2bbc202beca04826159e8663155

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=7aee3dad987c792570bfb3c67c22c9ecb688692c
---

 modules/audio_output/mmdevice.c            | 10 +++++-----
 modules/audio_output/wasapi.c              | 10 +++++-----
 modules/codec/avcodec/directx_va.h         |  2 +-
 modules/video_chroma/d3d11_fmt.c           | 10 +++++-----
 modules/video_output/win32/d3d11_quad.c    |  8 ++++----
 modules/video_output/win32/d3d11_shaders.c | 10 +++++-----
 modules/video_output/win32/direct3d11.c    | 10 +++++-----
 modules/video_output/win32/win32touch.h    | 13 ++++++-------
 8 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index 3642c8265e..31d8cb9a97 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -18,15 +18,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_VISTA
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_VISTA
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
+#if _WIN32_WINNT < 0x0600 // _WIN32_WINNT_VISTA
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_VISTA
+#endif
+
 #define INITGUID
 #define COBJMACROS
 #define CONST_VTABLE
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index e438e8e868..60b041db6d 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -18,15 +18,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_VISTA
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_VISTA
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
+#if _WIN32_WINNT < 0x0600 // _WIN32_WINNT_VISTA
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_VISTA
+#endif
+
 #define INITGUID
 #define COBJMACROS
 #define CONST_VTABLE
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 335cca7bd3..6b66979e01 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -28,7 +28,7 @@
 #ifndef AVCODEC_DIRECTX_VA_H
 #define AVCODEC_DIRECTX_VA_H
 
-# if _WIN32_WINNT < _WIN32_WINNT_VISTA
+# if _WIN32_WINNT < 0x0600 // _WIN32_WINNT_VISTA
 /* d3d11 needs Vista support */
 #  undef _WIN32_WINNT
 #  define _WIN32_WINNT _WIN32_WINNT_VISTA
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 4a42e29d04..f348699e49 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -20,15 +20,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_WIN7
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_WIN7
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_WIN7
+#endif
+
 #include <vlc_common.h>
 #include <vlc_picture.h>
 
diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index ca9d31bb59..0e2ff33266 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -24,14 +24,14 @@
 # include "config.h"
 #endif
 
-#include <assert.h>
-#include <vlc_common.h>
-
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_WIN7
+#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
 # undef _WIN32_WINNT
 # define _WIN32_WINNT _WIN32_WINNT_WIN7
 #endif
 
+#include <assert.h>
+#include <vlc_common.h>
+
 #define COBJMACROS
 #include <d3d11.h>
 
diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index e79d711714..72ed6a83b5 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -20,15 +20,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_WIN7
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_WIN7
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_WIN7
+#endif
+
 #include <vlc_common.h>
 
 #include <assert.h>
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 12e38ce2fa..af11e939a9 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -21,15 +21,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_WIN7
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_WIN7
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_WIN7
+#endif
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_vout_display.h>
diff --git a/modules/video_output/win32/win32touch.h b/modules/video_output/win32/win32touch.h
index ea854282bf..b9bda93ff8 100644
--- a/modules/video_output/win32/win32touch.h
+++ b/modules/video_output/win32/win32touch.h
@@ -24,17 +24,16 @@
 #ifndef VLC_GESTURE_H_
 #define VLC_GESTURE_H_
 
-# if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x601
-#  undef _WIN32_WINNT
-#  define _WIN32_WINNT 0x0601
-# endif
-# include <windows.h>
-# include <winuser.h>
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_WIN7
+#endif
+#define WINVER _WIN32_WINNT_WIN7
+
 #include <vlc_common.h>
 
 #ifndef WM_GESTURE



More information about the vlc-commits mailing list