[FFmpeg-devel] [RFC]lavu/opt: Use && instead of * in boolean expression

Carl Eugen Hoyos cehoyos at ag.or.at
Fri May 5 02:32:45 EEST 2017


Hi!

It may be better to disable the warning.

Carl Eugen
-------------- next part --------------
From ab94367f502ab00f643a78608593eb9522e5c3be Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Fri, 5 May 2017 01:30:19 +0200
Subject: [PATCH] lavu/opt: Use "&&" instead of "*" in boolean expression.

Fixes the following warning:
libavutil/opt.c:101:47: warning: '*' in boolean context, suggest '&&' instead
---
 libavutil/opt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 6f87078..df88663 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -98,7 +98,7 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int
 {
     if (o->type != AV_OPT_TYPE_FLAGS &&
         (!den || o->max * den < num * intnum || o->min * den > num * intnum)) {
-        num = den ? num * intnum / den : (num * intnum ? INFINITY : NAN);
+        num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN);
         av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range [%g - %g]\n",
                num, o->name, o->min, o->max);
         return AVERROR(ERANGE);
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list