[PATCH] include/dxva2api.idl: Fix build error when compiled as C++.
Jacek Caban
jacek at codeweavers.com
Mon Mar 22 12:34:48 CDT 2021
Hi Nikolay,
On 3/22/21 8:25 AM, Nikolay Sivov wrote:
> From: Liu Hao <lh_mouse at 126.com>
>
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50836
> Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
> ---
> include/dxva2api.idl | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/dxva2api.idl b/include/dxva2api.idl
> index 99c93518428..31cacbdcbd0 100644
> --- a/include/dxva2api.idl
> +++ b/include/dxva2api.idl
> @@ -815,13 +815,15 @@ cpp_quote(" return f32;")
> cpp_quote("}")
> cpp_quote("")
> cpp_quote("static inline float DXVA2FixedToFloat(DXVA2_Fixed32 f32) {")
> -cpp_quote(" struct { USHORT Fraction; SHORT Value; } *_f32 = (void *)&f32;")
> +cpp_quote(" typedef struct { USHORT Fraction; SHORT Value; } fields;")
> +cpp_quote(" fields *_f32 = (fields *)(void *)&f32;")
> cpp_quote(" return (float)_f32->Value + (float)_f32->Fraction / (1 << 16);")
> cpp_quote("}")
> cpp_quote("")
> cpp_quote("static inline DXVA2_Fixed32 DXVA2FloatToFixed(float f) {")
> cpp_quote(" DXVA2_Fixed32 f32;")
> -cpp_quote(" struct { USHORT Fraction; SHORT Value; } *_f32 = (void *)&f32;")
> +cpp_quote(" typedef struct { USHORT Fraction; SHORT Value; } fields;")
> +cpp_quote(" fields *_f32 = (fields *)(void *)&f32;")
> cpp_quote(" _f32->Value = ((ULONG) (f * (1 << 16))) >> 16;")
> cpp_quote(" _f32->Fraction = ((ULONG) (f * (1 << 16))) & 0xFFFF;")
> cpp_quote(" return f32;")
I wonder if we could just avoid nameless mess in the first place. I sent
an alternative solution for consideration.
Thanks,
Jacek
More information about the wine-devel
mailing list