]> git.videolan.org Git - x264.git/commitdiff
Fix zone parsing on mingw
authorSteven Walters <kemuri9@gmail.com>
Thu, 10 Dec 2009 00:03:19 +0000 (16:03 -0800)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Fri, 11 Dec 2009 01:11:26 +0000 (17:11 -0800)
Due to MinGW evidently being in the hands of a pack of phenomenal idiots, MinGW does not have strtok_r, a basic string function.
As such, remove the dependency on strtok_r in zone parsing.
Previously, using zones for anything other than ratecontrol failed.

encoder/ratecontrol.c

index 38ef95e5ba89688b45e915549ec7fdc691d12a41..03b603baac74e8266c9a0a6fa336455c02202a80 100644 (file)
@@ -870,7 +870,7 @@ static int parse_zones( x264_t *h )
     int i;
     if( h->param.rc.psz_zones && !h->param.rc.i_zones )
     {
-        char *psz_zones, *p, *tok, UNUSED *saveptr;
+        char *psz_zones, *p;
         CHECKED_MALLOC( psz_zones, strlen( h->param.rc.psz_zones )+1 );
         strcpy( psz_zones, h->param.rc.psz_zones );
         h->param.rc.i_zones = 1;
@@ -880,10 +880,11 @@ static int parse_zones( x264_t *h )
         p = psz_zones;
         for( i = 0; i < h->param.rc.i_zones; i++ )
         {
-            tok = strtok_r( p, "/", &saveptr );
-            if( !tok || parse_zone( h, &h->param.rc.zones[i], tok ) )
+            int i_tok = strcspn( p, "/" );
+            p[i_tok] = 0;
+            if( parse_zone( h, &h->param.rc.zones[i], p ) )
                 return -1;
-            p = NULL;
+            p += i_tok + 1;
         }
         x264_free( psz_zones );
     }