[FFmpeg-devel] [PATCH] cmdutils: add OPT_INT check in parse_number_or_die()

Stefano Sabatini stefano.sabatini-lala at poste.it
Sat Apr 16 13:43:53 CEST 2011


Check that the value passed for an OPT_INT option is an int, fail
otherwise.
---
 cmdutils.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index aa30962..ff1b6aa 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -106,6 +106,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
         error= "The value for %s was %s which is not within %f - %f\n";
     else if(type == OPT_INT64 && (int64_t)d != d)
         error= "Expected int64 for %s but found %s\n";
+    else if (type == OPT_INT && (int)d != d)
+        error= "Expected int for %s but found %s\n";
     else
         return d;
     fprintf(stderr, error, context, numstr, min, max);
-- 
1.7.2.3



More information about the ffmpeg-devel mailing list