avutil/opt.c: fix bug when parsing option
authorMuhammad Faiz <mfcc64@gmail.com>
Mon, 21 Jul 2014 09:31:41 +0000 (02:31 -0700)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 21 Jul 2014 13:20:39 +0000 (15:20 +0200)
fix these strange behavior:
-af flanger=delay=10 [OK]
-af flanger=delay=1e1 [OK]
-af flanger=delay=1e+1 [Error]
-af flanger=delay=0.1 [OK]
-af flanger=delay=1e-1 [Error]

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/opt.c

index 505e010..8e9802f 100644 (file)
@@ -219,7 +219,7 @@ static int set_string_number(void *obj, void *target_obj, const AVOption *o, con
                 buf[i++] = *val;
         }
 
-        for (; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++)
+        for (; i < sizeof(buf) - 1 && val[i] && (o->type != AV_OPT_TYPE_FLAGS || val[i] != '+' && val[i] != '-'); i++)
             buf[i] = val[i];
         buf[i] = 0;