[vlc-devel] [PATCH] contrib: crystalhd: fix forward declaration of a struct

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Jul 11 17:29:37 CEST 2019


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* ?

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list