[FFmpeg-devel] [PATCH] all: use { 0 } for zero initializing compound data structures
Ganesh Ajjanagadde
gajjanagadde at gmail.com
Fri Aug 21 04:19:51 CEST 2015
C Standard guarantees that { 0 } will do a correct zero initialization.
We use this for consistency across the project.
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
ffplay.c | 2 +-
ffserver.c | 2 +-
libavcodec/aacdec_template.c | 2 +-
libavcodec/aacpsy.c | 4 ++--
libavcodec/alsdec.c | 2 +-
libavcodec/dct-test.c | 4 ++--
libavcodec/error_resilience.c | 2 +-
libavcodec/escape124.c | 2 +-
libavcodec/hevc_mvs.c | 2 +-
libavcodec/hevc_refs.c | 2 +-
libavcodec/intrax8dsp.c | 4 ++--
libavcodec/libvo-aacenc.c | 2 +-
libavcodec/qsvdec.c | 6 +++---
libavcodec/smacker.c | 6 +++---
libavformat/mpegts.c | 4 ++--
libavformat/rtsp.c | 2 +-
16 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/ffplay.c b/ffplay.c
index cde88db..7a00c84 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1661,7 +1661,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, double
/* if the frame is not skipped, then display it */
if (vp->bmp) {
- AVPicture pict = { { 0 } };
+ AVPicture pict = { 0 };
/* get a pointer on the bitmap */
SDL_LockYUVOverlay (vp->bmp);
diff --git a/ffserver.c b/ffserver.c
index 8b6e441..cefa91e 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -3814,7 +3814,7 @@ static const OptionDef options[] = {
int main(int argc, char **argv)
{
- struct sigaction sigact = { { 0 } };
+ struct sigaction sigact = { 0 };
int ret = 0;
config.filename = av_strdup("/etc/ffserver.conf");
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index c2d7d05..19b903e 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -258,7 +258,7 @@ static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos,
static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
{
int i, n, total_non_cc_elements;
- struct elem_to_channel e2c_vec[4 * MAX_ELEM_ID] = { { 0 } };
+ struct elem_to_channel e2c_vec[4 * MAX_ELEM_ID] = { 0 };
int num_front_channels, num_side_channels, num_back_channels;
uint64_t layout;
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 82b670d..13f0959 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -403,7 +403,7 @@ static av_unused FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx,
AacPsyChannel *pch = &pctx->ch[channel];
uint8_t grouping = 0;
int next_type = pch->next_window_seq;
- FFPsyWindowInfo wi = { { 0 } };
+ FFPsyWindowInfo wi = { 0 };
if (la) {
float s[8], v;
@@ -839,7 +839,7 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
float clippings[AAC_NUM_BLOCKS_SHORT];
int i;
- FFPsyWindowInfo wi = { { 0 } };
+ FFPsyWindowInfo wi = { 0 };
if (la) {
float hpfsmpl[AAC_BLOCK_SIZE_LONG];
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index ebd364e..928d716 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1107,7 +1107,7 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
unsigned int offset = 0;
unsigned int b;
int ret;
- ALSBlockData bd[2] = { { 0 } };
+ ALSBlockData bd[2] = { 0 };
bd[0].ra_block = ra_frame;
bd[0].const_block = ctx->const_block;
diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index 56e1a62..f3e278e 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -98,8 +98,8 @@ static const struct algo idct_tab[] = {
#elif ARCH_X86
#include "x86/dct-test.c"
#else
-static const struct algo fdct_tab_arch[] = { { 0 } };
-static const struct algo idct_tab_arch[] = { { 0 } };
+static const struct algo fdct_tab_arch[] = { 0 };
+static const struct algo idct_tab_arch[] = { 0 };
#endif
#define AANSCALE_BITS 12
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 2c741a4..8513168 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -445,7 +445,7 @@ static void guess_mv(ERContext *s)
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
const int mb_xy = mb_x + mb_y * s->mb_stride;
- int mv_predictor[8][2] = { { 0 } };
+ int mv_predictor[8][2] = { 0 };
int ref[8] = { 0 };
int pred_count = 0;
int j;
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index efcac64..4ccde14 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -164,7 +164,7 @@ static MacroBlock decode_macroblock(Escape124Context* s, GetBitContext* gb,
// This condition can occur with invalid bitstreams and
// *codebook_index == 2
if (block_index >= s->codebooks[*codebook_index].size)
- return (MacroBlock) { { 0 } };
+ return (MacroBlock) { 0 };
return s->codebooks[*codebook_index].blocks[block_index];
}
diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c
index 00da575..272159e 100644
--- a/libavcodec/hevc_mvs.c
+++ b/libavcodec/hevc_mvs.c
@@ -602,7 +602,7 @@ void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW,
int xB2, yB2;
int is_available_b2;
- Mv mvpcand_list[2] = { { 0 } };
+ Mv mvpcand_list[2] = { 0 };
Mv mxA;
Mv mxB;
int ref_idx_curr;
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 0c1dbb2..294d3b3 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -314,7 +314,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
}
for (list_idx = 0; list_idx < nb_list; list_idx++) {
- RefPicList rpl_tmp = { { 0 } };
+ RefPicList rpl_tmp = { 0 };
RefPicList *rpl = &s->ref->refPicList[list_idx];
/* The order of the elements is
diff --git a/libavcodec/intrax8dsp.c b/libavcodec/intrax8dsp.c
index 1b34f89..f7e1e0e 100644
--- a/libavcodec/intrax8dsp.c
+++ b/libavcodec/intrax8dsp.c
@@ -153,8 +153,8 @@ static void spatial_compensation_0(uint8_t *src , uint8_t *dst, int linesize){
int x,y;
unsigned int p;//power divided by 2
int a;
- uint16_t left_sum[2][8] = { { 0 } };
- uint16_t top_sum[2][8] = { { 0 } };
+ uint16_t left_sum[2][8] = { 0 };
+ uint16_t top_sum[2][8] = { 0 };
for(i=0;i<8;i++){
a=src[area2+7-i]<<4;
diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c
index 7f21ad2..ba22837 100644
--- a/libavcodec/libvo-aacenc.c
+++ b/libavcodec/libvo-aacenc.c
@@ -125,7 +125,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
{
AACContext *s = avctx->priv_data;
VO_CODECBUFFER input = { 0 }, output = { 0 };
- VO_AUDIO_OUTPUTINFO output_info = { { 0 } };
+ VO_AUDIO_OUTPUTINFO output_info = { 0 };
VO_PBYTE samples;
int ret;
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 1062ef0..0b6e719 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -51,8 +51,8 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format)
int ff_qsv_decode_init(AVCodecContext *avctx, QSVContext *q, AVPacket *avpkt)
{
- mfxVideoParam param = { { 0 } };
- mfxBitstream bs = { { { 0 } } };
+ mfxVideoParam param = { 0 };
+ mfxBitstream bs = { 0 };
int ret;
enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_QSV,
AV_PIX_FMT_NV12,
@@ -289,7 +289,7 @@ int ff_qsv_decode(AVCodecContext *avctx, QSVContext *q,
mfxFrameSurface1 *insurf;
mfxFrameSurface1 *outsurf;
mfxSyncPoint sync;
- mfxBitstream bs = { { { 0 } } };
+ mfxBitstream bs = { 0 };
int ret;
int n_out_frames;
int buffered = 0;
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 6709f97..f7e362e 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -181,7 +181,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
int res;
HuffContext huff;
HuffContext tmp1, tmp2;
- VLC vlc[2] = { { 0 } };
+ VLC vlc[2] = { 0 };
int escapes[3];
DBCtx ctx;
int err = 0;
@@ -625,8 +625,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
GetBitContext gb;
- HuffContext h[4] = { { 0 } };
- VLC vlc[4] = { { 0 } };
+ HuffContext h[4] = { 0 };
+ VLC vlc[4] = { 0 };
int16_t *samples;
uint8_t *samples8;
int val;
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index eac6d9e..eabce35 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1495,7 +1495,7 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section,
const uint8_t *p, *p_end;
AVIOContext pb;
int mp4_descr_count = 0;
- Mp4Descr mp4_descr[MAX_MP4_DESCR_COUNT] = { { 0 } };
+ Mp4Descr mp4_descr[MAX_MP4_DESCR_COUNT] = { 0 };
int i, pid;
AVFormatContext *s = ts->stream;
@@ -1837,7 +1837,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
uint32_t prog_reg_desc = 0; /* registration descriptor */
int mp4_descr_count = 0;
- Mp4Descr mp4_descr[MAX_MP4_DESCR_COUNT] = { { 0 } };
+ Mp4Descr mp4_descr[MAX_MP4_DESCR_COUNT] = { 0 };
int i;
av_log(ts->stream, AV_LOG_TRACE, "PMT: len %i\n", section_len);
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 9aa66d2..1817bf0 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -671,7 +671,7 @@ int ff_sdp_parse(AVFormatContext *s, const char *content)
* The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line
* in rtpdec_xiph.c. */
char buf[16384], *q;
- SDPParseState sdp_parse_state = { { 0 } }, *s1 = &sdp_parse_state;
+ SDPParseState sdp_parse_state = { 0 }, *s1 = &sdp_parse_state;
p = content;
for (;;) {
--
2.5.0
More information about the ffmpeg-devel
mailing list