[PATCH 00/11] Various fixes to silence compiler warnings
Jean First (11): 8svx: remove unused variable in eightsvx_decode_frame lavfi: fix compiler warning for uninitialized variables cache: remove unused variable in cache_open cache: use av_freep instead of av_free in cache_open flvdec: fix compiler warning for uninitialized variables id3v2: fix compiler warning for uninitialized variables mov: remove unused function mov_read_chan2 movenc: remove unused variables mxg: fix compiler warning for uninitialized variables rtsp: fix compiler warning for uninitialized variables mpegts: remove unused variable libavcodec/8svx.c | 1 - libavdevice/lavfi.c | 3 ++- libavformat/cache.c | 3 +-- libavformat/flvdec.c | 3 ++- libavformat/id3v2.c | 2 +- libavformat/mov.c | 9 --------- libavformat/movenc.c | 2 -- libavformat/mpegts.c | 2 +- libavformat/mxg.c | 2 +- libavformat/rmdec.c | 5 +++-- libavformat/rtsp.c | 2 +- 11 files changed, 12 insertions(+), 22 deletions(-) -- 1.7.7.3
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavcodec/8svx.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c index b4fc899..a91f001 100644 --- a/libavcodec/8svx.c +++ b/libavcodec/8svx.c @@ -106,7 +106,6 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, { EightSvxContext *esc = avctx->priv_data; int n, out_data_size, ret; - uint8_t *out_date; uint8_t *src, *dst; /* decode and interleave the first packet */ -- 1.7.7.3
On Fri, Dec 30, 2011 at 09:07:58PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavcodec/8svx.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
applied, thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavdevice/lavfi.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 4f91a4b..de3731a 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -270,7 +270,8 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt) int stream_idx, min_pts_sink_idx = 0; AVFilterBufferRef *ref; AVPicture pict; - int ret, i, size; + int ret, i; + int size = 0; /* iterate through all the graph sinks. Select the sink with the * minimum PTS */ -- 1.7.7.3
On date Friday 2011-12-30 21:07:59 +0100, Jean First encoded:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavdevice/lavfi.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 4f91a4b..de3731a 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -270,7 +270,8 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt) int stream_idx, min_pts_sink_idx = 0; AVFilterBufferRef *ref; AVPicture pict; - int ret, i, size; + int ret, i; + int size = 0;
/* iterate through all the graph sinks. Select the sink with the * minimum PTS */
Pushed, thanks. -- FFmpeg = Frightening & Fiendish Minimalistic Powerful Experimenting Gangster
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/cache.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/libavformat/cache.c b/libavformat/cache.c index d94cf5f..e098a31 100644 --- a/libavformat/cache.c +++ b/libavformat/cache.c @@ -51,7 +51,6 @@ typedef struct Context { static int cache_open(URLContext *h, const char *arg, int flags) { - int access; const char *buffername; Context *c= h->priv_data; -- 1.7.7.3
On Fri, Dec 30, 2011 at 09:08:00PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/cache.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
applied, thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/cache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavformat/cache.c b/libavformat/cache.c index e098a31..3e60aea 100644 --- a/libavformat/cache.c +++ b/libavformat/cache.c @@ -63,7 +63,7 @@ static int cache_open(URLContext *h, const char *arg, int flags) } unlink(buffername); - av_free(buffername); + av_freep(&buffername); return ffurl_open(&c->inner, arg, flags, &h->interrupt_callback, NULL); } -- 1.7.7.3
On Fri, Dec 30, 2011 at 09:08:01PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/cache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
applied, thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/flvdec.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 57ef061..3b1ab93 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -453,7 +453,8 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int stream_type=-1; int64_t next, pos; int64_t dts, pts = AV_NOPTS_VALUE; - int sample_rate, channels; + int sample_rate = 0; + int channels = 0; AVStream *st = NULL; for(;;avio_skip(s->pb, 4)){ /* pkt size is repeated at end. skip it */ -- 1.7.7.3
On Fri, Dec 30, 2011 at 09:08:02PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/flvdec.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 57ef061..3b1ab93 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -453,7 +453,8 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int stream_type=-1; int64_t next, pos; int64_t dts, pts = AV_NOPTS_VALUE; - int sample_rate, channels; + int sample_rate = 0; + int channels = 0;
av_unused may be the better choice. with = 0 and no comment the reader wont know if its used or not [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/flvdec.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 1fdcc4d..7705c48 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -452,7 +452,8 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int stream_type=-1; int64_t next, pos; int64_t dts, pts = AV_NOPTS_VALUE; - int sample_rate, channels; + int av_uninit(channels); + int av_uninit(sample_rate); AVStream *st = NULL; for(;;avio_skip(s->pb, 4)){ /* pkt size is repeated at end. skip it */ -- 1.7.7.3
On Sun, Jan 01, 2012 at 11:59:00PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/flvdec.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
applied, thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Its not that you shouldnt use gotos but rather that you should write readable code and code with gotos often but not always is less readable
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/id3v2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 9ee3271..250281c 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -437,7 +437,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t AVIOContext *pbx; unsigned char *buffer = NULL; int buffer_size = 0; - const ID3v2EMFunc *extra_func; + const ID3v2EMFunc *extra_func = NULL; unsigned char *compressed_buffer = NULL; int compressed_buffer_size = 0; -- 1.7.7.3
On Fri, Dec 30, 2011 at 09:08:03PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/id3v2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
applied, thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/mov.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 9f1e028..0e03a8f 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2434,15 +2434,6 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom) -{ - if (atom.size < 16) - return 0; - avio_skip(pb, 4); - ff_mov_read_chan(c->fc, atom.size - 4, c->fc->streams[0]->codec); - return 0; -} - static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('a','v','s','s'), mov_read_avss }, { MKTAG('c','h','p','l'), mov_read_chpl }, -- 1.7.7.3
On Fri, Dec 30, 2011 at 09:08:04PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/mov.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-)
carl? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire
Jean First <jeanfirst <at> gmail.com> writes:
-static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom)
Afaict, the new function is completely broken, I just had not time yet to look at this. So, please leave this function in the file. Thank you, Carl Eugen
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/movenc.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index da22c4e..e5f0c4c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2024,7 +2024,6 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, static int mov_write_mfhd_tag(AVIOContext *pb, MOVMuxContext *mov) { - int i; int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size placeholder*/ ffio_wfourcc(pb, "mfhd"); @@ -2600,7 +2599,6 @@ static int update_first_fragment(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; AVIOContext *pb = s->pb; - int res = 0; int i; int64_t moov_pos = avio_tell(pb); -- 1.7.7.3
On Fri, Dec 30, 2011 at 09:08:05PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com>
applied, thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB You can kill me, but you cannot change the truth.
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/mxg.c | 2 +- libavformat/rmdec.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/mxg.c b/libavformat/mxg.c index b249f67..af27910 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -98,7 +98,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size) { MXGContext *mxg = s->priv_data; unsigned int current_pos = mxg->buffer_ptr - mxg->buffer; - unsigned int soi_pos; + unsigned int soi_pos = 0; int ret; /* reallocate internal buffer */ diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 7524023..58a9857 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -602,7 +602,8 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt, int len, int *pseq, int64_t *timestamp) { - int hdr, seq, pic_num, len2, pos; + int hdr; + int seq = 0, pic_num = 0, len2 = 0, pos = 0; int type; hdr = avio_r8(pb); len--; @@ -844,7 +845,7 @@ ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb, static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) { RMDemuxContext *rm = s->priv_data; - AVStream *st; + AVStream *st = NULL; int i, len, res, seq = 1; int64_t timestamp, pos; int flags; -- 1.7.7.3
On 30 Dec 2011, at 21:08, Jean First <jeanfirst@gmail.com> wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/mxg.c | 2 +- libavformat/rmdec.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
I don't think the rmdec changes belong in this patch for mxg. Also the rmdec changes I am not sure wether they might be performance relevant. Since the compiler probably complains incorrectly about them we should not accept a performance penalty for fixing it.
Sorry for the mixup. Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/mxg.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavformat/mxg.c b/libavformat/mxg.c index b249f67..af27910 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -98,7 +98,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size) { MXGContext *mxg = s->priv_data; unsigned int current_pos = mxg->buffer_ptr - mxg->buffer; - unsigned int soi_pos; + unsigned int soi_pos = 0; int ret; /* reallocate internal buffer */ -- 1.7.7.3
On Sat, Dec 31, 2011 at 02:14:21PM +0100, Jean First wrote:
Sorry for the mixup.
Signed-off-by: Jean First <jeanfirst@gmail.com>
fixed differently Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle
I let you decide if it is performance relevant or not. Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/rmdec.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 7524023..58a9857 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -602,7 +602,8 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt, int len, int *pseq, int64_t *timestamp) { - int hdr, seq, pic_num, len2, pos; + int hdr; + int seq = 0, pic_num = 0, len2 = 0, pos = 0; int type; hdr = avio_r8(pb); len--; @@ -844,7 +845,7 @@ ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb, static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) { RMDemuxContext *rm = s->priv_data; - AVStream *st; + AVStream *st = NULL; int i, len, res, seq = 1; int64_t timestamp, pos; int flags; -- 1.7.7.3
On Sat, Dec 31, 2011 at 02:15:35PM +0100, Jean First wrote:
I let you decide if it is performance relevant or not.
Signed-off-by: Jean First <jeanfirst@gmail.com>
applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/rtsp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 5d6db1b..d32f49e 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1103,7 +1103,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge) { RTSPState *rt = s->priv_data; - int rtx, j, i, err, interleave = 0; + int rtx = 0, j, i, err, interleave = 0; RTSPStream *rtsp_st; RTSPMessageHeader reply1, *reply = &reply1; char cmd[2048]; -- 1.7.7.3
On Fri, Dec 30, 2011 at 09:08:07PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/rtsp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 5d6db1b..d32f49e 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1103,7 +1103,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge) { RTSPState *rt = s->priv_data; - int rtx, j, i, err, interleave = 0; + int rtx = 0, j, i, err, interleave = 0; RTSPStream *rtsp_st; RTSPMessageHeader reply1, *reply = &reply1; char cmd[2048];
i think its ok, maybe ronald or martin want to comment too though ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides
On Sat, 31 Dec 2011, Michael Niedermayer wrote:
On Fri, Dec 30, 2011 at 09:08:07PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/rtsp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 5d6db1b..d32f49e 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1103,7 +1103,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge) { RTSPState *rt = s->priv_data; - int rtx, j, i, err, interleave = 0; + int rtx = 0, j, i, err, interleave = 0; RTSPStream *rtsp_st; RTSPMessageHeader reply1, *reply = &reply1; char cmd[2048];
i think its ok, maybe ronald or martin want to comment too though ?
As far as I know this code, the variable won't ever be used uninitialized, but silencing the warning is of course good. I don't mind either zero initialization or av_uninit (this isn't even remotely performance sensitive). // Martin
Martin Storsjö <martin <at> martin.st> writes:
- int rtx, j, i, err, interleave = 0; + int rtx = 0, j, i, err, interleave = 0;
As far as I know this code, the variable won't ever be used uninitialized, but silencing the warning is of course good.
Patch applied. Thank you both, Carl Eugen
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/mpegts.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 3f15479..8c1c557 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2132,7 +2132,7 @@ static int64_t mpegts_get_dts(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit) { MpegTSContext *ts = s->priv_data; - int64_t pos, timestamp; + int64_t pos; pos = ((*ppos + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47; ff_read_frame_flush(s); if (avio_seek(s->pb, pos, SEEK_SET) < 0) -- 1.7.7.3
On Fri, Dec 30, 2011 at 09:08:08PM +0100, Jean First wrote:
Signed-off-by: Jean First <jeanfirst@gmail.com> --- libavformat/mpegts.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
applied, thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato
Le decadi 10 nivôse, an CCXX, Jean First a écrit :
Jean First (11): 8svx: remove unused variable in eightsvx_decode_frame lavfi: fix compiler warning for uninitialized variables cache: remove unused variable in cache_open cache: use av_freep instead of av_free in cache_open flvdec: fix compiler warning for uninitialized variables id3v2: fix compiler warning for uninitialized variables mov: remove unused function mov_read_chan2 movenc: remove unused variables mxg: fix compiler warning for uninitialized variables rtsp: fix compiler warning for uninitialized variables mpegts: remove unused variable
Assuming everything has been tested, all these patches seem quite straightforward and correct, and I am all for them. Thanks. Regards, -- Nicolas George
participants (7)
-
Carl Eugen Hoyos -
Jean First -
Martin Storsjö -
Michael Niedermayer -
Nicolas George -
Reimar Döffinger -
Stefano Sabatini