]> git.sesse.net Git - x264/blobdiff - filters/filters.c
Bump dates to 2016
[x264] / filters / filters.c
index 1ea888ce54f99d12741be840e2d9744d72566fdf..aecd296bd53c4519917b3d1b052425708a8798b4 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * filters.c: common filter functions
  *****************************************************************************
- * Copyright (C) 2010-2014 x264 project
+ * Copyright (C) 2010-2016 x264 project
  *
  * Authors: Diogo Franco <diogomfranco@gmail.com>
  *          Steven Walters <kemuri9@gmail.com>
@@ -32,19 +32,20 @@ char **x264_split_string( char *string, char *sep, int limit )
     if( !string )
         return NULL;
     int sep_count = 0;
+    int sep_len = strlen( sep );
     char *tmp = string;
-    while( ( tmp = ( tmp = strstr( tmp, sep ) ) ? tmp + strlen( sep ) : 0 ) )
+    while( ( tmp = ( tmp = strstr( tmp, sep ) ) ? tmp + sep_len : 0 ) )
         ++sep_count;
     if( sep_count == 0 )
     {
         if( string[0] == '\0' )
-            return calloc( 1, sizeof( char** ) );
-        char **ret = calloc( 2, sizeof( char** ) );
+            return calloc( 1, sizeof( char* ) );
+        char **ret = calloc( 2, sizeof( char* ) );
         ret[0] = strdup( string );
         return ret;
     }
 
-    char **split = calloc( ( limit > 0 ? limit : sep_count ) + 2, sizeof(char**) );
+    char **split = calloc( ( limit > 0 ? limit : sep_count ) + 2, sizeof(char*) );
     int i = 0;
     char *str = strdup( string );
     assert( str );
@@ -61,7 +62,7 @@ char **x264_split_string( char *string, char *sep, int limit )
             int j = i-1;
             if( esc )
                 esc[0] = '\0';
-            split[j] = realloc( split[j], strlen( split[j] ) + strlen( sep ) + strlen( tok ) + 1 );
+            split[j] = realloc( split[j], strlen( split[j] ) + sep_len + strlen( tok ) + 1 );
             assert( split[j] );
             strcat( split[j], sep );
             strcat( split[j], tok );
@@ -104,7 +105,7 @@ char **x264_split_options( const char *opt_str, const char *options[] )
     while( options[options_count] != NULL )
         ++options_count;
 
-    char **opts = calloc( split_count * 2 + 2, sizeof( char ** ) );
+    char **opts = calloc( split_count * 2 + 2, sizeof( char * ) );
     char **arg = NULL;
     int opt = 0, found_named = 0, invalid = 0;
     for( int i = 0; split[i] != NULL; i++, invalid = 0 )