diff --git a/common/av_common.c b/common/av_common.c index 805ea4bed2..b3ca3d3c85 100644 --- a/common/av_common.c +++ b/common/av_common.c @@ -340,7 +340,7 @@ static void resolve_positional_arg(void *avobj, char **name) char *end = NULL; int pos = strtol(*name + 1, &end, 10); - if (!end || *end || pos < 0) + if (*end || pos < 0) return; const AVOption *opt = NULL; diff --git a/demux/demux.c b/demux/demux.c index 3263f3f0c6..ca8e0909d6 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -2869,7 +2869,7 @@ static int decode_float(char *str, float *out) float dec_val; dec_val = strtod(str, &rest); - if (!rest || (rest == str) || !isfinite(dec_val)) + if (rest == str || !isfinite(dec_val)) return -1; *out = dec_val; diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 4ce8085a43..25659be260 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -660,7 +660,7 @@ static int dict_get_decimal(AVDictionary *dict, const char *entry, int def) if (e && e->value) { char *end = NULL; long int r = strtol(e->value, &end, 10); - if (end && !end[0] && r >= INT_MIN && r <= INT_MAX) + if (!end[0] && r >= INT_MIN && r <= INT_MAX) return r; } return def; diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index e9c0ddbdfb..acbd75f6d9 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -1839,7 +1839,7 @@ static void parse_vorbis_chmap(struct mp_chmap *channels, unsigned char *data, snprintf(smask, sizeof(smask), "%.*s", (int)(len - 34), data + 34); char *end = NULL; uint32_t mask = strtol(smask, &end, 0); - if (!end || end[0]) + if (end[0]) mask = 0; struct mp_chmap chmask = {0}; mp_chmap_from_waveext(&chmask, mask); diff --git a/options/m_option.c b/options/m_option.c index e544bc929d..25c17ab0a6 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -786,7 +786,7 @@ static int choice_get(const m_option_t *opt, void *ta_parent, if (alt) { char *end = NULL; ival = strtol(alt->name, &end, 10); - if (end && !end[0]) + if (!end[0]) alt = NULL; } if (alt) { diff --git a/stream/stream_file.c b/stream/stream_file.c index c7540a8a5f..441c5fd469 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -300,7 +300,7 @@ static int open_f(stream_t *stream, const struct stream_open_args *args) stream->is_local_fs = false; char *begin = strstr(stream->url, "://") + 3, *end = NULL; p->fd = strtol(begin, &end, 0); - if (!end || end == begin || end[0] || p->fd < 0) { + if (end == begin || end[0] || p->fd < 0) { MP_ERR(stream, "Invalid FD number: %s\n", stream->url); return STREAM_ERROR; }