[vlc-devel] [PATCH] contrib: crystalhd: fix forward declaration of a struct
Steve Lhomme
robux4 at ycbcr.xyz
Fri Jul 12 07:05:46 CEST 2019
On 2019-07-11 17:29, Hugo Beauzée-Luyssen wrote:
> On Thu, Jul 11, 2019, at 5:22 PM, Steve Lhomme wrote:
>> Clang doesn't like it and warns about setting the callback using this signature.
>> ---
>> contrib/src/crystalhd/callback_proto.patch | 11 +++++++++++
>> contrib/src/crystalhd/rules.mak | 14 ++++++++++----
>> 2 files changed, 21 insertions(+), 4 deletions(-)
>> create mode 100644 contrib/src/crystalhd/callback_proto.patch
>>
>> diff --git a/contrib/src/crystalhd/callback_proto.patch
>> b/contrib/src/crystalhd/callback_proto.patch
>> new file mode 100644
>> index 0000000000..96542dc66d
>> --- /dev/null
>> +++ b/contrib/src/crystalhd/callback_proto.patch
>> @@ -0,0 +1,11 @@
>> +--- libcrystalhd/bc_dts_defs.h.orig 2019-07-11 16:24:29.945517600 +0200
>> ++++ libcrystalhd/bc_dts_defs.h 2019-07-11 16:24:53.452588400 +0200
>> +@@ -442,7 +442,7 @@ enum DECODER_CAP_FLAGS
>> + #if defined(__KERNEL__) || defined(__LINUX_USER__)
>> + typedef BC_STATUS (*dts_pout_callback)(void *shnd, U32 width,U32
>> height, U32 stride, void *pOut);
>> + #else
>> +-typedef BC_STATUS (*dts_pout_callback)(void *shnd, U32 width,U32
>> height, U32 stride, struct _BC_DTS_PROC_OUT *pOut);
>> ++typedef BC_STATUS (*dts_pout_callback)(void *shnd, U32 width,U32
>> height, U32 stride, /* BC_DTS_PROC_OUT */ void *pOut);
>> + #endif
>> +
>> + //Line 21 Closed Caption
>> diff --git a/contrib/src/crystalhd/rules.mak
>> b/contrib/src/crystalhd/rules.mak
>> index a697ac85ae..0227dfe34d 100644
>> --- a/contrib/src/crystalhd/rules.mak
>> +++ b/contrib/src/crystalhd/rules.mak
>> @@ -13,10 +13,16 @@ CRYSTAL_SOURCES := crystalhd_lgpl_includes_v1.zip
>>
>> .sum-crystalhd: $(CRYSTAL_SOURCES)
>>
>> -.crystalhd: $(CRYSTAL_SOURCES) .sum-crystalhd
>> - mkdir -p -- "$(PREFIX)/include/libcrystalhd"
>> - unzip -o $< -d "$(PREFIX)/include/libcrystalhd"
>> +libcrystalhd: $(CRYSTAL_SOURCES) .sum-crystalhd
>> + $(RM) -R $(UNPACK_DIR) && unzip -o $< -d $(UNPACK_DIR)
>> + chmod -R u+w $(UNPACK_DIR)
>> + $(APPLY) $(SRC)/crystalhd/callback_proto.patch
>> ifdef HAVE_WIN32 # we want dlopening on win32
>> - rm -rf $(PREFIX)/include/libcrystalhd/bc_drv_if.h
>> + rm -rf $(UNPACK_DIR)/bc_drv_if.h
>> endif
>> + $(MOVE)
>> +
>> +.crystalhd: libcrystalhd
>> + rm -Rf "$(PREFIX)/include/libcrystalhd"
>> + cp -R $< "$(PREFIX)/include"
>> touch $@
>
> Couldn't you forward declare the struct outside of the callback typedef to avoid using a void* ?
Indeed it's cleaner.
We will need to adjust our callback signature with the same #ifdef on
our side.
More information about the vlc-devel
mailing list