Browse Source

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>
tags/n2.4
Michael Niedermayer 10 years ago
parent
commit
fb33bff990
62 changed files with 124 additions and 126 deletions
  1. +4
    -4
      cmdutils.c
  2. +2
    -2
      compat/avisynth/avisynth_c.h
  3. +1
    -1
      compat/getopt.c
  4. +1
    -1
      ffmpeg.c
  5. +1
    -1
      ffplay.c
  6. +2
    -2
      ffserver.c
  7. +1
    -1
      libavcodec/atrac3.c
  8. +1
    -1
      libavcodec/cook.c
  9. +1
    -1
      libavcodec/dvbsub.c
  10. +2
    -2
      libavcodec/dvdsubdec.c
  11. +1
    -1
      libavcodec/dvdsubenc.c
  12. +2
    -2
      libavcodec/h263dec.c
  13. +3
    -3
      libavcodec/h264.c
  14. +1
    -1
      libavcodec/h264_parser.c
  15. +1
    -1
      libavcodec/h264_ps.c
  16. +1
    -1
      libavcodec/h264_refs.c
  17. +1
    -1
      libavcodec/huffyuvdec.c
  18. +1
    -1
      libavcodec/interplayvideo.c
  19. +1
    -1
      libavcodec/lcldec.c
  20. +1
    -1
      libavcodec/libmp3lame.c
  21. +1
    -1
      libavcodec/libopusenc.c
  22. +1
    -1
      libavcodec/libstagefright.cpp
  23. +1
    -1
      libavcodec/libutvideoenc.cpp
  24. +1
    -1
      libavcodec/libvpxenc.c
  25. +5
    -5
      libavcodec/libxvid.c
  26. +1
    -1
      libavcodec/motion_est.c
  27. +2
    -2
      libavcodec/mpeg12dec.c
  28. +1
    -1
      libavcodec/mpegaudiodec_template.c
  29. +7
    -10
      libavcodec/mpegvideo.c
  30. +3
    -3
      libavcodec/mpegvideo_enc.c
  31. +2
    -1
      libavcodec/options.c
  32. +1
    -1
      libavcodec/opus_celt.c
  33. +1
    -1
      libavcodec/qdm2.c
  34. +1
    -1
      libavcodec/roqvideo.c
  35. +2
    -2
      libavcodec/rv10.c
  36. +1
    -1
      libavcodec/tscc.c
  37. +1
    -1
      libavcodec/vc1dec.c
  38. +1
    -1
      libavcodec/vp3.c
  39. +1
    -1
      libavcodec/vp8.c
  40. +2
    -2
      libavcodec/zmbv.c
  41. +3
    -3
      libavcodec/zmbvenc.c
  42. +3
    -3
      libavdevice/v4l2.c
  43. +1
    -1
      libavfilter/vf_vidstabtransform.c
  44. +2
    -2
      libavformat/avs.c
  45. +11
    -11
      libavformat/matroskadec.c
  46. +5
    -5
      libavformat/matroskaenc.c
  47. +1
    -1
      libavformat/movenc.c
  48. +1
    -1
      libavformat/mpegts.c
  49. +1
    -1
      libavformat/mpegtsenc.c
  50. +1
    -1
      libavformat/nsvdec.c
  51. +2
    -2
      libavformat/oggdec.c
  52. +1
    -1
      libavformat/rtpenc.c
  53. +1
    -1
      libavformat/rtspdec.c
  54. +1
    -1
      libavformat/rtspenc.c
  55. +4
    -4
      libavformat/sdp.c
  56. +9
    -9
      libavformat/webmdashenc.c
  57. +1
    -1
      libavutil/eval.c
  58. +1
    -1
      libavutil/file.c
  59. +1
    -1
      libavutil/imgutils.h
  60. +4
    -4
      libavutil/internal.h
  61. +4
    -4
      libpostproc/postprocess.c
  62. +1
    -1
      tools/crypto_bench.c

+ 4
- 4
cmdutils.c View File

@@ -254,7 +254,7 @@ static void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)


win32_argv_utf8 = av_mallocz(sizeof(char *) * (win32_argc + 1) + buffsize); win32_argv_utf8 = av_mallocz(sizeof(char *) * (win32_argc + 1) + buffsize);
argstr_flat = (char *)win32_argv_utf8 + sizeof(char *) * (win32_argc + 1); argstr_flat = (char *)win32_argv_utf8 + sizeof(char *) * (win32_argc + 1);
if (win32_argv_utf8 == NULL) {
if (!win32_argv_utf8) {
LocalFree(argv_w); LocalFree(argv_w);
return; return;
} }
@@ -1242,7 +1242,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
is_dev = is_device(ofmt->priv_class); is_dev = is_device(ofmt->priv_class);
if (!is_dev && device_only) if (!is_dev && device_only)
continue; continue;
if ((name == NULL || strcmp(ofmt->name, name) < 0) &&
if ((!name || strcmp(ofmt->name, name) < 0) &&
strcmp(ofmt->name, last_name) > 0) { strcmp(ofmt->name, last_name) > 0) {
name = ofmt->name; name = ofmt->name;
long_name = ofmt->long_name; long_name = ofmt->long_name;
@@ -1253,7 +1253,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
is_dev = is_device(ifmt->priv_class); is_dev = is_device(ifmt->priv_class);
if (!is_dev && device_only) if (!is_dev && device_only)
continue; continue;
if ((name == NULL || strcmp(ifmt->name, name) < 0) &&
if ((!name || strcmp(ifmt->name, name) < 0) &&
strcmp(ifmt->name, last_name) > 0) { strcmp(ifmt->name, last_name) > 0) {
name = ifmt->name; name = ifmt->name;
long_name = ifmt->long_name; long_name = ifmt->long_name;
@@ -1262,7 +1262,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
if (name && strcmp(ifmt->name, name) == 0) if (name && strcmp(ifmt->name, name) == 0)
decode = 1; decode = 1;
} }
if (name == NULL)
if (!name)
break; break;
last_name = name; last_name = name;




+ 2
- 2
compat/avisynth/avisynth_c.h View File

@@ -805,7 +805,7 @@ struct AVS_Library {


AVSC_INLINE AVS_Library * avs_load_library() { AVSC_INLINE AVS_Library * avs_load_library() {
AVS_Library *library = (AVS_Library *)malloc(sizeof(AVS_Library)); AVS_Library *library = (AVS_Library *)malloc(sizeof(AVS_Library));
if (library == NULL)
if (!library)
return NULL; return NULL;
library->handle = LoadLibrary("avisynth"); library->handle = LoadLibrary("avisynth");
if (library->handle == NULL) if (library->handle == NULL)
@@ -870,7 +870,7 @@ fail:
} }


AVSC_INLINE void avs_free_library(AVS_Library *library) { AVSC_INLINE void avs_free_library(AVS_Library *library) {
if (library == NULL)
if (!library)
return; return;
FreeLibrary(library->handle); FreeLibrary(library->handle);
free(library); free(library);


+ 1
- 1
compat/getopt.c View File

@@ -54,7 +54,7 @@ static int getopt(int argc, char *argv[], char *opts)
} }
} }
optopt = c = argv[optind][sp]; optopt = c = argv[optind][sp];
if (c == ':' || (cp = strchr(opts, c)) == NULL) {
if (c == ':' || !(cp = strchr(opts, c))) {
fprintf(stderr, ": illegal option -- %c\n", c); fprintf(stderr, ": illegal option -- %c\n", c);
if (argv[optind][++sp] == '\0') { if (argv[optind][++sp] == '\0') {
optind++; optind++;


+ 1
- 1
ffmpeg.c View File

@@ -2083,7 +2083,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt)
if (ist->next_pts == AV_NOPTS_VALUE) if (ist->next_pts == AV_NOPTS_VALUE)
ist->next_pts = ist->pts; ist->next_pts = ist->pts;


if (pkt == NULL) {
if (!pkt) {
/* EOF handling */ /* EOF handling */
av_init_packet(&avpkt); av_init_packet(&avpkt);
avpkt.data = NULL; avpkt.data = NULL;


+ 1
- 1
ffplay.c View File

@@ -1652,7 +1652,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, double
is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx, is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx,
vp->width, vp->height, src_frame->format, vp->width, vp->height, vp->width, vp->height, src_frame->format, vp->width, vp->height,
AV_PIX_FMT_YUV420P, sws_flags, NULL, NULL, NULL); AV_PIX_FMT_YUV420P, sws_flags, NULL, NULL, NULL);
if (is->img_convert_ctx == NULL) {
if (!is->img_convert_ctx) {
av_log(NULL, AV_LOG_FATAL, "Cannot initialize the conversion context\n"); av_log(NULL, AV_LOG_FATAL, "Cannot initialize the conversion context\n");
exit(1); exit(1);
} }


+ 2
- 2
ffserver.c View File

@@ -1600,7 +1600,7 @@ static int http_parse_request(HTTPContext *c)
break; break;
stream = stream->next; stream = stream->next;
} }
if (stream == NULL) {
if (!stream) {
snprintf(msg, sizeof(msg), "File '%s' not found", url); snprintf(msg, sizeof(msg), "File '%s' not found", url);
http_log("File '%s' not found\n", url); http_log("File '%s' not found\n", url);
goto send_error; goto send_error;
@@ -2980,7 +2980,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
*pbuffer = NULL; *pbuffer = NULL;


avc = avformat_alloc_context(); avc = avformat_alloc_context();
if (avc == NULL || !rtp_format) {
if (!avc || !rtp_format) {
return -1; return -1;
} }
avc->oformat = rtp_format; avc->oformat = rtp_format;


+ 1
- 1
libavcodec/atrac3.c View File

@@ -888,7 +888,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)


q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) + q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) +
FF_INPUT_BUFFER_PADDING_SIZE); FF_INPUT_BUFFER_PADDING_SIZE);
if (q->decoded_bytes_buffer == NULL)
if (!q->decoded_bytes_buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);


avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;


+ 1
- 1
libavcodec/cook.c View File

@@ -1239,7 +1239,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
av_mallocz(avctx->block_align av_mallocz(avctx->block_align
+ DECODE_BYTES_PAD1(avctx->block_align) + DECODE_BYTES_PAD1(avctx->block_align)
+ FF_INPUT_BUFFER_PADDING_SIZE); + FF_INPUT_BUFFER_PADDING_SIZE);
if (q->decoded_bytes_buffer == NULL)
if (!q->decoded_bytes_buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);


/* Initialize transform. */ /* Initialize transform. */


+ 1
- 1
libavcodec/dvbsub.c View File

@@ -258,7 +258,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s,


page_id = 1; page_id = 1;


if (h->num_rects && h->rects == NULL)
if (h->num_rects && !h->rects)
return -1; return -1;


/* page composition segment */ /* page composition segment */


+ 2
- 2
libavcodec/dvdsubdec.c View File

@@ -195,7 +195,7 @@ static void reset_rects(AVSubtitle *sub_header)
{ {
int i; int i;


if (sub_header->rects != NULL) {
if (sub_header->rects) {
for (i = 0; i < sub_header->num_rects; i++) { 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[0]);
av_freep(&sub_header->rects[i]->pict.data[1]); 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; int y1, y2, x1, x2, y, w, h, i;
uint8_t *bitmap; 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; return 0;


for(i = 0; i < s->rects[0]->nb_colors; i++) { for(i = 0; i < s->rects[0]->nb_colors; i++) {


+ 1
- 1
libavcodec/dvdsubenc.c View File

@@ -264,7 +264,7 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
int x2, y2; int x2, y2;
int forced = 0; int forced = 0;


if (rects == 0 || h->rects == NULL)
if (rects == 0 || !h->rects)
return AVERROR(EINVAL); return AVERROR(EINVAL);
for (i = 0; i < rects; i++) for (i = 0; i < rects; i++)
if (h->rects[i]->type != SUBTITLE_BITMAP) { if (h->rects[i]->type != SUBTITLE_BITMAP) {


+ 2
- 2
libavcodec/h263dec.c View File

@@ -502,7 +502,7 @@ retry:
if ((ret = ff_mpv_common_init(s)) < 0) if ((ret = ff_mpv_common_init(s)) < 0)
return ret; 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); int i = ff_find_unused_picture(s, 0);
if (i < 0) if (i < 0)
return i; return i;
@@ -546,7 +546,7 @@ retry:
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;


/* skip B-frames if we don't have reference frames */ /* 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)) (s->pict_type == AV_PICTURE_TYPE_B || s->droppable))
return get_consumed_bytes(s, buf_size); return get_consumed_bytes(s, buf_size);
if ((avctx->skip_frame >= AVDISCARD_NONREF && if ((avctx->skip_frame >= AVDISCARD_NONREF &&


+ 3
- 3
libavcodec/h264.c View File

@@ -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); av_fast_padded_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+MAX_MBPAIR_SIZE);
dst = h->rbsp_buffer[bufidx]; dst = h->rbsp_buffer[bufidx];


if (dst == NULL)
if (!dst)
return NULL; return NULL;


if(i>=length-1){ //no escaped 0 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, ptr = ff_h264_decode_nal(h, buf + buf_index, &dst_length, &consumed,
next_avc - buf_index); next_avc - buf_index);


if (ptr == NULL || dst_length < 0)
if (!ptr || dst_length < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;


buf_index += consumed; 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, ptr = ff_h264_decode_nal(hx, buf + buf_index, &dst_length,
&consumed, next_avc - buf_index); &consumed, next_avc - buf_index);
if (ptr == NULL || dst_length < 0) {
if (!ptr || dst_length < 0) {
ret = -1; ret = -1;
goto end; goto end;
} }


+ 1
- 1
libavcodec/h264_parser.c View File

@@ -262,7 +262,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
break; break;
} }
ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
if (ptr == NULL || dst_length < 0)
if (!ptr || dst_length < 0)
break; break;


init_get_bits(&h->gb, ptr, 8 * dst_length); init_get_bits(&h->gb, ptr, 8 * dst_length);


+ 1
- 1
libavcodec/h264_ps.c View File

@@ -619,7 +619,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
pps->sps_id = get_ue_golomb_31(&h->gb); pps->sps_id = get_ue_golomb_31(&h->gb);
if ((unsigned)pps->sps_id >= MAX_SPS_COUNT || 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); av_log(h->avctx, AV_LOG_ERROR, "sps_id %u out of range\n", pps->sps_id);
goto fail; goto fail;
} }


+ 1
- 1
libavcodec/h264_refs.c View File

@@ -811,7 +811,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
(h->max_pic_num - 1); (h->max_pic_num - 1);
#if 0 #if 0
if (mmco[i].short_pic_num >= h->short_ref_count || 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, av_log(s->avctx, AV_LOG_ERROR,
"illegal short ref in memory management control " "illegal short ref in memory management control "
"operation %d\n", mmco); "operation %d\n", mmco);


+ 1
- 1
libavcodec/huffyuvdec.c View File

@@ -800,7 +800,7 @@ static void draw_slice(HYuvContext *s, AVFrame *frame, int y)
int h, cy, i; int h, cy, i;
int offset[AV_NUM_DATA_POINTERS]; int offset[AV_NUM_DATA_POINTERS];


if (s->avctx->draw_horiz_band == NULL)
if (!s->avctx->draw_horiz_band)
return; return;


h = y - s->last_slice_end; h = y - s->last_slice_end;


+ 1
- 1
libavcodec/interplayvideo.c View File

@@ -79,7 +79,7 @@ static int copy_from(IpvideoContext *s, AVFrame *src, AVFrame *dst, int delta_x,
motion_offset, s->upper_motion_limit_offset); motion_offset, s->upper_motion_limit_offset);
return AVERROR_INVALIDDATA; 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"); av_log(s->avctx, AV_LOG_ERROR, "Invalid decode type, corrupted header?\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }


+ 1
- 1
libavcodec/lcldec.c View File

@@ -593,7 +593,7 @@ static av_cold int decode_init(AVCodecContext *avctx)


/* Allocate decompression buffer */ /* Allocate decompression buffer */
if (c->decomp_size) { 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"); av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }


+ 1
- 1
libavcodec/libmp3lame.c View File

@@ -94,7 +94,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx)
s->avctx = avctx; s->avctx = avctx;


/* initialize LAME and get defaults */ /* initialize LAME and get defaults */
if ((s->gfp = lame_init()) == NULL)
if (!(s->gfp = lame_init()))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);






+ 1
- 1
libavcodec/libopusenc.c View File

@@ -366,7 +366,7 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
uint8_t* side_data = av_packet_new_side_data(avpkt, uint8_t* side_data = av_packet_new_side_data(avpkt,
AV_PKT_DATA_SKIP_SAMPLES, AV_PKT_DATA_SKIP_SAMPLES,
10); 10);
if(side_data == NULL) {
if(!side_data) {
av_free_packet(avpkt); av_free_packet(avpkt);
av_free(avpkt); av_free(avpkt);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);


+ 1
- 1
libavcodec/libstagefright.cpp View File

@@ -280,7 +280,7 @@ static av_cold int Stagefright_init(AVCodecContext *avctx)
memcpy(s->orig_extradata, avctx->extradata, avctx->extradata_size); memcpy(s->orig_extradata, avctx->extradata, avctx->extradata_size);


meta = new MetaData; meta = new MetaData;
if (meta == NULL) {
if (!meta) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto fail; goto fail;
} }


+ 1
- 1
libavcodec/libutvideoenc.cpp View File

@@ -85,7 +85,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
/* Alloc extradata buffer */ /* Alloc extradata buffer */
info = (UtVideoExtra *)av_malloc(sizeof(*info)); info = (UtVideoExtra *)av_malloc(sizeof(*info));


if (info == NULL) {
if (!info) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate extradata buffer.\n"); av_log(avctx, AV_LOG_ERROR, "Could not allocate extradata buffer.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }


+ 1
- 1
libavcodec/libvpxenc.c View File

@@ -542,7 +542,7 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
side_data = av_packet_new_side_data(pkt, side_data = av_packet_new_side_data(pkt,
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
cx_frame->sz_alpha + 8); cx_frame->sz_alpha + 8);
if(side_data == NULL) {
if(!side_data) {
av_free_packet(pkt); av_free_packet(pkt);
av_free(pkt); av_free(pkt);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);


+ 5
- 5
libavcodec/libxvid.c View File

@@ -110,7 +110,7 @@ static int xvid_ff_2pass_create(xvid_plg_create_t * param,
char *log = x->context->twopassbuffer; char *log = x->context->twopassbuffer;


/* Do a quick bounds check */ /* Do a quick bounds check */
if( log == NULL )
if (!log)
return XVID_ERR_FAIL; return XVID_ERR_FAIL;


/* We use snprintf() */ /* We use snprintf() */
@@ -201,7 +201,7 @@ static int xvid_ff_2pass_after(struct xvid_context *ref,
char frame_type; char frame_type;


/* Quick bounds check */ /* Quick bounds check */
if( log == NULL )
if (!log)
return XVID_ERR_FAIL; return XVID_ERR_FAIL;


/* Convert the type given to us into a character */ /* 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 ) { if( vo_len > 0 ) {
/* We need to store the header, so extract it */ /* We need to store the header, so extract it */
if( avctx->extradata == NULL ) {
if (!avctx->extradata) {
avctx->extradata = av_malloc(vo_len); avctx->extradata = av_malloc(vo_len);
memcpy(avctx->extradata, pkt->data, vo_len); memcpy(avctx->extradata, pkt->data, vo_len);
avctx->extradata_size = vo_len; avctx->extradata_size = vo_len;
@@ -483,7 +483,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) {
rc2pass1.context = x; rc2pass1.context = x;
x->twopassbuffer = av_malloc(BUFFER_SIZE); x->twopassbuffer = av_malloc(BUFFER_SIZE);
x->old_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, av_log(avctx, AV_LOG_ERROR,
"Xvid: Cannot allocate 2-pass log buffers\n"); "Xvid: Cannot allocate 2-pass log buffers\n");
goto fail; goto fail;
@@ -505,7 +505,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) {
} }
x->twopassfd = fd; x->twopassfd = fd;


if( avctx->stats_in == NULL ) {
if (!avctx->stats_in) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,
"Xvid: No 2-pass information loaded for second pass\n"); "Xvid: No 2-pass information loaded for second pass\n");
goto fail; goto fail;


+ 1
- 1
libavcodec/motion_est.c View File

@@ -1753,7 +1753,7 @@ void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_
int xy= y*s->mb_stride; int xy= y*s->mb_stride;
for(x=0; x<s->mb_width; x++){ for(x=0; x<s->mb_width; x++){
if (s->mb_type[xy] & type){ // RAL: "type" test added... 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 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){ || mv_table[xy][1] >=v_range || mv_table[xy][1] <-v_range){




+ 2
- 2
libavcodec/mpeg12dec.c View File

@@ -2597,7 +2597,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
return -1; return -1;
} }


if (s2->last_picture_ptr == NULL) {
if (!s2->last_picture_ptr) {
/* Skip B-frames if we do not have reference frames and /* Skip B-frames if we do not have reference frames and
* GOP is not closed. */ * GOP is not closed. */
if (s2->pict_type == AV_PICTURE_TYPE_B) { 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)) if (s2->pict_type == AV_PICTURE_TYPE_I || (s2->flags2 & CODEC_FLAG2_SHOW_ALL))
s->sync = 1; 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 /* Skip P-frames if we do not have a reference frame or
* we have an invalid header. */ * we have an invalid header. */
if (s2->pict_type == AV_PICTURE_TYPE_P && !s->sync) { if (s2->pict_type == AV_PICTURE_TYPE_P && !s->sync) {


+ 1
- 1
libavcodec/mpegaudiodec_template.c View File

@@ -1831,7 +1831,7 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx)
MPEG4AudioConfig cfg; MPEG4AudioConfig cfg;
int i; 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"); av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }


+ 7
- 10
libavcodec/mpegvideo.c View File

@@ -870,7 +870,7 @@ fail:


static void free_duplicate_context(MpegEncContext *s) static void free_duplicate_context(MpegEncContext *s)
{ {
if (s == NULL)
if (!s)
return; return;


av_freep(&s->edge_emu_buffer); 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) if (pic == s->last_picture_ptr)
return 0; return 0;
if (pic->f->buf[0] == NULL)
if (!pic->f->buf[0])
return 1; return 1;
if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF)) if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF))
return 1; return 1;
@@ -1684,7 +1684,7 @@ static int find_unused_picture(MpegEncContext *s, int shared)


if (shared) { if (shared) {
for (i = 0; i < MAX_PICTURE_COUNT; i++) { 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; return i;
} }
} else { } else {
@@ -1780,8 +1780,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)


release_unused_pictures(s); 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 // we already have a unused image
// (maybe it was set before reading the header) // (maybe it was set before reading the header)
pic = s->current_picture_ptr; 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->current_picture_ptr ? s->current_picture_ptr->f->data[0] : NULL,
s->pict_type, s->droppable); 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->pict_type != AV_PICTURE_TYPE_I ||
s->picture_structure != PICT_FRAME)) { s->picture_structure != PICT_FRAME)) {
int h_chroma_shift, v_chroma_shift; 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, 0);
ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 1); 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) { s->pict_type == AV_PICTURE_TYPE_B) {
/* Allocate a dummy frame */ /* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0); i = ff_find_unused_picture(s, 0);
@@ -3240,7 +3237,7 @@ void ff_mpeg_flush(AVCodecContext *avctx){
int i; int i;
MpegEncContext *s = avctx->priv_data; MpegEncContext *s = avctx->priv_data;


if(s==NULL || s->picture==NULL)
if (!s || !s->picture)
return; return;


for (i = 0; i < MAX_PICTURE_COUNT; i++) for (i = 0; i < MAX_PICTURE_COUNT; i++)


+ 3
- 3
libavcodec/mpegvideo_enc.c View File

@@ -1379,7 +1379,7 @@ static int select_input_picture(MpegEncContext *s)
s->reordered_input_picture[MAX_PICTURE_COUNT - 1] = NULL; s->reordered_input_picture[MAX_PICTURE_COUNT - 1] = NULL;


/* set next picture type & ordering */ /* 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->avctx->frame_skip_threshold || s->avctx->frame_skip_factor) {
if (s->picture_in_gop_number < s->gop_size && if (s->picture_in_gop_number < s->gop_size &&
s->next_picture_ptr && s->next_picture_ptr &&
@@ -1394,7 +1394,7 @@ static int select_input_picture(MpegEncContext *s)
} }


if (/*s->picture_in_gop_number >= s->gop_size ||*/ 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] = s->input_picture[0];
s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I; s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I;
s->reordered_input_picture[0]->f->coded_picture_number = 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++) { 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->input_picture[i]->b_frame_score - 1 >
s->mb_num / s->avctx->b_sensitivity) s->mb_num / s->avctx->b_sensitivity)
break; break;


+ 2
- 1
libavcodec/options.c View File

@@ -144,7 +144,8 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
{ {
AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));


if(avctx==NULL) return NULL;
if (!avctx)
return NULL;


if(avcodec_get_context_defaults3(avctx, codec) < 0){ if(avcodec_get_context_defaults3(avctx, codec) < 0){
av_free(avctx); av_free(avctx);


+ 1
- 1
libavcodec/opus_celt.c View File

@@ -1608,7 +1608,7 @@ static unsigned int celt_decode_band(CeltContext *s, OpusRangeCoder *rc,
for (j = 0; j < N; j++) for (j = 0; j < N; j++)
X[j] = 0.0f; X[j] = 0.0f;
} else { } else {
if (lowband == NULL) {
if (!lowband) {
/* Noise */ /* Noise */
for (j = 0; j < N; j++) for (j = 0; j < N; j++)
X[j] = (((int32_t)celt_rng(s)) >> 20); X[j] = (((int32_t)celt_rng(s)) >> 20);


+ 1
- 1
libavcodec/qdm2.c View File

@@ -1506,7 +1506,7 @@ static void qdm2_decode_fft_packets(QDM2Context *q)
int i, j, min, max, value, type, unknown_flag; int i, j, min, max, value, type, unknown_flag;
GetBitContext gb; GetBitContext gb;


if (q->sub_packet_list_B[0].packet == NULL)
if (!q->sub_packet_list_B[0].packet)
return; return;


/* reset minimum indexes for FFT coefficients */ /* reset minimum indexes for FFT coefficients */


+ 1
- 1
libavcodec/roqvideo.c View File

@@ -115,7 +115,7 @@ static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax
return; 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"); av_log(ri->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");
return; return;
} }


+ 2
- 2
libavcodec/rv10.c View File

@@ -330,7 +330,7 @@ static int rv20_decode_picture_header(RVDecContext *rv)
av_log(s->avctx, AV_LOG_ERROR, "low delay B\n"); av_log(s->avctx, AV_LOG_ERROR, "low delay B\n");
return -1; 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"); av_log(s->avctx, AV_LOG_ERROR, "early B-frame\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@@ -577,7 +577,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
return AVERROR_INVALIDDATA; 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? // FIXME write parser so we always have complete frames?
if (s->current_picture_ptr) { if (s->current_picture_ptr) {
ff_er_frame_end(&s->er); ff_er_frame_end(&s->er);


+ 1
- 1
libavcodec/tscc.c View File

@@ -143,7 +143,7 @@ static av_cold int decode_init(AVCodecContext *avctx)


/* Allocate decompression buffer */ /* Allocate decompression buffer */
if (c->decomp_size) { 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"); av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }


+ 1
- 1
libavcodec/vc1dec.c View File

@@ -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; s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;


/* skip B-frames if we don't have reference frames */ /* 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"); av_log(v->s.avctx, AV_LOG_DEBUG, "Skipping B frame without reference frames\n");
goto end; goto end;
} }


+ 1
- 1
libavcodec/vp3.c View File

@@ -1429,7 +1429,7 @@ static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y)
0); 0);
} }


if (s->avctx->draw_horiz_band == NULL)
if (!s->avctx->draw_horiz_band)
return; return;


h = y - s->last_slice_end; h = y - s->last_slice_end;


+ 1
- 1
libavcodec/vp8.c View File

@@ -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 pos = (mb_y << 16) | (mb_x & 0xFFFF); \
int sliced_threading = (avctx->active_thread_type == FF_THREAD_SLICE) && \ int sliced_threading = (avctx->active_thread_type == FF_THREAD_SLICE) && \
(num_jobs > 1); \ (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 \ int pos_check = (is_null) ? 1 \
: (next_td != td && \ : (next_td != td && \
pos >= next_td->wait_mb_pos) || \ pos >= next_td->wait_mb_pos) || \


+ 2
- 2
libavcodec/zmbv.c View File

@@ -500,7 +500,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
c->decode_intra= decode_intra; 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"); av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@@ -588,7 +588,7 @@ static av_cold int decode_init(AVCodecContext *avctx)


/* Allocate decompression buffer */ /* Allocate decompression buffer */
if (c->decomp_size) { 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, av_log(avctx, AV_LOG_ERROR,
"Can't allocate decompression buffer.\n"); "Can't allocate decompression buffer.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);


+ 3
- 3
libavcodec/zmbvenc.c View File

@@ -296,7 +296,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
memset(&c->zstream, 0, sizeof(z_stream)); memset(&c->zstream, 0, sizeof(z_stream));
c->comp_size = avctx->width * avctx->height + 1024 + c->comp_size = avctx->width * avctx->height + 1024 +
((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4; ((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"); av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
@@ -305,12 +305,12 @@ static av_cold int encode_init(AVCodecContext *avctx)
((c->comp_size + 63) >> 6) + 11; ((c->comp_size + 63) >> 6) + 11;


/* Allocate compression buffer */ /* 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"); av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
c->pstride = FFALIGN(avctx->width, 16); 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"); av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }


+ 3
- 3
libavdevice/v4l2.c View File

@@ -352,12 +352,12 @@ static int mmap_init(AVFormatContext *ctx)
} }
s->buffers = req.count; s->buffers = req.count;
s->buf_start = av_malloc_array(s->buffers, sizeof(void *)); s->buf_start = av_malloc_array(s->buffers, sizeof(void *));
if (s->buf_start == NULL) {
if (!s->buf_start) {
av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer pointers\n"); av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer pointers\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
s->buf_len = av_malloc_array(s->buffers, sizeof(unsigned int)); s->buf_len = av_malloc_array(s->buffers, sizeof(unsigned int));
if (s->buf_len == NULL) {
if (!s->buf_len) {
av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer sizes\n"); av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer sizes\n");
av_free(s->buf_start); av_free(s->buf_start);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@@ -558,7 +558,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif #endif


buf_descriptor = av_malloc(sizeof(struct buff_data)); buf_descriptor = av_malloc(sizeof(struct buff_data));
if (buf_descriptor == NULL) {
if (!buf_descriptor) {
/* Something went wrong... Since av_malloc() failed, we cannot even /* Something went wrong... Since av_malloc() failed, we cannot even
* allocate a buffer for memcpying into it * allocate a buffer for memcpying into it
*/ */


+ 1
- 1
libavfilter/vf_vidstabtransform.c View File

@@ -207,7 +207,7 @@ static int config_input(AVFilterLink *inlink)
av_log(ctx, AV_LOG_INFO, " interpol = %s\n", getInterpolationTypeName(tc->conf.interpolType)); av_log(ctx, AV_LOG_INFO, " interpol = %s\n", getInterpolationTypeName(tc->conf.interpolType));


f = fopen(tc->input, "r"); f = fopen(tc->input, "r");
if (f == NULL) {
if (!f) {
av_log(ctx, AV_LOG_ERROR, "cannot open input file %s\n", tc->input); av_log(ctx, AV_LOG_ERROR, "cannot open input file %s\n", tc->input);
return AVERROR(errno); return AVERROR(errno);
} else { } else {


+ 2
- 2
libavformat/avs.c View File

@@ -182,7 +182,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
case AVS_VIDEO: case AVS_VIDEO:
if (!avs->st_video) { if (!avs->st_video) {
avs->st_video = avformat_new_stream(s, NULL); avs->st_video = avformat_new_stream(s, NULL);
if (avs->st_video == NULL)
if (!avs->st_video)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO; avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
avs->st_video->codec->codec_id = AV_CODEC_ID_AVS; avs->st_video->codec->codec_id = AV_CODEC_ID_AVS;
@@ -201,7 +201,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
case AVS_AUDIO: case AVS_AUDIO:
if (!avs->st_audio) { if (!avs->st_audio) {
avs->st_audio = avformat_new_stream(s, NULL); avs->st_audio = avformat_new_stream(s, NULL);
if (avs->st_audio == NULL)
if (!avs->st_audio)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
} }


+ 11
- 11
libavformat/matroskadec.c View File

@@ -1658,7 +1658,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
track->type); track->type);
continue; continue;
} }
if (track->codec_id == NULL)
if (!track->codec_id)
continue; continue;


if (track->type == MATROSKA_TRACK_TYPE_VIDEO) { if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
@@ -1735,7 +1735,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
} }


st = track->stream = avformat_new_stream(s, NULL); st = track->stream = avformat_new_stream(s, NULL);
if (st == NULL) {
if (!st) {
av_free(key_id_base64); av_free(key_id_base64);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
@@ -1821,7 +1821,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
int profile = matroska_aac_profile(track->codec_id); int profile = matroska_aac_profile(track->codec_id);
int sri = matroska_aac_sri(track->audio.samplerate); int sri = matroska_aac_sri(track->audio.samplerate);
extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE); extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE);
if (extradata == NULL)
if (!extradata)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
extradata[0] = (profile << 3) | ((sri & 0x0E) >> 1); extradata[0] = (profile << 3) | ((sri & 0x0E) >> 1);
extradata[1] = ((sri & 0x01) << 7) | (track->audio.channels << 3); extradata[1] = ((sri & 0x01) << 7) | (track->audio.channels << 3);
@@ -1840,7 +1840,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
extradata_size = 12 + track->codec_priv.size; extradata_size = 12 + track->codec_priv.size;
extradata = av_mallocz(extradata_size + extradata = av_mallocz(extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE); FF_INPUT_BUFFER_PADDING_SIZE);
if (extradata == NULL)
if (!extradata)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
AV_WB32(extradata, extradata_size); AV_WB32(extradata, extradata_size);
memcpy(&extradata[4], "alac", 4); memcpy(&extradata[4], "alac", 4);
@@ -1850,7 +1850,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
} else if (codec_id == AV_CODEC_ID_TTA) { } else if (codec_id == AV_CODEC_ID_TTA) {
extradata_size = 30; extradata_size = 30;
extradata = av_mallocz(extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); extradata = av_mallocz(extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (extradata == NULL)
if (!extradata)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ffio_init_context(&b, extradata, extradata_size, 1, ffio_init_context(&b, extradata, extradata_size, 1,
NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL);
@@ -2130,7 +2130,7 @@ static int matroska_read_header(AVFormatContext *s)
av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n"); av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n");
} else { } else {
AVStream *st = avformat_new_stream(s, NULL); AVStream *st = avformat_new_stream(s, NULL);
if (st == NULL)
if (!st)
break; break;
av_dict_set(&st->metadata, "filename", attachments[j].filename, 0); av_dict_set(&st->metadata, "filename", attachments[j].filename, 0);
av_dict_set(&st->metadata, "mimetype", attachments[j].mime, 0); av_dict_set(&st->metadata, "mimetype", attachments[j].mime, 0);
@@ -2561,7 +2561,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
buf = av_packet_new_side_data(pkt, buf = av_packet_new_side_data(pkt,
AV_PKT_DATA_WEBVTT_IDENTIFIER, AV_PKT_DATA_WEBVTT_IDENTIFIER,
id_len); id_len);
if (buf == NULL) {
if (!buf) {
av_free(pkt); av_free(pkt);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
@@ -2572,7 +2572,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
buf = av_packet_new_side_data(pkt, buf = av_packet_new_side_data(pkt,
AV_PKT_DATA_WEBVTT_SETTINGS, AV_PKT_DATA_WEBVTT_SETTINGS,
settings_len); settings_len);
if (buf == NULL) {
if (!buf) {
av_free(pkt); av_free(pkt);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
@@ -2659,7 +2659,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
uint8_t *side_data = av_packet_new_side_data(pkt, uint8_t *side_data = av_packet_new_side_data(pkt,
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
additional_size + 8); additional_size + 8);
if (side_data == NULL) {
if (!side_data) {
av_free_packet(pkt); av_free_packet(pkt);
av_free(pkt); av_free(pkt);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@@ -2672,7 +2672,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
uint8_t *side_data = av_packet_new_side_data(pkt, uint8_t *side_data = av_packet_new_side_data(pkt,
AV_PKT_DATA_SKIP_SAMPLES, AV_PKT_DATA_SKIP_SAMPLES,
10); 10);
if (side_data == NULL) {
if (!side_data) {
av_free_packet(pkt); av_free_packet(pkt);
av_free(pkt); av_free(pkt);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@@ -3406,7 +3406,7 @@ static int webm_dash_manifest_read_header(AVFormatContext *s)


// basename of the file // basename of the file
buf = strrchr(s->filename, '/'); buf = strrchr(s->filename, '/');
if (buf == NULL) return -1;
if (!buf) return -1;
av_dict_set(&s->streams[0]->metadata, FILENAME, ++buf, 0); av_dict_set(&s->streams[0]->metadata, FILENAME, ++buf, 0);


// duration // duration


+ 5
- 5
libavformat/matroskaenc.c View File

@@ -309,7 +309,7 @@ static mkv_seekhead *mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset,
int numelements) int numelements)
{ {
mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead)); mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead));
if (new_seekhead == NULL)
if (!new_seekhead)
return NULL; return NULL;


new_seekhead->segment_offset = segment_offset; new_seekhead->segment_offset = segment_offset;
@@ -335,7 +335,7 @@ static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid
return -1; return -1;


entries = av_realloc_array(entries, seekhead->num_entries + 1, sizeof(mkv_seekhead_entry)); entries = av_realloc_array(entries, seekhead->num_entries + 1, sizeof(mkv_seekhead_entry));
if (entries == NULL)
if (!entries)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
seekhead->entries = entries; seekhead->entries = entries;


@@ -401,7 +401,7 @@ fail:
static mkv_cues *mkv_start_cues(int64_t segment_offset) static mkv_cues *mkv_start_cues(int64_t segment_offset)
{ {
mkv_cues *cues = av_mallocz(sizeof(mkv_cues)); mkv_cues *cues = av_mallocz(sizeof(mkv_cues));
if (cues == NULL)
if (!cues)
return NULL; return NULL;


cues->segment_offset = segment_offset; cues->segment_offset = segment_offset;
@@ -417,7 +417,7 @@ static int mkv_add_cuepoint(mkv_cues *cues, int stream, int tracknum, int64_t ts
return 0; return 0;


entries = av_realloc_array(entries, cues->num_entries + 1, sizeof(mkv_cuepoint)); entries = av_realloc_array(entries, cues->num_entries + 1, sizeof(mkv_cuepoint));
if (entries == NULL)
if (!entries)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
cues->entries = entries; cues->entries = entries;


@@ -1336,7 +1336,7 @@ static int mkv_write_header(AVFormatContext *s)
mkv_write_seekhead(pb, mkv->main_seekhead); mkv_write_seekhead(pb, mkv->main_seekhead);


mkv->cues = mkv_start_cues(mkv->segment_offset); mkv->cues = mkv_start_cues(mkv->segment_offset);
if (mkv->cues == NULL)
if (!mkv->cues)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);


if (pb->seekable && mkv->reserve_cues_space) { if (pb->seekable && mkv->reserve_cues_space) {


+ 1
- 1
libavformat/movenc.c View File

@@ -2065,7 +2065,7 @@ static int mov_write_track_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
int ret, size; int ret, size;
uint8_t *buf; uint8_t *buf;


if (st == NULL || mov->fc->flags & AVFMT_FLAG_BITEXACT)
if (!st || mov->fc->flags & AVFMT_FLAG_BITEXACT)
return 0; return 0;


ret = avio_open_dyn_buf(&pb_buf); ret = avio_open_dyn_buf(&pb_buf);


+ 1
- 1
libavformat/mpegts.c View File

@@ -2037,7 +2037,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
return 0; return 0;
is_start = packet[1] & 0x40; is_start = packet[1] & 0x40;
tss = ts->pids[pid]; tss = ts->pids[pid];
if (ts->auto_guess && tss == NULL && is_start) {
if (ts->auto_guess && !tss && is_start) {
add_pes_stream(ts, pid, -1); add_pes_stream(ts, pid, -1);
tss = ts->pids[pid]; tss = ts->pids[pid];
} }


+ 1
- 1
libavformat/mpegtsenc.c View File

@@ -481,7 +481,7 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
return 0; return 0;
} }


/* NOTE: str == NULL is accepted for an empty string */
/* NOTE: !str is accepted for an empty string */
static void putstr8(uint8_t **q_ptr, const char *str) static void putstr8(uint8_t **q_ptr, const char *str)
{ {
uint8_t *q; uint8_t *q;


+ 1
- 1
libavformat/nsvdec.c View File

@@ -665,7 +665,7 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt)
av_dlog(s, "%s()\n", __FUNCTION__); av_dlog(s, "%s()\n", __FUNCTION__);


/* in case we don't already have something to eat ... */ /* in case we don't already have something to eat ... */
if (nsv->ahead[0].data == NULL && nsv->ahead[1].data == NULL)
if (!nsv->ahead[0].data && !nsv->ahead[1].data)
err = nsv_read_chunk(s, 0); err = nsv_read_chunk(s, 0);
if (err < 0) if (err < 0)
return err; return err;


+ 2
- 2
libavformat/oggdec.c View File

@@ -796,7 +796,7 @@ retry:
uint8_t *side_data = av_packet_new_side_data(pkt, uint8_t *side_data = av_packet_new_side_data(pkt,
AV_PKT_DATA_SKIP_SAMPLES, AV_PKT_DATA_SKIP_SAMPLES,
10); 10);
if(side_data == NULL)
if(!side_data)
goto fail; goto fail;
AV_WL32(side_data + 4, os->end_trimming); AV_WL32(side_data + 4, os->end_trimming);
os->end_trimming = 0; os->end_trimming = 0;
@@ -806,7 +806,7 @@ retry:
uint8_t *side_data = av_packet_new_side_data(pkt, uint8_t *side_data = av_packet_new_side_data(pkt,
AV_PKT_DATA_METADATA_UPDATE, AV_PKT_DATA_METADATA_UPDATE,
os->new_metadata_size); os->new_metadata_size);
if(side_data == NULL)
if(!side_data)
goto fail; goto fail;


memcpy(side_data, os->new_metadata, os->new_metadata_size); memcpy(side_data, os->new_metadata, os->new_metadata_size);


+ 1
- 1
libavformat/rtpenc.c View File

@@ -145,7 +145,7 @@ static int rtp_write_header(AVFormatContext *s1)
return AVERROR(EIO); return AVERROR(EIO);
} }
s->buf = av_malloc(s1->packet_size); s->buf = av_malloc(s1->packet_size);
if (s->buf == NULL) {
if (!s->buf) {
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
s->max_payload_size = s1->packet_size - 12; s->max_payload_size = s1->packet_size - 12;


+ 1
- 1
libavformat/rtspdec.c View File

@@ -412,7 +412,7 @@ static inline int parse_command_line(AVFormatContext *s, const char *line,
} }


searchlinept = strchr(linept, ' '); searchlinept = strchr(linept, ' ');
if (searchlinept == NULL) {
if (!searchlinept) {
av_log(s, AV_LOG_ERROR, "Error parsing message URI\n"); av_log(s, AV_LOG_ERROR, "Error parsing message URI\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }


+ 1
- 1
libavformat/rtspenc.c View File

@@ -56,7 +56,7 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)


/* Announce the stream */ /* Announce the stream */
sdp = av_mallocz(SDP_MAX_SIZE); sdp = av_mallocz(SDP_MAX_SIZE);
if (sdp == NULL)
if (!sdp)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
/* We create the SDP based on the RTSP AVFormatContext where we /* We create the SDP based on the RTSP AVFormatContext where we
* aren't allowed to change the filename field. (We create the SDP * aren't allowed to change the filename field. (We create the SDP


+ 4
- 4
libavformat/sdp.c View File

@@ -189,7 +189,7 @@ static char *extradata2psets(AVCodecContext *c)
} }


psets = av_mallocz(MAX_PSET_SIZE); psets = av_mallocz(MAX_PSET_SIZE);
if (psets == NULL) {
if (!psets) {
av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the parameter sets.\n"); av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the parameter sets.\n");
av_free(orig_extradata); av_free(orig_extradata);
return NULL; return NULL;
@@ -216,7 +216,7 @@ static char *extradata2psets(AVCodecContext *c)
sps = r; sps = r;
sps_end = r1; sps_end = r1;
} }
if (av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r) == NULL) {
if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) {
av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n", MAX_PSET_SIZE - (p - psets), r1 - r); av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n", MAX_PSET_SIZE - (p - psets), r1 - r);
av_free(psets); av_free(psets);


@@ -250,7 +250,7 @@ static char *extradata2config(AVCodecContext *c)
return NULL; return NULL;
} }
config = av_malloc(10 + c->extradata_size * 2); config = av_malloc(10 + c->extradata_size * 2);
if (config == NULL) {
if (!config) {
av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the config info.\n"); av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the config info.\n");
return NULL; return NULL;
} }
@@ -457,7 +457,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
av_log(c, AV_LOG_ERROR, "AAC with no global headers is currently not supported.\n"); av_log(c, AV_LOG_ERROR, "AAC with no global headers is currently not supported.\n");
return NULL; return NULL;
} }
if (config == NULL) {
if (!config) {
return NULL; return NULL;
} }
av_strlcatf(buff, size, "a=rtpmap:%d MPEG4-GENERIC/%d/%d\r\n" av_strlcatf(buff, size, "a=rtpmap:%d MPEG4-GENERIC/%d/%d\r\n"


+ 9
- 9
libavformat/webmdashenc.c View File

@@ -70,7 +70,7 @@ static double get_duration(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) { for (i = 0; i < s->nb_streams; i++) {
AVDictionaryEntry *duration = av_dict_get(s->streams[i]->metadata, AVDictionaryEntry *duration = av_dict_get(s->streams[i]->metadata,
DURATION, NULL, 0); DURATION, NULL, 0);
if (duration == NULL || atof(duration->value) < 0) continue;
if (!duration || atof(duration->value) < 0) continue;
if (atof(duration->value) > max) max = atof(duration->value); if (atof(duration->value) > max) max = atof(duration->value);
} }
return max / 1000; return max / 1000;
@@ -102,11 +102,11 @@ static int subsegment_alignment(AVFormatContext *s, AdaptationSet *as) {
int i; int i;
AVDictionaryEntry *gold = av_dict_get(s->streams[as->streams[0]]->metadata, AVDictionaryEntry *gold = av_dict_get(s->streams[as->streams[0]]->metadata,
CUE_TIMESTAMPS, NULL, 0); CUE_TIMESTAMPS, NULL, 0);
if (gold == NULL) return 0;
if (!gold) return 0;
for (i = 1; i < as->nb_streams; i++) { for (i = 1; i < as->nb_streams; i++) {
AVDictionaryEntry *ts = av_dict_get(s->streams[as->streams[i]]->metadata, AVDictionaryEntry *ts = av_dict_get(s->streams[as->streams[i]]->metadata,
CUE_TIMESTAMPS, NULL, 0); CUE_TIMESTAMPS, NULL, 0);
if (ts == NULL || strncmp(gold->value, ts->value, strlen(gold->value))) return 0;
if (!ts || strncmp(gold->value, ts->value, strlen(gold->value))) return 0;
} }
return 1; return 1;
} }
@@ -116,12 +116,12 @@ static int bitstream_switching(AVFormatContext *s, AdaptationSet *as) {
AVDictionaryEntry *gold_track_num = av_dict_get(s->streams[as->streams[0]]->metadata, AVDictionaryEntry *gold_track_num = av_dict_get(s->streams[as->streams[0]]->metadata,
TRACK_NUMBER, NULL, 0); TRACK_NUMBER, NULL, 0);
AVCodecContext *gold_codec = s->streams[as->streams[0]]->codec; AVCodecContext *gold_codec = s->streams[as->streams[0]]->codec;
if (gold_track_num == NULL) return 0;
if (!gold_track_num) return 0;
for (i = 1; i < as->nb_streams; i++) { for (i = 1; i < as->nb_streams; i++) {
AVDictionaryEntry *track_num = av_dict_get(s->streams[as->streams[i]]->metadata, AVDictionaryEntry *track_num = av_dict_get(s->streams[as->streams[i]]->metadata,
TRACK_NUMBER, NULL, 0); TRACK_NUMBER, NULL, 0);
AVCodecContext *codec = s->streams[as->streams[i]]->codec; AVCodecContext *codec = s->streams[as->streams[i]]->codec;
if (track_num == NULL ||
if (!track_num ||
strncmp(gold_track_num->value, track_num->value, strlen(gold_track_num->value)) || strncmp(gold_track_num->value, track_num->value, strlen(gold_track_num->value)) ||
gold_codec->codec_id != codec->codec_id || gold_codec->codec_id != codec->codec_id ||
gold_codec->extradata_size != codec->extradata_size || gold_codec->extradata_size != codec->extradata_size ||
@@ -167,7 +167,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
for (i = 0; i < as->nb_streams; i++) { for (i = 0; i < as->nb_streams; i++) {
AVDictionaryEntry *kf = av_dict_get(s->streams[as->streams[i]]->metadata, AVDictionaryEntry *kf = av_dict_get(s->streams[as->streams[i]]->metadata,
CLUSTER_KEYFRAME, NULL, 0); CLUSTER_KEYFRAME, NULL, 0);
if (kf == NULL || !strncmp(kf->value, "0", 1)) subsegmentStartsWithSAP = 0;
if (!kf || !strncmp(kf->value, "0", 1)) subsegmentStartsWithSAP = 0;
} }
avio_printf(s->pb, " subsegmentStartsWithSAP=\"%d\"", subsegmentStartsWithSAP); avio_printf(s->pb, " subsegmentStartsWithSAP=\"%d\"", subsegmentStartsWithSAP);
avio_printf(s->pb, ">\n"); avio_printf(s->pb, ">\n");
@@ -179,8 +179,8 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
AVDictionaryEntry *cues_end = av_dict_get(stream->metadata, CUES_END, NULL, 0); AVDictionaryEntry *cues_end = av_dict_get(stream->metadata, CUES_END, NULL, 0);
AVDictionaryEntry *filename = av_dict_get(stream->metadata, FILENAME, NULL, 0); AVDictionaryEntry *filename = av_dict_get(stream->metadata, FILENAME, NULL, 0);
AVDictionaryEntry *bandwidth = av_dict_get(stream->metadata, BANDWIDTH, NULL, 0); AVDictionaryEntry *bandwidth = av_dict_get(stream->metadata, BANDWIDTH, NULL, 0);
if (irange == NULL || cues_start == NULL || cues_end == NULL || filename == NULL ||
bandwidth == NULL) {
if (!irange || cues_start == NULL || cues_end == NULL || filename == NULL ||
!bandwidth) {
return -1; return -1;
} }
avio_printf(s->pb, "<Representation id=\"%d\"", i); avio_printf(s->pb, "<Representation id=\"%d\"", i);
@@ -202,7 +202,7 @@ static int to_integer(char *p, int len)
{ {
int ret; int ret;
char *q = av_malloc(sizeof(char) * len); char *q = av_malloc(sizeof(char) * len);
if (q == NULL) return -1;
if (!q) return -1;
strncpy(q, p, len); strncpy(q, p, len);
ret = atoi(q); ret = atoi(q);
av_free(q); av_free(q);


+ 1
- 1
libavutil/eval.c View File

@@ -359,7 +359,7 @@ static int parse_primary(AVExpr **e, Parser *p)
} }


p->s= strchr(p->s, '('); p->s= strchr(p->s, '(');
if (p->s==NULL) {
if (!p->s) {
av_log(p, AV_LOG_ERROR, "Undefined constant or missing '(' in '%s'\n", s0); av_log(p, AV_LOG_ERROR, "Undefined constant or missing '(' in '%s'\n", s0);
p->s= next; p->s= next;
av_expr_free(d); av_expr_free(d);


+ 1
- 1
libavutil/file.c View File

@@ -152,7 +152,7 @@ int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_c
*filename = av_malloc(len); *filename = av_malloc(len);
#endif #endif
/* -----common section-----*/ /* -----common section-----*/
if (*filename == NULL) {
if (!*filename) {
av_log(&file_log_ctx, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n"); av_log(&file_log_ctx, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }


+ 1
- 1
libavutil/imgutils.h View File

@@ -130,7 +130,7 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
* line sizes will be set. If a planar format is specified, several * line sizes will be set. If a planar format is specified, several
* pointers will be set pointing to the different picture planes and * pointers will be set pointing to the different picture planes and
* the line sizes of the different planes will be stored in the * the line sizes of the different planes will be stored in the
* lines_sizes array. Call with src == NULL to get the required
* lines_sizes array. Call with !src to get the required
* size for the src buffer. * size for the src buffer.
* *
* To allocate the buffer and fill in the dst_data and dst_linesize in * To allocate the buffer and fill in the dst_data and dst_linesize in


+ 4
- 4
libavutil/internal.h View File

@@ -132,7 +132,7 @@
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\
{\ {\
p = av_malloc(size);\ p = av_malloc(size);\
if (p == NULL && (size) != 0) {\
if (!(p) && (size) != 0) {\
av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
goto label;\ goto label;\
}\ }\
@@ -141,7 +141,7 @@
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\ #define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\
{\ {\
p = av_mallocz(size);\ p = av_mallocz(size);\
if (p == NULL && (size) != 0) {\
if (!(p) && (size) != 0) {\
av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
goto label;\ goto label;\
}\ }\
@@ -150,7 +150,7 @@
#define FF_ALLOC_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\ #define FF_ALLOC_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\
{\ {\
p = av_malloc_array(nelem, elsize);\ p = av_malloc_array(nelem, elsize);\
if (p == NULL) {\
if (!p) {\
av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
goto label;\ goto label;\
}\ }\
@@ -159,7 +159,7 @@
#define FF_ALLOCZ_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\ #define FF_ALLOCZ_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\
{\ {\
p = av_mallocz_array(nelem, elsize);\ p = av_mallocz_array(nelem, elsize);\
if (p == NULL) {\
if (!p) {\
av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
goto label;\ goto label;\
}\ }\


+ 4
- 4
libpostproc/postprocess.c View File

@@ -716,10 +716,10 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
int enable=1; //does the user want us to enabled or disabled the filter int enable=1; //does the user want us to enabled or disabled the filter


filterToken= strtok(p, filterDelimiters); filterToken= strtok(p, filterDelimiters);
if(filterToken == NULL) break;
if(!filterToken) break;
p+= strlen(filterToken) + 1; // p points to next filterToken p+= strlen(filterToken) + 1; // p points to next filterToken
filterName= strtok(filterToken, optionDelimiters); filterName= strtok(filterToken, optionDelimiters);
if (filterName == NULL) {
if (!filterName) {
ppMode->error++; ppMode->error++;
break; break;
} }
@@ -732,7 +732,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)


for(;;){ //for all options for(;;){ //for all options
option= strtok(NULL, optionDelimiters); option= strtok(NULL, optionDelimiters);
if(option == NULL) break;
if(!option) break;


av_log(NULL, AV_LOG_DEBUG, "pp: option: %s\n", option); av_log(NULL, AV_LOG_DEBUG, "pp: option: %s\n", option);
if(!strcmp("autoq", option) || !strcmp("a", option)) q= quality; if(!strcmp("autoq", option) || !strcmp("a", option)) q= quality;
@@ -967,7 +967,7 @@ void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
FFMAX(minStride, c->stride), FFMAX(minStride, c->stride),
FFMAX(c->qpStride, absQPStride)); FFMAX(c->qpStride, absQPStride));


if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)){
if(!QP_store || (mode->lumMode & FORCE_QUANT)){
int i; int i;
QP_store= c->forcedQPTable; QP_store= c->forcedQPTable;
absQPStride = QPStride = 0; absQPStride = QPStride = 0;


+ 1
- 1
tools/crypto_bench.c View File

@@ -173,7 +173,7 @@ static void run_gcrypt_aes128(uint8_t *output,
const uint8_t *input, unsigned size) const uint8_t *input, unsigned size)
{ {
static gcry_cipher_hd_t aes; static gcry_cipher_hd_t aes;
if (aes == NULL)
if (!aes)
gcry_cipher_open(&aes, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_ECB, 0); gcry_cipher_open(&aes, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_ECB, 0);
gcry_cipher_setkey(aes, hardcoded_key, 16); gcry_cipher_setkey(aes, hardcoded_key, 16);
gcry_cipher_encrypt(aes, output, size, input, size); gcry_cipher_encrypt(aes, output, size, input, size);


Loading…
Cancel
Save