From dad6340a92ce4086444e9ac661adf1c49d0ebd5e Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Thu, 13 Aug 2020 01:15:28 +0530 Subject: [PATCH] thirdparty/dxerr: cast xaudio2 error codes to HRESULT type Changes: * thirdparty/dxerr/dxerr.cpp: cast XAUDIO2_E_ defines to HRESULT which is the result type of the parameter of both DXGetErrorStringA and DXGetErrorDescriptionA function. Otherwise, gcc shows error narrowing conversion from int to long. This casting also matches with WinSDK xaudio2.h file. --- thirdparty/dxerr/dxerr.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/thirdparty/dxerr/dxerr.cpp b/thirdparty/dxerr/dxerr.cpp index 4f181ef3..35e1d99a 100644 --- a/thirdparty/dxerr/dxerr.cpp +++ b/thirdparty/dxerr/dxerr.cpp @@ -53,10 +53,12 @@ #include #endif -#define XAUDIO2_E_INVALID_CALL 0x88960001 -#define XAUDIO2_E_XMA_DECODER_ERROR 0x88960002 -#define XAUDIO2_E_XAPO_CREATION_FAILED 0x88960003 -#define XAUDIO2_E_DEVICE_INVALIDATED 0x88960004 +// XAudio2 error codes +// Cast to HRESULT to match parameter type and suppress GCC narrowing error +#define XAUDIO2_E_INVALID_CALL ((HRESULT)0x88960001) +#define XAUDIO2_E_XMA_DECODER_ERROR ((HRESULT)0x88960002) +#define XAUDIO2_E_XAPO_CREATION_FAILED ((HRESULT)0x88960003) +#define XAUDIO2_E_DEVICE_INVALIDATED ((HRESULT)0x88960004) #define XAPO_E_FORMAT_UNSUPPORTED MAKE_HRESULT(SEVERITY_ERROR, 0x897, 0x01)