1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

Drop remaining unneeded != NULL

Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-08-15 21:31:59 +02:00
parent 60dbed6067
commit 81a663f49e
16 changed files with 46 additions and 46 deletions

View File

@ -166,7 +166,7 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
int first;
first = 1;
for (po = options; po->name != NULL; po++) {
for (po = options; po->name; po++) {
char buf[64];
if (((po->flags & req_flags) != req_flags) ||

View File

@ -2071,7 +2071,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt)
if (!ist->saw_first_ts) {
ist->dts = ist->st->avg_frame_rate.num ? - ist->dec_ctx->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0;
ist->pts = 0;
if (pkt != NULL && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) {
if (pkt && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) {
ist->dts += av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
ist->pts = ist->dts; //unused but better to set it to a value thats not totally wrong
}

View File

@ -441,7 +441,7 @@ static void packet_queue_flush(PacketQueue *q)
MyAVPacketList *pkt, *pkt1;
SDL_LockMutex(q->mutex);
for (pkt = q->first_pkt; pkt != NULL; pkt = pkt1) {
for (pkt = q->first_pkt; pkt; pkt = pkt1) {
pkt1 = pkt->next;
av_free_packet(&pkt->pkt);
av_freep(&pkt);

View File

@ -592,7 +592,7 @@ static void start_multicast(void)
int default_port, stream_index;
default_port = 6000;
for(stream = first_stream; stream != NULL; stream = stream->next) {
for(stream = first_stream; stream; stream = stream->next) {
if (stream->is_multicast) {
unsigned random0 = av_lfg_get(&random_state);
unsigned random1 = av_lfg_get(&random_state);
@ -696,7 +696,7 @@ static int http_server(void)
/* wait for events on each HTTP handle */
c = first_http_ctx;
delay = 1000;
while (c != NULL) {
while (c) {
int fd;
fd = c->fd;
switch(c->state) {
@ -763,7 +763,7 @@ static int http_server(void)
}
/* now handle the events */
for(c = first_http_ctx; c != NULL; c = c_next) {
for(c = first_http_ctx; c; c = c_next) {
c_next = c->next;
if (handle_connection(c) < 0) {
log_connection(c);
@ -881,7 +881,7 @@ static void close_connection(HTTPContext *c)
/* remove connection from list */
cp = &first_http_ctx;
while ((*cp) != NULL) {
while (*cp) {
c1 = *cp;
if (c1 == c)
*cp = c->next;
@ -890,7 +890,7 @@ static void close_connection(HTTPContext *c)
}
/* remove references, if any (XXX: do it faster) */
for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {
for(c1 = first_http_ctx; c1; c1 = c1->next) {
if (c1->rtsp_c == c)
c1->rtsp_c = NULL;
}
@ -1486,7 +1486,7 @@ static void compute_real_filename(char *filename, int max_size)
p = strrchr(file1, '.');
if (p)
*p = '\0';
for(stream = first_stream; stream != NULL; stream = stream->next) {
for(stream = first_stream; stream; stream = stream->next) {
av_strlcpy(file2, stream->filename, sizeof(file2));
p = strrchr(file2, '.');
if (p)
@ -1595,7 +1595,7 @@ static int http_parse_request(HTTPContext *c)
av_strlcpy(filename, "index.html", sizeof(filename) - 1);
stream = first_stream;
while (stream != NULL) {
while (stream) {
if (!strcmp(stream->filename, filename) && validate_acl(stream, c))
break;
stream = stream->next;
@ -1974,7 +1974,7 @@ static void compute_status(HTTPContext *c)
avio_printf(pb, "<table cellspacing=0 cellpadding=4>\n");
avio_printf(pb, "<tr><th valign=top>Path<th align=left>Served<br>Conns<th><br>bytes<th valign=top>Format<th>Bit rate<br>kbits/s<th align=left>Video<br>kbits/s<th><br>Codec<th align=left>Audio<br>kbits/s<th><br>Codec<th align=left valign=top>Feed\n");
stream = first_stream;
while (stream != NULL) {
while (stream) {
char sfilename[1024];
char *eosf;
@ -2063,7 +2063,7 @@ static void compute_status(HTTPContext *c)
avio_printf(pb, "</table>\n");
stream = first_stream;
while (stream != NULL) {
while (stream) {
if (stream->feed == stream) {
avio_printf(pb, "<h2>Feed %s</h2>", stream->filename);
if (stream->pid) {
@ -2141,7 +2141,7 @@ static void compute_status(HTTPContext *c)
avio_printf(pb, "<tr><th>#<th>File<th>IP<th>Proto<th>State<th>Target bits/sec<th>Actual bits/sec<th>Bytes transferred\n");
c1 = first_http_ctx;
i = 0;
while (c1 != NULL) {
while (c1) {
int bitrate;
int j;
@ -2785,7 +2785,7 @@ static int http_receive_data(HTTPContext *c)
}
/* wake up any waiting connections */
for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {
for(c1 = first_http_ctx; c1; c1 = c1->next) {
if (c1->state == HTTPSTATE_WAIT_FEED &&
c1->stream->feed == c->stream->feed)
c1->state = HTTPSTATE_SEND_DATA;
@ -2841,7 +2841,7 @@ static int http_receive_data(HTTPContext *c)
c->stream->feed_opened = 0;
close(c->feed_fd);
/* wake up any waiting connections to stop waiting for feed */
for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {
for(c1 = first_http_ctx; c1; c1 = c1->next) {
if (c1->state == HTTPSTATE_WAIT_FEED &&
c1->stream->feed == c->stream->feed)
c1->state = HTTPSTATE_SEND_DATA_TRAILER;
@ -3043,7 +3043,7 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url)
if (*path == '/')
path++;
for(stream = first_stream; stream != NULL; stream = stream->next) {
for(stream = first_stream; stream; stream = stream->next) {
if (!stream->is_feed &&
stream->fmt && !strcmp(stream->fmt->name, "rtp") &&
!strcmp(path, stream->filename)) {
@ -3081,7 +3081,7 @@ static HTTPContext *find_rtp_session(const char *session_id)
if (session_id[0] == '\0')
return NULL;
for(c = first_http_ctx; c != NULL; c = c->next) {
for(c = first_http_ctx; c; c = c->next) {
if (!strcmp(c->session_id, session_id))
return c;
}
@ -3121,7 +3121,7 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url,
path++;
/* now check each stream */
for(stream = first_stream; stream != NULL; stream = stream->next) {
for(stream = first_stream; stream; stream = stream->next) {
if (!stream->is_feed &&
stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
/* accept aggregate filenames only if single stream */
@ -3582,7 +3582,7 @@ static void remove_stream(FFStream *stream)
{
FFStream **ps;
ps = &first_stream;
while (*ps != NULL) {
while (*ps) {
if (*ps == stream)
*ps = (*ps)->next;
else
@ -3648,7 +3648,7 @@ static void build_file_streams(void)
int i, ret;
/* gather all streams */
for(stream = first_stream; stream != NULL; stream = stream_next) {
for(stream = first_stream; stream; stream = stream_next) {
AVFormatContext *infile = NULL;
stream_next = stream->next;
if (stream->stream_type == STREAM_TYPE_LIVE &&
@ -3700,7 +3700,7 @@ static void build_feed_streams(void)
int i;
/* gather all streams */
for(stream = first_stream; stream != NULL; stream = stream->next) {
for(stream = first_stream; stream; stream = stream->next) {
feed = stream->feed;
if (feed) {
if (stream->is_feed) {
@ -3715,7 +3715,7 @@ static void build_feed_streams(void)
}
/* create feed files if needed */
for(feed = first_feed; feed != NULL; feed = feed->next_feed) {
for(feed = first_feed; feed; feed = feed->next_feed) {
int fd;
if (avio_check(feed->feed_filename, AVIO_FLAG_READ) > 0) {
@ -3847,7 +3847,7 @@ static void compute_bandwidth(void)
int i;
FFStream *stream;
for(stream = first_stream; stream != NULL; stream = stream->next) {
for(stream = first_stream; stream; stream = stream->next) {
bandwidth = 0;
for(i=0;i<stream->nb_streams;i++) {
AVStream *st = stream->streams[i];
@ -4294,7 +4294,7 @@ static int parse_ffconfig(const char *filename)
FFStream *sfeed;
sfeed = first_feed;
while (sfeed != NULL) {
while (sfeed) {
if (!strcmp(sfeed->filename, arg))
break;
sfeed = sfeed->next_feed;

View File

@ -314,7 +314,7 @@ static av_cold int X264_close(AVCodecContext *avctx)
#define OPT_STR(opt, param) \
do { \
int ret; \
if (param!=NULL && (ret = x264_param_parse(&x4->params, opt, param)) < 0) { \
if (param && (ret = x264_param_parse(&x4->params, opt, param)) < 0) { \
if(ret == X264_PARAM_BAD_NAME) \
av_log(avctx, AV_LOG_ERROR, \
"bad option '%s': '%s'\n", opt, param); \

View File

@ -1603,7 +1603,7 @@ static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples,
/* get output buffer */
if (!samples) {
av_assert0(s->frame != NULL);
av_assert0(s->frame);
s->frame->nb_samples = s->avctx->frame_size;
if ((ret = ff_get_buffer(s->avctx, s->frame, 0)) < 0)
return ret;

View File

@ -54,7 +54,7 @@ AVCodecParserContext *av_parser_init(int codec_id)
if (codec_id == AV_CODEC_ID_NONE)
return NULL;
for (parser = av_first_parser; parser != NULL; parser = parser->next) {
for (parser = av_first_parser; parser; parser = parser->next) {
if (parser->codec_ids[0] == codec_id ||
parser->codec_ids[1] == codec_id ||
parser->codec_ids[2] == codec_id ||

View File

@ -110,7 +110,7 @@ static void frame_list_remove_samples(FrameList *frame_list, int nb_samples)
int samples = nb_samples;
while (samples > 0) {
FrameInfo *info = frame_list->list;
av_assert0(info != NULL);
av_assert0(info);
if (info->nb_samples <= samples) {
samples -= info->nb_samples;
frame_list->list = info->next;
@ -142,7 +142,7 @@ static int frame_list_add_frame(FrameList *frame_list, int nb_samples, int64_t p
frame_list->list = info;
frame_list->end = info;
} else {
av_assert0(frame_list->end != NULL);
av_assert0(frame_list->end);
frame_list->end->next = info;
frame_list->end = info;
}

View File

@ -265,7 +265,7 @@ int put_image (vf_instance_t *vf, mp_image_t *src, double pts)
dst = ff_vf_get_image (vf->next, src->imgfmt, MP_IMGTYPE_EXPORT, 0, src->w, src->h);
for (i = 0; i < ((src->num_planes>1)?3:1); i++) {
if (eq2->param[i].adjust != NULL) {
if (eq2->param[i].adjust) {
dst->planes[i] = eq2->buf[i];
dst->stride[i] = eq2->buf_w[i];
@ -439,7 +439,7 @@ int query_format (vf_instance_t *vf, unsigned fmt)
static
void uninit (vf_instance_t *vf)
{
if (vf->priv != NULL) {
if (vf->priv) {
free (vf->priv->buf[0]);
free (vf->priv);
}
@ -482,7 +482,7 @@ int vf_open(vf_instance_t *vf, char *args)
eq2->ggamma = 1.0;
eq2->bgamma = 1.0;
if (args != NULL) {
if (args) {
par[0] = 1.0;
par[1] = 1.0;
par[2] = 0.0;

View File

@ -64,15 +64,15 @@ static int lrc_write_header(AVFormatContext *s)
}
for(metadata_item = NULL;
(metadata_item = av_dict_get(s->metadata, "", metadata_item,
AV_DICT_IGNORE_SUFFIX)) != NULL;) {
AV_DICT_IGNORE_SUFFIX));) {
char *delim;
if(!metadata_item->value[0]) {
continue;
}
while((delim = strchr(metadata_item->value, '\n')) != NULL) {
while((delim = strchr(metadata_item->value, '\n'))) {
*delim = ' ';
}
while((delim = strchr(metadata_item->value, '\r')) != NULL) {
while((delim = strchr(metadata_item->value, '\r'))) {
*delim = ' ';
}
avio_printf(s->pb, "[%s:%s]\n",

View File

@ -1772,7 +1772,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
extradata_offset = FFMIN(track->codec_priv.size, 18);
} else if (!strcmp(track->codec_id, "A_QUICKTIME")
&& (track->codec_priv.size >= 86)
&& (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_movaudio_tags, fourcc);
if (ff_codec_get_id(ff_codec_movaudio_tags, AV_RL32(track->codec_priv.data))) {

View File

@ -3081,7 +3081,7 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
}
ptr = buffer;
while ((ptr = av_stristr(ptr, "systemBitrate=\"")) != NULL) {
while ((ptr = av_stristr(ptr, "systemBitrate=\""))) {
ptr += sizeof("systemBitrate=\"") - 1;
c->bitrates_count++;
c->bitrates = av_realloc_f(c->bitrates, c->bitrates_count, sizeof(*c->bitrates));

View File

@ -71,7 +71,7 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
{
AVCodecContext *codec = stream->codec;
assert(codec->codec_id == AV_CODEC_ID_H264);
assert(h264_data != NULL);
assert(h264_data);
if (!strcmp(attr, "packetization-mode")) {
av_log(s, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value));

View File

@ -98,7 +98,7 @@ static int ff_sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from,
if (msg_flags)
*msg_flags = inmsg.msg_flags;
for (cmsg = CMSG_FIRSTHDR(&inmsg); cmsg != NULL;
for (cmsg = CMSG_FIRSTHDR(&inmsg); cmsg;
cmsg = CMSG_NXTHDR(&inmsg, cmsg)) {
if ((IPPROTO_SCTP == cmsg->cmsg_level) &&
(SCTP_SNDRCV == cmsg->cmsg_type))

View File

@ -150,7 +150,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
avio_printf(s->pb, " codecs=\"%s\"", get_codec_name(codec->codec_id));
lang = av_dict_get(s->streams[as->streams[0]]->metadata, "language", NULL, 0);
if (lang != NULL) avio_printf(s->pb, " lang=\"%s\"", lang->value);
if (lang) avio_printf(s->pb, " lang=\"%s\"", lang->value);
if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
avio_printf(s->pb, " width=\"%d\"", codec->width);

View File

@ -748,7 +748,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
options[numOfUnknownOptions] = NULL;
/* replace stuff from the replace Table */
for(i=0; replaceTable[2*i]!=NULL; i++){
for(i=0; replaceTable[2*i]; i++){
if(!strcmp(replaceTable[2*i], filterName)){
int newlen= strlen(replaceTable[2*i + 1]);
int plen;
@ -768,7 +768,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
}
}
for(i=0; filters[i].shortName!=NULL; i++){
for(i=0; filters[i].shortName; i++){
if( !strcmp(filters[i].longName, filterName)
|| !strcmp(filters[i].shortName, filterName)){
ppMode->lumMode &= ~filters[i].mask;
@ -787,7 +787,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
int o;
ppMode->minAllowedY= 16;
ppMode->maxAllowedY= 234;
for(o=0; options[o]!=NULL; o++){
for(o=0; options[o]; o++){
if( !strcmp(options[o],"fullyrange")
||!strcmp(options[o],"f")){
ppMode->minAllowedY= 0;
@ -801,7 +801,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
int o;
int numOfNoises=0;
for(o=0; options[o]!=NULL; o++){
for(o=0; options[o]; o++){
char *tail;
ppMode->maxTmpNoise[numOfNoises]=
strtol(options[o], &tail, 0);
@ -816,7 +816,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
|| filters[i].mask == V_A_DEBLOCK || filters[i].mask == H_A_DEBLOCK){
int o;
for(o=0; options[o]!=NULL && o<2; o++){
for(o=0; options[o] && o<2; o++){
char *tail;
int val= strtol(options[o], &tail, 0);
if(tail==options[o]) break;
@ -830,7 +830,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
int o;
ppMode->forcedQuant= 15;
for(o=0; options[o]!=NULL && o<1; o++){
for(o=0; options[o] && o<1; o++){
char *tail;
int val= strtol(options[o], &tail, 0);
if(tail==options[o]) break;