[2/2] flvdec: Fix compiler warning for uninitialized variables

Message ID 1325683315-54690-2-git-send-email-martin@martin.st
State Committed
Commit 2df73eefb4f7c954d2bb80afa823bb7d4f8e5006
Headers show

Commit Message

Martin Storsjö Jan. 4, 2012, 1:21 p.m.
From: Jean First <jeanfirst@gmail.com>

These can't be used uninitialized in practice, but the
compiler doesn't realize it.

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 libavformat/flvdec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Diego Biurrun Jan. 4, 2012, 1:36 p.m. | #1
On Wed, Jan 04, 2012 at 03:21:55PM +0200, Martin Storsjö wrote:
> From: Jean First <jeanfirst@gmail.com>
> 
> These can't be used uninitialized in practice, but the
> compiler doesn't realize it.
> 
> Signed-off-by: Martin Storsjö <martin@martin.st>
> ---
>  libavformat/flvdec.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

OK I guess if you want to silence the warning.

Diego

Patch

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 4f1c805..2f770b3 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -441,7 +441,7 @@  static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
     int ret, i, type, size, flags, is_audio;
     int64_t next, pos;
     int64_t dts, pts = AV_NOPTS_VALUE;
-    int sample_rate, channels;
+    int sample_rate = 0, channels = 0;
     AVStream *st = NULL;
 
  for(;;avio_skip(s->pb, 4)){ /* pkt size is repeated at end. skip it */