From e09a20eb39776192715025f52637edf6208488e9 Mon Sep 17 00:00:00 2001 From: Steven Walters Date: Wed, 9 Dec 2009 16:03:19 -0800 Subject: [PATCH] Fix zone parsing on mingw 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index ee932bc8..02164a4a 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -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 ); } -- 2.40.0