[vlc-devel] [PATCH] codec: cea708: fix warning

Johan Gunnarsson johan.gunnarsson at gmail.com
Fri Jan 18 17:51:02 CET 2019


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 );
 
         if( i_ret & CEA708_STATUS_OUTPUT )
-- 
2.17.1



More information about the vlc-devel mailing list