[PATCH] include/xaudio2.idl: use cpp_quote for xaudio2 error codes

Biswapriyo Nath nathbappai at gmail.com
Thu Aug 13 00:18:36 CDT 2020


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200813/0eba3d0f/attachment.htm>
-------------- next part --------------
From 1bd561ea274e98b987531dbd5f9e7c5d17b8ef0a Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai at gmail.com>
Date: Thu, 13 Aug 2020 10:47:49 +0530
Subject: [PATCH] include/xaudio2.idl: use cpp_quote for xaudio2 error codes

using cpp_quote and casting to HRESULT type helps to
retain HRESULT type in the generated header file.
Otherwise, the constants are assumed to be int type.
That produces warnings where conversion of int to long
are enabled as compiler warning.

Signed-off-by: Biswapriyo Nath <nathbappai at gmail.com>
---
 include/xaudio2.idl | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/xaudio2.idl b/include/xaudio2.idl
index 074454d..3201e86 100644
--- a/include/xaudio2.idl
+++ b/include/xaudio2.idl
@@ -1243,15 +1243,16 @@ const UINT32 XAUDIO2_QUANTUM_NUMERATOR = 1;
 const UINT32 XAUDIO2_QUANTUM_DENOMINATOR = 100;
 const float XAUDIO2_QUANTUM_MS = (1000.0 * XAUDIO2_QUANTUM_NUMERATOR / XAUDIO2_QUANTUM_DENOMINATOR);
 
-const HRESULT XAUDIO2_E_INVALID_CALL = 0x88960001;
-const HRESULT XAUDIO2_E_XMA_DECODER_ERROR = 0x88960002;
-const HRESULT XAUDIO2_E_XAPO_CREATION_FAILED = 0x88960003;
-const HRESULT XAUDIO2_E_DEVICE_INVALIDATED = 0x88960004;
+/* use cpp_quote to retain the HRESULT type in header file */
+cpp_quote("#define XAUDIO2_E_INVALID_CALL ((HRESULT)0x88960001)")
+cpp_quote("#define XAUDIO2_E_XMA_DECODER_ERROR ((HRESULT)0x88960002)")
+cpp_quote("#define XAUDIO2_E_XAPO_CREATION_FAILED ((HRESULT)0x88960003)")
+cpp_quote("#define XAUDIO2_E_DEVICE_INVALIDATED ((HRESULT)0x88960004)")
 
 /* xaudio 2.0 error codes */
-const HRESULT XAUDIO20_E_XMA_DECODER_ERROR = 0x88960001;
-const HRESULT XAUDIO20_E_XAPO_CREATION_FAILED = 0x88960002;
-const HRESULT XAUDIO20_E_DEVICE_INVALIDATED = 0x88960003;
+cpp_quote("#define XAUDIO20_E_XMA_DECODER_ERROR ((HRESULT)0x88960001)")
+cpp_quote("#define XAUDIO20_E_XAPO_CREATION_FAILED ((HRESULT)0x88960002)")
+cpp_quote("#define XAUDIO20_E_DEVICE_INVALIDATED ((HRESULT)0x88960003)")
 
 cpp_quote("#ifdef XAUDIO2_HELPER_FUNCTIONS")
 cpp_quote("#define _USE_MATH_DEFINES")
-- 
2.27.0



More information about the wine-devel mailing list