[x264-devel] Support case-independent string options

Vittorio Giovara git at videolan.org
Thu Nov 13 13:52:04 CET 2014


x264 | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Mon Sep 29 18:51:30 2014 +0100| [b85a74a22f79c8722674c4cfd7cddf5f54c8421d] | committer: Fiona Glaser

Support case-independent string options

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=b85a74a22f79c8722674c4cfd7cddf5f54c8421d
---

 common/common.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/common/common.c b/common/common.c
index a9e1c73..aa34fb5 100644
--- a/common/common.c
+++ b/common/common.c
@@ -517,7 +517,7 @@ int x264_param_apply_profile( x264_param_t *param, const char *profile )
 static int parse_enum( const char *arg, const char * const *names, int *dst )
 {
     for( int i = 0; names[i]; i++ )
-        if( !strcmp( arg, names[i] ) )
+        if( !strcasecmp( arg, names[i] ) )
         {
             *dst = i;
             return 0;
@@ -540,12 +540,12 @@ static int parse_cqm( const char *str, uint8_t *cqm, int length )
 static int x264_atobool( const char *str, int *b_error )
 {
     if( !strcmp(str, "1") ||
-        !strcmp(str, "true") ||
-        !strcmp(str, "yes") )
+        !strcasecmp(str, "true") ||
+        !strcasecmp(str, "yes") )
         return 1;
     if( !strcmp(str, "0") ||
-        !strcmp(str, "false") ||
-        !strcmp(str, "no") )
+        !strcasecmp(str, "false") ||
+        !strcasecmp(str, "no") )
         return 0;
     *b_error = 1;
     return 0;
@@ -614,7 +614,7 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
     OPT("asm")
     {
         p->cpu = isdigit(value[0]) ? atoi(value) :
-                 !strcmp(value, "auto") || atobool(value) ? x264_cpu_detect() : 0;
+                 !strcasecmp(value, "auto") || atobool(value) ? x264_cpu_detect() : 0;
         if( b_error )
         {
             char *buf = strdup(value);
@@ -635,14 +635,14 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
     }
     OPT("threads")
     {
-        if( !strcmp(value, "auto") )
+        if( !strcasecmp(value, "auto") )
             p->i_threads = X264_THREADS_AUTO;
         else
             p->i_threads = atoi(value);
     }
     OPT("lookahead-threads")
     {
-        if( !strcmp(value, "auto") )
+        if( !strcasecmp(value, "auto") )
             p->i_lookahead_threads = X264_THREADS_AUTO;
         else
             p->i_lookahead_threads = atoi(value);
@@ -651,7 +651,7 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
         p->b_sliced_threads = atobool(value);
     OPT("sync-lookahead")
     {
-        if( !strcmp(value, "auto") )
+        if( !strcasecmp(value, "auto") )
             p->i_sync_lookahead = X264_SYNC_LOOKAHEAD_AUTO;
         else
             p->i_sync_lookahead = atoi(value);



More information about the x264-devel mailing list