[vlc-devel] [PATCH] codec: cea708: fix warning
Steve Lhomme
robux4 at ycbcr.xyz
Mon Jan 21 08:38:24 CET 2019
On 18/01/2019 17:51, Johan Gunnarsson wrote:
> codec/cea708.c:1649:18: warning: variable 'i_ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> else if( c > 0x9F )
> ^~~~~~~~
> codec/cea708.c:1652:13: note: uninitialized use occurs here
> if( i_ret & CEA708_STATUS_OUTPUT )
> ^~~~~
> codec/cea708.c:1649:14: note: remove the 'if' if its condition is always true
> else if( c > 0x9F )
> ^~~~~~~~~~~~~~
> codec/cea708.c:1640:18: note: initialize the variable 'i_ret' to silence this warning
> int i_ret;
> ^
> = 0
> 1 warning generated.
> ---
> modules/codec/cea708.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/modules/codec/cea708.c b/modules/codec/cea708.c
> index c0cea476f7..e56b8779ed 100644
> --- a/modules/codec/cea708.c
> +++ b/modules/codec/cea708.c
> @@ -1642,11 +1642,11 @@ static void CEA708_Decode_ServiceBuffer( cea708_t *h )
>
> if( c < 0x20 )
> i_ret = CEA708_Decode_C0( c, h );
> - else if( c >= 0x20 && c <=0x7F )
> + else if( c >= 0x20 && c <= 0x7F )
> i_ret = CEA708_Decode_G0( c, h );
> else if( c >= 0x80 && c <= 0x9F )
> i_ret = CEA708_Decode_C1( c, h );
> - else if( c > 0x9F )
> + else
> i_ret = CEA708_Decode_G1( c, h );
This is not fixing a benign warning, it's changing the behavior of the
code as well. If c is neither of these values maybe i_ret should have an
error value.
>
> if( i_ret & CEA708_STATUS_OUTPUT )
> --
> 2.17.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list