On 2012-09-18 01:35:06 +0200, Benjamin Larsson wrote:  
> libavcodec/a64multienc.c: In function ‘a64multi_encode_frame’:
> libavcodec/a64multienc.c:342:17: warning: ‘buf’ may be used uninitialized in 
> this function [-Wuninitialized]
> 
> The compiler has trouble to figure out that the if block
> if (c->mc_frame_counter == c->mc_lifetime) {
> never should be entered with both values being 0. So add
> an explicit check on one of the parameters.

changing the type of mc_frame_counter to unsigned seems more elegant,
see below.

Janne
---8<---
GCC cannot proof that c->mc_frame_counter is always >- 0, changing the
type from int to unsigned fixes following warning:

libavcodec/a64multienc.c: In function ‘a64multi_encode_frame’:
libavcodec/a64multienc.c:342:17: warning: ‘buf’ may be used uninitialized in 
this function[-Wuninitialized]
---
 libavcodec/a64enc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/a64enc.h b/libavcodec/a64enc.h
index bf5eb02..d5f8e9a 100644
--- a/libavcodec/a64enc.h
+++ b/libavcodec/a64enc.h
@@ -41,7 +41,7 @@ typedef struct A64Context {
     AVLFG randctx;
     int mc_lifetime;
     int mc_use_5col;
-    int mc_frame_counter;
+    unsigned mc_frame_counter;
     int *mc_meta_charset;
     int *mc_charmap;
     int *mc_best_cb;
-- 
1.7.12

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to