[vlc-devel] [PATCH] Fixes for a couple of issues spotted by clang
Rémi Duraffort
ivoire at videolan.org
Fri Jul 3 10:17:20 CEST 2009
Hello,
> Subject: [PATCH 1/5] In InitGLX13(), make sure fbconf has a defined value. Otherwise the for loop may be left too early.
Applied thanks
> Subject: [PATCH 2/5] In httpd_FileCallBack(), make sure p_body has a defined value.
>
> ---
> src/network/httpd.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/src/network/httpd.c b/src/network/httpd.c
> index 7bfc071..4e849b8 100644
> --- a/src/network/httpd.c
> +++ b/src/network/httpd.c
> @@ -398,7 +398,7 @@ httpd_FileCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
> httpd_message_t *answer, const httpd_message_t *query )
> {
> httpd_file_t *file = (httpd_file_t*)p_sys;
> - uint8_t **pp_body, *p_body;
> + uint8_t **pp_body, *p_body = NULL;
> const char *psz_connection;
> int *pi_body, i_body;
>
> @@ -423,7 +423,6 @@ httpd_FileCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
> else
> {
> /* The file still needs to be executed. */
> - p_body = NULL;
> i_body = 0;
> pp_body = &p_body;
> pi_body = &i_body;
>
I disagree for this one: p_body is used only if (query->i_type ==
HTTPD_MSG_HEAD). In this case p_body is initialized with NULL in the
else statement.
> Subject: [PATCH 3/5] In HandleMessage(), don't let the 0xF0 case fallthrough. Otherwise setting datalen would be pointless.
>
> ---
> modules/demux/smf.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/modules/demux/smf.c b/modules/demux/smf.c
> index 2f8e93a..cfea1b0 100644
> --- a/modules/demux/smf.c
> +++ b/modules/demux/smf.c
> @@ -512,6 +512,7 @@ int HandleMessage (demux_t *p_demux, mtrk_t *tr)
> datalen = 0;
> break;
> }
> + break;
> case 0xC0:
> case 0xD0:
> datalen = 1;
> Subject: [PATCH 4/5] Let HandleMeta return ret instead of 0, why else would we bother setting it.
>
> ---
> modules/demux/smf.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/modules/demux/smf.c b/modules/demux/smf.c
> index cfea1b0..d9a732a 100644
> --- a/modules/demux/smf.c
> +++ b/modules/demux/smf.c
> @@ -449,7 +449,7 @@ int HandleMeta (demux_t *p_demux, mtrk_t *tr)
> }
>
> free (payload);
> - return 0;
> + return ret;
> }
>
I think this two are good. Rem if you can confirm ? (that's your code).
> Subject: [PATCH 5/5] Remove write-only variable i_maxbytespersec in avi_HeaderCreateRIFF().
>
> ---
> modules/mux/avi.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/modules/mux/avi.c b/modules/mux/avi.c
> index b6fbc19..da6556d 100644
> --- a/modules/mux/avi.c
> +++ b/modules/mux/avi.c
> @@ -806,7 +806,6 @@ static block_t *avi_HeaderCreateRIFF( sout_mux_t *p_mux )
> sout_mux_sys_t *p_sys = p_mux->p_sys;
> block_t *p_hdr;
> int i_stream;
> - int i_maxbytespersec;
> int i_junk;
> buffer_out_t bo;
>
> @@ -824,7 +823,7 @@ static block_t *avi_HeaderCreateRIFF( sout_mux_t *p_mux )
> bo_AddFCC( &bo, "hdrl" );
>
> avi_HeaderAdd_avih( p_mux, &bo );
> - for( i_stream = 0,i_maxbytespersec = 0; i_stream < p_sys->i_streams; i_stream++ )
> + for( i_stream = 0; i_stream < p_sys->i_streams; i_stream++ )
> {
> avi_HeaderAdd_strl( &bo, &p_sys->stream[i_stream] );
> }
Applied thanks.
--
Rémi Duraffort | ivoire
More information about the vlc-devel
mailing list