[x264-devel] commit: Fix zone parsing on mingw (Steven Walters )
git version control
git at videolan.org
Fri Dec 11 02:11:20 CET 2009
x264 | branch: master | Steven Walters <kemuri9 at gmail.com> | Wed Dec 9 16:03:19 2009 -0800| [546cbb2ce2a6ee33ac7ba4eed74d543ae99a3e65] | committer: Jason Garrett-Glaser
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.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=546cbb2ce2a6ee33ac7ba4eed74d543ae99a3e65
---
encoder/ratecontrol.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 38ef95e..03b603b 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 );
}
More information about the x264-devel
mailing list