diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-15 21:21:14 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-15 21:26:12 +0200 |
commit | 60dbed6067676d847157fe530b1caed06c77e2ab (patch) | |
tree | 62d43c9dc8162c8c809cc689f599befb2fdc2bbe | |
parent | fb33bff990a8327f59d4c7c509bba1f62bbd6c5a (diff) | |
parent | 4b1f5e5090abed6c618c8ba380cd7d28d140f867 (diff) | |
download | ffmpeg-60dbed6067676d847157fe530b1caed06c77e2ab.tar.gz |
Merge commit '4b1f5e5090abed6c618c8ba380cd7d28d140f867'
* commit '4b1f5e5090abed6c618c8ba380cd7d28d140f867':
cosmetics: Write NULL pointer inequality checks more compactly
Conflicts:
libavcodec/dvdsubdec.c
libavcodec/h263dec.c
libavcodec/libxvid.c
libavcodec/rv10.c
libavcodec/utils.c
libavformat/format.c
libavformat/matroskadec.c
libavformat/segment.c
libavutil/opt.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | cmdutils.c | 2 | ||||
-rw-r--r-- | libavcodec/h263dec.c | 2 | ||||
-rw-r--r-- | libavcodec/h264_refs.c | 2 | ||||
-rw-r--r-- | libavcodec/libvpxenc.c | 2 | ||||
-rw-r--r-- | libavcodec/libxvid.c | 4 | ||||
-rw-r--r-- | libavcodec/mpeg12dec.c | 2 | ||||
-rw-r--r-- | libavcodec/qdm2.c | 14 | ||||
-rw-r--r-- | libavcodec/rv10.c | 4 | ||||
-rw-r--r-- | libavcodec/rv34.c | 2 | ||||
-rw-r--r-- | libavcodec/utils.c | 2 | ||||
-rw-r--r-- | libavcodec/vc1dec.c | 2 | ||||
-rw-r--r-- | libavformat/avio.c | 2 | ||||
-rw-r--r-- | libavformat/http.c | 2 | ||||
-rw-r--r-- | libavformat/matroskadec.c | 6 | ||||
-rw-r--r-- | libavformat/movenc.c | 2 | ||||
-rw-r--r-- | libavformat/rtmpproto.c | 2 | ||||
-rw-r--r-- | libavformat/tls.c | 2 | ||||
-rw-r--r-- | libavformat/url.c | 2 | ||||
-rw-r--r-- | libavutil/opt.c | 2 | ||||
-rw-r--r-- | tests/audiogen.c | 2 | ||||
-rw-r--r-- | tools/ismindex.c | 2 |
21 files changed, 31 insertions, 31 deletions
diff --git a/cmdutils.c b/cmdutils.c index 3480910338..53444984dd 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -205,7 +205,7 @@ static const OptionDef *find_option(const OptionDef *po, const char *name) const char *p = strchr(name, ':'); int len = p ? p - name : strlen(name); - while (po->name != NULL) { + while (po->name) { if (!strncmp(name, po->name, len) && strlen(po->name) == len) break; po++; diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index ff6f0436e3..9f5500dbab 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -658,7 +658,7 @@ frame_end: return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1); - } else if (s->last_picture_ptr != NULL) { + } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 0c7a7894fd..12da9210be 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 ]) { + !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/libvpxenc.c b/libavcodec/libvpxenc.c index f8a65fbb66..830a793f1e 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -196,7 +196,7 @@ static void coded_frame_add(void *list, struct FrameListData *cx_frame) { struct FrameListData **p = list; - while (*p != NULL) + while (*p) p = &(*p)->next; *p = cx_frame; cx_frame->next = NULL; diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c index a97d53c60a..d415cbf83c 100644 --- a/libavcodec/libxvid.c +++ b/libavcodec/libxvid.c @@ -139,7 +139,7 @@ static int xvid_ff_2pass_destroy(struct xvid_context *ref, xvid_plg_destroy_t *param) { /* Currently cannot think of anything to do on destruction */ /* Still, the framework should be here for reference/use */ - if( ref->twopassbuffer != NULL ) + if (ref->twopassbuffer) ref->twopassbuffer[0] = 0; return 0; } @@ -789,7 +789,7 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx) { x->encoder_handle = NULL; av_freep(&avctx->extradata); - if( x->twopassbuffer != NULL ) { + if (x->twopassbuffer) { av_freep(&x->twopassbuffer); av_freep(&x->old_twopassbuffer); avctx->stats_out = NULL; diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index b9c435dcb8..40aad165da 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2067,7 +2067,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) s->picture_number++; /* latency of 1 frame for I- and P-frames */ /* XXX: use another variable than picture_number */ - if (s->last_picture_ptr != NULL) { + if (s->last_picture_ptr) { int ret = av_frame_ref(pict, s->last_picture_ptr->f); if (ret < 0) return ret; diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 2def546988..339fe4b70a 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -462,7 +462,7 @@ static void qdm2_decode_sub_packet_header(GetBitContext *gb, static QDM2SubPNode *qdm2_search_subpacket_type_in_list(QDM2SubPNode *list, int type) { - while (list != NULL && list->packet != NULL) { + while (list && list->packet) { if (list->packet->type == type) return list; list = list->next; @@ -1248,23 +1248,23 @@ static void process_synthesis_subpackets(QDM2Context *q, QDM2SubPNode *list) QDM2SubPNode *nodes[4]; nodes[0] = qdm2_search_subpacket_type_in_list(list, 9); - if (nodes[0] != NULL) + if (nodes[0]) process_subpacket_9(q, nodes[0]); nodes[1] = qdm2_search_subpacket_type_in_list(list, 10); - if (nodes[1] != NULL) + if (nodes[1]) process_subpacket_10(q, nodes[1]); else process_subpacket_10(q, NULL); nodes[2] = qdm2_search_subpacket_type_in_list(list, 11); - if (nodes[0] != NULL && nodes[1] != NULL && nodes[2] != NULL) + if (nodes[0] && nodes[1] && nodes[2]) process_subpacket_11(q, nodes[2]); else process_subpacket_11(q, NULL); nodes[3] = qdm2_search_subpacket_type_in_list(list, 12); - if (nodes[0] != NULL && nodes[1] != NULL && nodes[3] != NULL) + if (nodes[0] && nodes[1] && nodes[3]) process_subpacket_12(q, nodes[3]); else process_subpacket_12(q, NULL); @@ -1389,7 +1389,7 @@ static void qdm2_decode_super_block(QDM2Context *q) } } // Packet bytes loop - if (q->sub_packet_list_D[0].packet != NULL) { + if (q->sub_packet_list_D[0].packet) { process_synthesis_subpackets(q, q->sub_packet_list_D); q->do_synth_filter = 1; } else if (q->do_synth_filter) { @@ -1987,7 +1987,7 @@ static int qdm2_decode(QDM2Context *q, const uint8_t *in, int16_t *out) for (ch = 0; ch < q->channels; ch++) { qdm2_calculate_fft(q, ch, q->sub_packet); - if (!q->has_errors && q->sub_packet_list_C[0].packet != NULL) { + if (!q->has_errors && q->sub_packet_list_C[0].packet) { SAMPLES_NEEDED_2("has errors, and C list is not empty") return -1; } diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 251823d453..4a5cf41496 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -760,7 +760,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, i++; } - if (s->current_picture_ptr != NULL && s->mb_y >= s->mb_height) { + if (s->current_picture_ptr && s->mb_y >= s->mb_height) { ff_er_frame_end(&s->er); ff_mpv_frame_end(s); @@ -769,7 +769,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1); - } else if (s->last_picture_ptr != NULL) { + } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index d8c5510602..cbefc3a304 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1606,7 +1606,7 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict) ff_print_debug_info(s, s->current_picture_ptr, pict); ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1); got_picture = 1; - } else if (s->last_picture_ptr != NULL) { + } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index b3715a95de..6a40a032e8 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -643,7 +643,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic) FramePool *pool = s->internal->pool; int i; - if (pic->data[0] != NULL) { + if (pic->data[0]) { av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n"); return -1; } diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 7b7de45b45..bcfa4dfc0a 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -6229,7 +6229,7 @@ image: goto err; ff_print_debug_info(s, s->current_picture_ptr, pict); *got_frame = 1; - } else if (s->last_picture_ptr != NULL) { + } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->last_picture_ptr, pict); diff --git a/libavformat/avio.c b/libavformat/avio.c index 307b7036d9..326bb0aa78 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -98,7 +98,7 @@ int ffurl_register_protocol(URLProtocol *protocol) { URLProtocol **p; p = &first_protocol; - while (*p != NULL) + while (*p) p = &(*p)->next; *p = protocol; protocol->next = NULL; diff --git a/libavformat/http.c b/libavformat/http.c index 09b0d6ec07..7480834ec3 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -157,7 +157,7 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) proxy_path = getenv("http_proxy"); use_proxy = !ff_http_match_no_proxy(getenv("no_proxy"), hostname) && - proxy_path != NULL && av_strstart(proxy_path, "http://", NULL); + proxy_path && av_strstart(proxy_path, "http://", NULL); if (!strcmp(proto, "https")) { lower_proto = "tls"; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 2dda729bab..dd1478cbf4 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1748,7 +1748,7 @@ static int matroska_parse_tracks(AVFormatContext *s) if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") && track->codec_priv.size >= 40 && - track->codec_priv.data != NULL) { + track->codec_priv.data) { track->ms_compat = 1; bit_depth = AV_RL16(track->codec_priv.data + 14); fourcc = AV_RL32(track->codec_priv.data + 16); @@ -1760,7 +1760,7 @@ static int matroska_parse_tracks(AVFormatContext *s) extradata_offset = 40; } else if (!strcmp(track->codec_id, "A_MS/ACM") && track->codec_priv.size >= 14 && - track->codec_priv.data != NULL) { + track->codec_priv.data) { int ret; ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, @@ -1781,7 +1781,7 @@ static int matroska_parse_tracks(AVFormatContext *s) } } else if (!strcmp(track->codec_id, "V_QUICKTIME") && (track->codec_priv.size >= 21) && - (track->codec_priv.data != NULL)) { + (track->codec_priv.data)) { fourcc = AV_RL32(track->codec_priv.data + 4); codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc); if (ff_codec_get_id(ff_codec_movvideo_tags, AV_RL32(track->codec_priv.data))) { diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 5d7682c293..2b801b7522 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -4008,7 +4008,7 @@ static int mov_write_header(AVFormatContext *s) /* Default mode == MP4 */ mov->mode = MODE_MP4; - if (s->oformat != NULL) { + if (s->oformat) { if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2; else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 3814da8c54..3cde966b1f 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -372,7 +372,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt) char *param = rt->conn; // Write arbitrary AMF data to the Connect message. - while (param != NULL) { + while (param) { char *sep; param += strspn(param, " "); if (!*param) diff --git a/libavformat/tls.c b/libavformat/tls.c index 7fd18cfce0..61fb2bff85 100644 --- a/libavformat/tls.c +++ b/libavformat/tls.c @@ -193,7 +193,7 @@ static int tls_open(URLContext *h, const char *uri, int flags) proxy_path = getenv("http_proxy"); use_proxy = !ff_http_match_no_proxy(getenv("no_proxy"), host) && - proxy_path != NULL && av_strstart(proxy_path, "http://", NULL); + proxy_path && av_strstart(proxy_path, "http://", NULL); if (use_proxy) { char proxy_host[200], proxy_auth[200], dest[200]; diff --git a/libavformat/url.c b/libavformat/url.c index 47e15843cf..acfb0cf2f0 100644 --- a/libavformat/url.c +++ b/libavformat/url.c @@ -111,7 +111,7 @@ void ff_make_absolute_url(char *buf, int size, const char *base, /* Strip off any query string from base */ path_query = strchr(buf, '?'); - if (path_query != NULL) + if (path_query) *path_query = '\0'; /* Is relative path just a new query part? */ diff --git a/libavutil/opt.c b/libavutil/opt.c index a46797787c..ca4edb827e 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1183,7 +1183,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags) { #endif const AVOption *opt = NULL; - while ((opt = av_opt_next(s, opt)) != NULL) { + while ((opt = av_opt_next(s, opt))) { void *dst = ((uint8_t*)s) + opt->offset; #if FF_API_OLD_AVOPTIONS if ((opt->flags & mask) != flags) diff --git a/tests/audiogen.c b/tests/audiogen.c index e705061008..8d596b5108 100644 --- a/tests/audiogen.c +++ b/tests/audiogen.c @@ -177,7 +177,7 @@ int main(int argc, char **argv) return 1; } - if ((ext = strrchr(argv[1], '.')) != NULL && !strcmp(ext, ".wav")) + if ((ext = strrchr(argv[1], '.')) && !strcmp(ext, ".wav")) put_wav_header(sample_rate, nb_channels, 6 * sample_rate); /* 1 second of single freq sine at 1000 Hz */ diff --git a/tools/ismindex.c b/tools/ismindex.c index 57a909e9b0..ed9280e5d6 100644 --- a/tools/ismindex.c +++ b/tools/ismindex.c @@ -329,7 +329,7 @@ static int handle_file(struct Tracks *tracks, const char *file, int split, tracks->tracks[tracks->nb_tracks] = track; track->name = file; - if ((ptr = strrchr(file, '/')) != NULL) + if ((ptr = strrchr(file, '/'))) track->name = ptr + 1; track->bitrate = st->codec->bit_rate; |