From 6a6871ee42f6ea20900a6ad66ed8f7875975be3b Mon Sep 17 00:00:00 2001 From: pchome Date: Tue, 3 Apr 2018 22:11:26 +0300 Subject: [PATCH] [dxgi] Fix compilation with WINE headers (#236) * [dxgi] Fix compilation with WINE headers ```gcc error: cannot convert 'MONITORINFOEX* {aka tagMONITORINFOEXA*}' to 'LPMONITORINFO {aka tagMONITORINFO*}' for argument '2' to 'BOOL GetMonitorInfoA(HMONITOR, LPMONITORINFO)' ``` ```clang cannot initialize a parameter of type 'LPMONITORINFO' (aka 'tagMONITORINFO *') with an rvalue of type '::MONITORINFOEX *' (aka 'tagMONITORINFOEXA *') ``` This can be WINE bug but I don't want to dig now, firs suggestion is wrong "tag": wine variant ```c typedef struct tagMONITORINFO { ... } MONITORINFO, *LPMONITORINFO; typedef struct tagMONITORINFOEXA { /* the 4 first entries are the same as MONITORINFO */ ... } MONITORINFOEXA, *LPMONITORINFOEXA; typedef struct tagMONITORINFOEXW { /* the 4 first entries are the same as MONITORINFO */ ... } MONITORINFOEXW, *LPMONITORINFOEXW; DECL_WINELIB_TYPE_AW(MONITORINFOEX) DECL_WINELIB_TYPE_AW(LPMONITORINFOEX) ``` VS MinGW variant ```c typedef struct tagMONITORINFO { ... } MONITORINFO,*LPMONITORINFO; typedef struct tagMONITORINFOEXA : public tagMONITORINFO { CHAR szDevice[CCHDEVICENAME]; } MONITORINFOEXA,*LPMONITORINFOEXA; typedef struct tagMONITORINFOEXW : public tagMONITORINFO { WCHAR szDevice[CCHDEVICENAME]; } MONITORINFOEXW,*LPMONITORINFOEXW; __MINGW_TYPEDEF_AW(MONITORINFOEX) __MINGW_TYPEDEF_AW(LPMONITORINFOEX) ``` * [dxgi] Fix compilation with WINE headers Use C++-style casts rather than C ones. --- src/dxgi/dxgi_output.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dxgi/dxgi_output.cpp b/src/dxgi/dxgi_output.cpp index 9018fc9b..c1559936 100644 --- a/src/dxgi/dxgi_output.cpp +++ b/src/dxgi/dxgi_output.cpp @@ -138,7 +138,7 @@ namespace dxvk { ::MONITORINFOEX monInfo; monInfo.cbSize = sizeof(monInfo); - if (!::GetMonitorInfo(m_monitor, &monInfo)) { + if (!::GetMonitorInfo(m_monitor, reinterpret_cast(&monInfo))) { Logger::err("DxgiOutput: Failed to query monitor info"); return E_FAIL; } @@ -166,7 +166,7 @@ namespace dxvk { ::MONITORINFOEX monInfo; monInfo.cbSize = sizeof(monInfo); - if (!::GetMonitorInfo(m_monitor, &monInfo)) { + if (!::GetMonitorInfo(m_monitor, reinterpret_cast(&monInfo))) { Logger::err("DxgiOutput: Failed to query monitor info"); return E_FAIL; }