[vlc-commits] d3d11_fmt: fix logging of WCHAR as a char

Steve Lhomme git at videolan.org
Wed Apr 3 09:56:05 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Apr  3 09:36:50 2019 +0200| [cf94ad7df92ee110046002018285c09f3dd49965] | committer: Steve Lhomme

d3d11_fmt: fix logging of WCHAR as a char

We read the value as a WCHAR (UNICODE is set) so we can't use the string for
logging directly.

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

 modules/video_chroma/d3d11_fmt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 5f307933e5..7512cf9f80 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -26,6 +26,7 @@
 
 #include <vlc_common.h>
 #include <vlc_picture.h>
+#include <vlc_charset.h>
 
 #define COBJMACROS
 #include <d3d11.h>
@@ -210,7 +211,9 @@ void D3D11_GetDriverVersion(vlc_object_t *obj, d3d11_device_t *d3d_dev)
     /* see https://docs.microsoft.com/en-us/windows-hardware/drivers/display/wddm-2-1-features#driver-versioning */
     if (_stscanf(szData, TEXT("%d.%d.%d.%d"), &wddm, &d3d_features, &revision, &build) != 4)
     {
-        msg_Warn(obj, "the adapter DriverVersion '%s' doesn't match the expected format", szData);
+        char *driver_version = FromWide(szData);
+        msg_Warn(obj, "the adapter DriverVersion '%s' doesn't match the expected format", driver_version);
+        free(driver_version);
         return;
     }
     d3d_dev->WDDM.wddm         = wddm;



More information about the vlc-commits mailing list