Skip to content

Commit

Permalink
thirdparty/dxerr: cast xaudio2 error codes to HRESULT type
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Biswa96 authored and jrfonseca committed Sep 11, 2020
1 parent a112ac3 commit dad6340
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions thirdparty/dxerr/dxerr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@
#include <dwrite.h>
#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)

Expand Down

0 comments on commit dad6340

Please sign in to comment.