summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorGabriel Dume <gabriel.ddx84@gmail.com>2014-08-14 16:31:24 -0400
committerDiego Biurrun <diego@biurrun.de>2014-08-15 03:18:18 -0700
commitf929ab0569ff31ed5a59b0b0adb7ce09df3fca39 (patch)
tree5b93402fb37cc43b899451a5d2b65bfc03d7887b /libavformat
parentefd26bedec9a345a5960dbfcbaec888418f2d4e6 (diff)
cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avs.c4
-rw-r--r--libavformat/matroskadec.c16
-rw-r--r--libavformat/matroskaenc.c6
-rw-r--r--libavformat/movenc.c4
-rw-r--r--libavformat/mpegts.c2
-rw-r--r--libavformat/nsvdec.c2
-rw-r--r--libavformat/rtpenc.c2
-rw-r--r--libavformat/rtspdec.c2
-rw-r--r--libavformat/rtspenc.c2
-rw-r--r--libavformat/sdp.c8
10 files changed, 24 insertions, 24 deletions
diff --git a/libavformat/avs.c b/libavformat/avs.c
index 3e95a3656a..d8042c51f9 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -182,7 +182,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
case AVS_VIDEO:
if (!avs->st_video) {
avs->st_video = avformat_new_stream(s, NULL);
- if (avs->st_video == NULL)
+ if (!avs->st_video)
return AVERROR(ENOMEM);
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
avs->st_video->codec->codec_id = AV_CODEC_ID_AVS;
@@ -198,7 +198,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
case AVS_AUDIO:
if (!avs->st_audio) {
avs->st_audio = avformat_new_stream(s, NULL);
- if (avs->st_audio == NULL)
+ if (!avs->st_audio)
return AVERROR(ENOMEM);
avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
}
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index f15b0b3e9f..b168bdf9a6 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1519,7 +1519,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
track->type);
continue;
}
- if (track->codec_id == NULL)
+ if (!track->codec_id)
continue;
if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
@@ -1578,7 +1578,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
}
st = track->stream = avformat_new_stream(s, NULL);
- if (st == NULL)
+ if (!st)
return AVERROR(ENOMEM);
if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") &&
@@ -1638,7 +1638,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
int profile = matroska_aac_profile(track->codec_id);
int sri = matroska_aac_sri(track->audio.samplerate);
extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE);
- if (extradata == NULL)
+ if (!extradata)
return AVERROR(ENOMEM);
extradata[0] = (profile << 3) | ((sri & 0x0E) >> 1);
extradata[1] = ((sri & 0x01) << 7) | (track->audio.channels << 3);
@@ -1657,7 +1657,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
extradata_size = 12 + track->codec_priv.size;
extradata = av_mallocz(extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
- if (extradata == NULL)
+ if (!extradata)
return AVERROR(ENOMEM);
AV_WB32(extradata, extradata_size);
memcpy(&extradata[4], "alac", 4);
@@ -1667,7 +1667,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
} else if (codec_id == AV_CODEC_ID_TTA) {
extradata_size = 30;
extradata = av_mallocz(extradata_size);
- if (extradata == NULL)
+ if (!extradata)
return AVERROR(ENOMEM);
ffio_init_context(&b, extradata, extradata_size, 1,
NULL, NULL, NULL, NULL);
@@ -1760,7 +1760,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
} else if (track->codec_priv.data && track->codec_priv.size > 0) {
st->codec->extradata = av_mallocz(track->codec_priv.size +
FF_INPUT_BUFFER_PADDING_SIZE);
- if (st->codec->extradata == NULL)
+ if (!st->codec->extradata)
return AVERROR(ENOMEM);
st->codec->extradata_size = track->codec_priv.size;
memcpy(st->codec->extradata,
@@ -1872,14 +1872,14 @@ static int matroska_read_header(AVFormatContext *s)
av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n");
} else {
AVStream *st = avformat_new_stream(s, NULL);
- if (st == NULL)
+ if (!st)
break;
av_dict_set(&st->metadata, "filename", attachments[j].filename, 0);
av_dict_set(&st->metadata, "mimetype", attachments[j].mime, 0);
st->codec->codec_id = AV_CODEC_ID_NONE;
st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
st->codec->extradata = av_malloc(attachments[j].bin.size);
- if (st->codec->extradata == NULL)
+ if (!st->codec->extradata)
break;
st->codec->extradata_size = attachments[j].bin.size;
memcpy(st->codec->extradata, attachments[j].bin.data,
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index b55ad35090..cc4e71a4fb 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -285,7 +285,7 @@ static mkv_seekhead *mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset,
int numelements)
{
mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead));
- if (new_seekhead == NULL)
+ if (!new_seekhead)
return NULL;
new_seekhead->segment_offset = segment_offset;
@@ -378,7 +378,7 @@ fail:
static mkv_cues *mkv_start_cues(int64_t segment_offset)
{
mkv_cues *cues = av_mallocz(sizeof(mkv_cues));
- if (cues == NULL)
+ if (!cues)
return NULL;
cues->segment_offset = segment_offset;
@@ -1109,7 +1109,7 @@ static int mkv_write_header(AVFormatContext *s)
mkv_write_seekhead(pb, mkv->main_seekhead);
mkv->cues = mkv_start_cues(mkv->segment_offset);
- if (mkv->cues == NULL)
+ if (!mkv->cues)
return AVERROR(ENOMEM);
if (pb->seekable && mkv->reserve_cues_space) {
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 4d487e979e..72dcf0a725 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1713,7 +1713,7 @@ static int mov_write_track_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
int ret, size;
uint8_t *buf;
- if (st == NULL || mov->fc->flags & AVFMT_FLAG_BITEXACT)
+ if (!st || mov->fc->flags & AVFMT_FLAG_BITEXACT)
return 0;
ret = avio_open_dyn_buf(&pb_buf);
@@ -3182,7 +3182,7 @@ static int mov_create_chapter_track(AVFormatContext *s, int tracknum)
return AVERROR(ENOMEM);
track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
track->enc->extradata = av_malloc(sizeof(chapter_properties));
- if (track->enc->extradata == NULL)
+ if (!track->enc->extradata)
return AVERROR(ENOMEM);
track->enc->extradata_size = sizeof(chapter_properties);
memcpy(track->enc->extradata, chapter_properties, sizeof(chapter_properties));
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index fb58e1fc70..dced5370e4 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1715,7 +1715,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
return 0;
is_start = packet[1] & 0x40;
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);
tss = ts->pids[pid];
}
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 3089ffdd00..670b8678c8 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -663,7 +663,7 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt)
av_dlog(s, "%s()\n", __FUNCTION__);
/* 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);
if (err < 0)
return err;
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 0027abd421..7bc73735c2 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -142,7 +142,7 @@ static int rtp_write_header(AVFormatContext *s1)
return AVERROR(EIO);
}
s->buf = av_malloc(s1->packet_size);
- if (s->buf == NULL) {
+ if (!s->buf) {
return AVERROR(ENOMEM);
}
s->max_payload_size = s1->packet_size - 12;
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 583070a745..a14ec579d9 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -408,7 +408,7 @@ static inline int parse_command_line(AVFormatContext *s, const char *line,
}
searchlinept = strchr(linept, ' ');
- if (searchlinept == NULL) {
+ if (!searchlinept) {
av_log(s, AV_LOG_ERROR, "Error parsing message URI\n");
return AVERROR_INVALIDDATA;
}
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index 8a334ec49b..3db53aca07 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -55,7 +55,7 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
/* Announce the stream */
sdp = av_mallocz(SDP_MAX_SIZE);
- if (sdp == NULL)
+ if (!sdp)
return AVERROR(ENOMEM);
/* We create the SDP based on the RTSP AVFormatContext where we
* aren't allowed to change the filename field. (We create the SDP
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 895b9d6f4c..a690219006 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -189,7 +189,7 @@ static char *extradata2psets(AVCodecContext *c)
}
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_free(orig_extradata);
return NULL;
@@ -216,7 +216,7 @@ static char *extradata2psets(AVCodecContext *c)
sps = r;
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 %td %td!\n", MAX_PSET_SIZE - (p - psets), r1 - r);
av_free(psets);
@@ -250,7 +250,7 @@ static char *extradata2config(AVCodecContext *c)
return NULL;
}
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");
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");
return NULL;
}
- if (config == NULL) {
+ if (!config) {
return NULL;
}
av_strlcatf(buff, size, "a=rtpmap:%d MPEG4-GENERIC/%d/%d\r\n"