diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-15 20:33:21 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-15 21:00:50 +0200 |
commit | fb33bff990a8327f59d4c7c509bba1f62bbd6c5a (patch) | |
tree | c6f3ad232bed67c703999d78b3fcff66daa8c91d /libavcodec | |
parent | 3bb22973518cbef28504e4d5b9fd74453cc3339c (diff) | |
parent | f929ab0569ff31ed5a59b0b0adb7ce09df3fca39 (diff) | |
download | ffmpeg-fb33bff990a8327f59d4c7c509bba1f62bbd6c5a.tar.gz |
Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'
* commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39':
cosmetics: Write NULL pointer equality checks more compactly
Conflicts:
cmdutils.c
ffmpeg_opt.c
ffplay.c
libavcodec/dvbsub.c
libavcodec/dvdsubdec.c
libavcodec/dvdsubenc.c
libavcodec/dxa.c
libavcodec/libxvid_rc.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo_enc.c
libavcodec/rv10.c
libavcodec/tiffenc.c
libavcodec/utils.c
libavcodec/vc1dec.c
libavcodec/zmbv.c
libavdevice/v4l2.c
libavformat/matroskadec.c
libavformat/movenc.c
libavformat/sdp.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
35 files changed, 57 insertions, 59 deletions
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 435f1ac99e..d1dfa6b0ed 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -888,7 +888,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) + FF_INPUT_BUFFER_PADDING_SIZE); - if (q->decoded_bytes_buffer == NULL) + if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 5860288e04..eb2654e0d5 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1239,7 +1239,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) av_mallocz(avctx->block_align + DECODE_BYTES_PAD1(avctx->block_align) + FF_INPUT_BUFFER_PADDING_SIZE); - if (q->decoded_bytes_buffer == NULL) + if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); /* Initialize transform. */ diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c index f6b46e64a9..dd84a07664 100644 --- a/libavcodec/dvbsub.c +++ b/libavcodec/dvbsub.c @@ -258,7 +258,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s, page_id = 1; - if (h->num_rects && h->rects == NULL) + if (h->num_rects && !h->rects) return -1; /* page composition segment */ diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 2b363d02d9..e198a6c9a0 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -195,7 +195,7 @@ static void reset_rects(AVSubtitle *sub_header) { int i; - if (sub_header->rects != NULL) { + if (sub_header->rects) { for (i = 0; i < sub_header->num_rects; i++) { av_freep(&sub_header->rects[i]->pict.data[0]); av_freep(&sub_header->rects[i]->pict.data[1]); @@ -414,7 +414,7 @@ static int find_smallest_bounding_rectangle(AVSubtitle *s) int y1, y2, x1, x2, y, w, h, i; uint8_t *bitmap; - if (s->num_rects == 0 || s->rects == NULL || s->rects[0]->w <= 0 || s->rects[0]->h <= 0) + if (s->num_rects == 0 || !s->rects || s->rects[0]->w <= 0 || s->rects[0]->h <= 0) return 0; for(i = 0; i < s->rects[0]->nb_colors; i++) { diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index ced09dd5e3..425f0af9ee 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -264,7 +264,7 @@ static int encode_dvd_subtitles(AVCodecContext *avctx, int x2, y2; int forced = 0; - if (rects == 0 || h->rects == NULL) + if (rects == 0 || !h->rects) return AVERROR(EINVAL); for (i = 0; i < rects; i++) if (h->rects[i]->type != SUBTITLE_BITMAP) { diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 0e1161453b..ff6f0436e3 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -502,7 +502,7 @@ retry: if ((ret = ff_mpv_common_init(s)) < 0) return ret; - if (s->current_picture_ptr == NULL || s->current_picture_ptr->f->data[0]) { + if (!s->current_picture_ptr || s->current_picture_ptr->f->data[0]) { int i = ff_find_unused_picture(s, 0); if (i < 0) return i; @@ -546,7 +546,7 @@ retry: s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; /* skip B-frames if we don't have reference frames */ - if (s->last_picture_ptr == NULL && + if (!s->last_picture_ptr && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) return get_consumed_bytes(s, buf_size); if ((avctx->skip_frame >= AVDISCARD_NONREF && diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 76161e9730..389307b569 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -299,7 +299,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, av_fast_padded_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+MAX_MBPAIR_SIZE); dst = h->rbsp_buffer[bufidx]; - if (dst == NULL) + if (!dst) return NULL; if(i>=length-1){ //no escaped 0 @@ -1417,7 +1417,7 @@ static int get_last_needed_nal(H264Context *h, const uint8_t *buf, int buf_size) ptr = ff_h264_decode_nal(h, buf + buf_index, &dst_length, &consumed, next_avc - buf_index); - if (ptr == NULL || dst_length < 0) + if (!ptr || dst_length < 0) return AVERROR_INVALIDDATA; buf_index += consumed; @@ -1516,7 +1516,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, ptr = ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, next_avc - buf_index); - if (ptr == NULL || dst_length < 0) { + if (!ptr || dst_length < 0) { ret = -1; goto end; } diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 1d4c2cfaee..36cf980c8e 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -262,7 +262,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, break; } ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); - if (ptr == NULL || dst_length < 0) + if (!ptr || dst_length < 0) break; init_get_bits(&h->gb, ptr, 8 * dst_length); diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 9707332892..20136704d4 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -619,7 +619,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length) return AVERROR(ENOMEM); pps->sps_id = get_ue_golomb_31(&h->gb); if ((unsigned)pps->sps_id >= MAX_SPS_COUNT || - h->sps_buffers[pps->sps_id] == NULL) { + !h->sps_buffers[pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "sps_id %u out of range\n", pps->sps_id); goto fail; } diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index de1f60a41f..0c7a7894fd 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -811,7 +811,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb, (h->max_pic_num - 1); #if 0 if (mmco[i].short_pic_num >= h->short_ref_count || - h->short_ref[ mmco[i].short_pic_num ] == NULL){ + !h->short_ref[ mmco[i].short_pic_num ]) { av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control " "operation %d\n", mmco); diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 06e99bc6d9..e4e5ea04bc 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -800,7 +800,7 @@ static void draw_slice(HYuvContext *s, AVFrame *frame, int y) int h, cy, i; int offset[AV_NUM_DATA_POINTERS]; - if (s->avctx->draw_horiz_band == NULL) + if (!s->avctx->draw_horiz_band) return; h = y - s->last_slice_end; diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c index 542fefe146..0f6c4e2339 100644 --- a/libavcodec/interplayvideo.c +++ b/libavcodec/interplayvideo.c @@ -79,7 +79,7 @@ static int copy_from(IpvideoContext *s, AVFrame *src, AVFrame *dst, int delta_x, motion_offset, s->upper_motion_limit_offset); return AVERROR_INVALIDDATA; } - if (src->data[0] == NULL) { + if (!src->data[0]) { av_log(s->avctx, AV_LOG_ERROR, "Invalid decode type, corrupted header?\n"); return AVERROR(EINVAL); } diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c index 60069d49c5..491a0e9d02 100644 --- a/libavcodec/lcldec.c +++ b/libavcodec/lcldec.c @@ -593,7 +593,7 @@ static av_cold int decode_init(AVCodecContext *avctx) /* Allocate decompression buffer */ if (c->decomp_size) { - if ((c->decomp_buf = av_malloc(max_decomp_size)) == NULL) { + if (!(c->decomp_buf = av_malloc(max_decomp_size))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return AVERROR(ENOMEM); } diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index fed82e271e..1ac79a2ed9 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -94,7 +94,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx) s->avctx = avctx; /* initialize LAME and get defaults */ - if ((s->gfp = lame_init()) == NULL) + if (!(s->gfp = lame_init())) return AVERROR(ENOMEM); diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c index 8ceb877f38..75e82dac0d 100644 --- a/libavcodec/libopusenc.c +++ b/libavcodec/libopusenc.c @@ -366,7 +366,7 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt, uint8_t* side_data = av_packet_new_side_data(avpkt, AV_PKT_DATA_SKIP_SAMPLES, 10); - if(side_data == NULL) { + if(!side_data) { av_free_packet(avpkt); av_free(avpkt); return AVERROR(ENOMEM); diff --git a/libavcodec/libstagefright.cpp b/libavcodec/libstagefright.cpp index 346cc9ce60..44d7ea1492 100644 --- a/libavcodec/libstagefright.cpp +++ b/libavcodec/libstagefright.cpp @@ -280,7 +280,7 @@ static av_cold int Stagefright_init(AVCodecContext *avctx) memcpy(s->orig_extradata, avctx->extradata, avctx->extradata_size); meta = new MetaData; - if (meta == NULL) { + if (!meta) { ret = AVERROR(ENOMEM); goto fail; } diff --git a/libavcodec/libutvideoenc.cpp b/libavcodec/libutvideoenc.cpp index f0d56194b4..3298e64350 100644 --- a/libavcodec/libutvideoenc.cpp +++ b/libavcodec/libutvideoenc.cpp @@ -85,7 +85,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) /* Alloc extradata buffer */ info = (UtVideoExtra *)av_malloc(sizeof(*info)); - if (info == NULL) { + if (!info) { av_log(avctx, AV_LOG_ERROR, "Could not allocate extradata buffer.\n"); return AVERROR(ENOMEM); } diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 3dddffd88e..f8a65fbb66 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -542,7 +542,7 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, cx_frame->sz_alpha + 8); - if(side_data == NULL) { + if(!side_data) { av_free_packet(pkt); av_free(pkt); return AVERROR(ENOMEM); diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c index b521e010e3..a97d53c60a 100644 --- a/libavcodec/libxvid.c +++ b/libavcodec/libxvid.c @@ -110,7 +110,7 @@ static int xvid_ff_2pass_create(xvid_plg_create_t * param, char *log = x->context->twopassbuffer; /* Do a quick bounds check */ - if( log == NULL ) + if (!log) return XVID_ERR_FAIL; /* We use snprintf() */ @@ -201,7 +201,7 @@ static int xvid_ff_2pass_after(struct xvid_context *ref, char frame_type; /* Quick bounds check */ - if( log == NULL ) + if (!log) return XVID_ERR_FAIL; /* Convert the type given to us into a character */ @@ -285,7 +285,7 @@ static int xvid_strip_vol_header(AVCodecContext *avctx, if( vo_len > 0 ) { /* We need to store the header, so extract it */ - if( avctx->extradata == NULL ) { + if (!avctx->extradata) { avctx->extradata = av_malloc(vo_len); memcpy(avctx->extradata, pkt->data, vo_len); avctx->extradata_size = vo_len; @@ -483,7 +483,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { rc2pass1.context = x; x->twopassbuffer = av_malloc(BUFFER_SIZE); x->old_twopassbuffer = av_malloc(BUFFER_SIZE); - if( x->twopassbuffer == NULL || x->old_twopassbuffer == NULL ) { + if (!x->twopassbuffer || !x->old_twopassbuffer) { av_log(avctx, AV_LOG_ERROR, "Xvid: Cannot allocate 2-pass log buffers\n"); goto fail; @@ -505,7 +505,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { } x->twopassfd = fd; - if( avctx->stats_in == NULL ) { + if (!avctx->stats_in) { av_log(avctx, AV_LOG_ERROR, "Xvid: No 2-pass information loaded for second pass\n"); goto fail; diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 0eeb2aa176..81ee2bd6b3 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -1753,7 +1753,7 @@ void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_ int xy= y*s->mb_stride; for(x=0; x<s->mb_width; x++){ if (s->mb_type[xy] & type){ // RAL: "type" test added... - if(field_select_table==NULL || field_select_table[xy] == field_select){ + if (!field_select_table || field_select_table[xy] == field_select) { if( mv_table[xy][0] >=h_range || mv_table[xy][0] <-h_range || mv_table[xy][1] >=v_range || mv_table[xy][1] <-v_range){ diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 49a6ab3b41..b9c435dcb8 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2597,7 +2597,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, return -1; } - if (s2->last_picture_ptr == NULL) { + if (!s2->last_picture_ptr) { /* Skip B-frames if we do not have reference frames and * GOP is not closed. */ if (s2->pict_type == AV_PICTURE_TYPE_B) { @@ -2609,7 +2609,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, } if (s2->pict_type == AV_PICTURE_TYPE_I || (s2->flags2 & CODEC_FLAG2_SHOW_ALL)) s->sync = 1; - if (s2->next_picture_ptr == NULL) { + if (!s2->next_picture_ptr) { /* Skip P-frames if we do not have a reference frame or * we have an invalid header. */ if (s2->pict_type == AV_PICTURE_TYPE_P && !s->sync) { diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index 05237070ea..e2523b49ca 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -1831,7 +1831,7 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx) MPEG4AudioConfig cfg; int i; - if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) { + if ((avctx->extradata_size < 2) || !avctx->extradata) { av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n"); return AVERROR_INVALIDDATA; } diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 119aae2e82..ed4ca3561d 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -870,7 +870,7 @@ fail: static void free_duplicate_context(MpegEncContext *s) { - if (s == NULL) + if (!s) return; av_freep(&s->edge_emu_buffer); @@ -1671,7 +1671,7 @@ static inline int pic_is_unused(MpegEncContext *s, Picture *pic) { if (pic == s->last_picture_ptr) return 0; - if (pic->f->buf[0] == NULL) + if (!pic->f->buf[0]) return 1; if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF)) return 1; @@ -1684,7 +1684,7 @@ static int find_unused_picture(MpegEncContext *s, int shared) if (shared) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { - if (s->picture[i].f->buf[0] == NULL && &s->picture[i] != s->last_picture_ptr) + if (!s->picture[i].f->buf[0] && &s->picture[i] != s->last_picture_ptr) return i; } } else { @@ -1780,8 +1780,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) release_unused_pictures(s); - if (s->current_picture_ptr && - s->current_picture_ptr->f->buf[0] == NULL) { + if (s->current_picture_ptr && !s->current_picture_ptr->f->buf[0]) { // we already have a unused image // (maybe it was set before reading the header) pic = s->current_picture_ptr; @@ -1839,8 +1838,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) s->current_picture_ptr ? s->current_picture_ptr->f->data[0] : NULL, s->pict_type, s->droppable); - if ((s->last_picture_ptr == NULL || - s->last_picture_ptr->f->buf[0] == NULL) && + if ((!s->last_picture_ptr || !s->last_picture_ptr->f->buf[0]) && (s->pict_type != AV_PICTURE_TYPE_I || s->picture_structure != PICT_FRAME)) { int h_chroma_shift, v_chroma_shift; @@ -1893,8 +1891,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 1); } - if ((s->next_picture_ptr == NULL || - s->next_picture_ptr->f->buf[0] == NULL) && + if ((!s->next_picture_ptr || !s->next_picture_ptr->f->buf[0]) && s->pict_type == AV_PICTURE_TYPE_B) { /* Allocate a dummy frame */ i = ff_find_unused_picture(s, 0); @@ -3240,7 +3237,7 @@ void ff_mpeg_flush(AVCodecContext *avctx){ int i; MpegEncContext *s = avctx->priv_data; - if(s==NULL || s->picture==NULL) + if (!s || !s->picture) return; for (i = 0; i < MAX_PICTURE_COUNT; i++) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index ffcd9da36c..f5427df0c9 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1379,7 +1379,7 @@ static int select_input_picture(MpegEncContext *s) s->reordered_input_picture[MAX_PICTURE_COUNT - 1] = NULL; /* set next picture type & ordering */ - if (s->reordered_input_picture[0] == NULL && s->input_picture[0]) { + if (!s->reordered_input_picture[0] && s->input_picture[0]) { if (s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor) { if (s->picture_in_gop_number < s->gop_size && s->next_picture_ptr && @@ -1394,7 +1394,7 @@ static int select_input_picture(MpegEncContext *s) } if (/*s->picture_in_gop_number >= s->gop_size ||*/ - s->next_picture_ptr == NULL || s->intra_only) { + !s->next_picture_ptr || s->intra_only) { s->reordered_input_picture[0] = s->input_picture[0]; s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I; s->reordered_input_picture[0]->f->coded_picture_number = @@ -1434,7 +1434,7 @@ static int select_input_picture(MpegEncContext *s) } } for (i = 0; i < s->max_b_frames + 1; i++) { - if (s->input_picture[i] == NULL || + if (!s->input_picture[i] || s->input_picture[i]->b_frame_score - 1 > s->mb_num / s->avctx->b_sensitivity) break; diff --git a/libavcodec/options.c b/libavcodec/options.c index 64b27e5768..ec9830face 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -144,7 +144,8 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) { AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); - if(avctx==NULL) return NULL; + if (!avctx) + return NULL; if(avcodec_get_context_defaults3(avctx, codec) < 0){ av_free(avctx); diff --git a/libavcodec/opus_celt.c b/libavcodec/opus_celt.c index fad471beb6..e8a8de7f45 100644 --- a/libavcodec/opus_celt.c +++ b/libavcodec/opus_celt.c @@ -1608,7 +1608,7 @@ static unsigned int celt_decode_band(CeltContext *s, OpusRangeCoder *rc, for (j = 0; j < N; j++) X[j] = 0.0f; } else { - if (lowband == NULL) { + if (!lowband) { /* Noise */ for (j = 0; j < N; j++) X[j] = (((int32_t)celt_rng(s)) >> 20); diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index bf830db940..2def546988 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -1506,7 +1506,7 @@ static void qdm2_decode_fft_packets(QDM2Context *q) int i, j, min, max, value, type, unknown_flag; GetBitContext gb; - if (q->sub_packet_list_B[0].packet == NULL) + if (!q->sub_packet_list_B[0].packet) return; /* reset minimum indexes for FFT coefficients */ diff --git a/libavcodec/roqvideo.c b/libavcodec/roqvideo.c index eb8fc253ad..8eda93c13c 100644 --- a/libavcodec/roqvideo.c +++ b/libavcodec/roqvideo.c @@ -115,7 +115,7 @@ static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax return; } - if (ri->last_frame->data[0] == NULL) { + if (!ri->last_frame->data[0]) { av_log(ri->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n"); return; } diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 7bec038a9b..251823d453 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -330,7 +330,7 @@ static int rv20_decode_picture_header(RVDecContext *rv) av_log(s->avctx, AV_LOG_ERROR, "low delay B\n"); return -1; } - if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B) { + if (!s->last_picture_ptr && s->pict_type == AV_PICTURE_TYPE_B) { av_log(s->avctx, AV_LOG_ERROR, "early B-frame\n"); return AVERROR_INVALIDDATA; } @@ -577,7 +577,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, return AVERROR_INVALIDDATA; } - if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr == NULL) { + if ((s->mb_x == 0 && s->mb_y == 0) || !s->current_picture_ptr) { // FIXME write parser so we always have complete frames? if (s->current_picture_ptr) { ff_er_frame_end(&s->er); diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c index a7a0c2ecaf..628a6b3c36 100644 --- a/libavcodec/tscc.c +++ b/libavcodec/tscc.c @@ -143,7 +143,7 @@ static av_cold int decode_init(AVCodecContext *avctx) /* Allocate decompression buffer */ if (c->decomp_size) { - if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) { + if (!(c->decomp_buf = av_malloc(c->decomp_size))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return AVERROR(ENOMEM); } diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index e1d8ca6ed5..7b7de45b45 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -6023,7 +6023,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; /* skip B-frames if we don't have reference frames */ - if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) { + if (!s->last_picture_ptr && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) { av_log(v->s.avctx, AV_LOG_DEBUG, "Skipping B frame without reference frames\n"); goto end; } diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 3f04d8f258..bd1afc02ef 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1429,7 +1429,7 @@ static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y) 0); } - if (s->avctx->draw_horiz_band == NULL) + if (!s->avctx->draw_horiz_band) return; h = y - s->last_slice_end; diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 60accf6348..d72fb57311 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -2238,7 +2238,7 @@ static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *cur_frame, int pos = (mb_y << 16) | (mb_x & 0xFFFF); \ int sliced_threading = (avctx->active_thread_type == FF_THREAD_SLICE) && \ (num_jobs > 1); \ - int is_null = (next_td == NULL) || (prev_td == NULL); \ + int is_null = !next_td || !prev_td; \ int pos_check = (is_null) ? 1 \ : (next_td != td && \ pos >= next_td->wait_mb_pos) || \ diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index 21a9e35c39..c16d912117 100644 --- a/libavcodec/zmbv.c +++ b/libavcodec/zmbv.c @@ -500,7 +500,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac c->decode_intra= decode_intra; } - if (c->decode_intra == NULL) { + if (!c->decode_intra) { av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n"); return AVERROR_INVALIDDATA; } @@ -588,7 +588,7 @@ static av_cold int decode_init(AVCodecContext *avctx) /* Allocate decompression buffer */ if (c->decomp_size) { - if ((c->decomp_buf = av_mallocz(c->decomp_size)) == NULL) { + if (!(c->decomp_buf = av_mallocz(c->decomp_size))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return AVERROR(ENOMEM); diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c index 28dbe20f06..2d56a13e01 100644 --- a/libavcodec/zmbvenc.c +++ b/libavcodec/zmbvenc.c @@ -296,7 +296,7 @@ static av_cold int encode_init(AVCodecContext *avctx) memset(&c->zstream, 0, sizeof(z_stream)); c->comp_size = avctx->width * avctx->height + 1024 + ((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4; - if ((c->work_buf = av_malloc(c->comp_size)) == NULL) { + if (!(c->work_buf = av_malloc(c->comp_size))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n"); return AVERROR(ENOMEM); } @@ -305,12 +305,12 @@ static av_cold int encode_init(AVCodecContext *avctx) ((c->comp_size + 63) >> 6) + 11; /* Allocate compression buffer */ - if ((c->comp_buf = av_malloc(c->comp_size)) == NULL) { + if (!(c->comp_buf = av_malloc(c->comp_size))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n"); return AVERROR(ENOMEM); } c->pstride = FFALIGN(avctx->width, 16); - if ((c->prev = av_malloc(c->pstride * avctx->height)) == NULL) { + if (!(c->prev = av_malloc(c->pstride * avctx->height))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n"); return AVERROR(ENOMEM); } |