From cc9aaeb4596af2c57d09ae8853670b5c811d19cd Mon Sep 17 00:00:00 2001 From: Oleg Oshmyan Date: Sat, 17 May 2014 22:47:45 +0100 Subject: Parse override tag arguments exactly like VSFilter 2.38 Also replace strtocolor in ass_utils with string2color from ass.c, because that is more useful everywhere now. --- libass/ass_utils.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'libass/ass_utils.c') diff --git a/libass/ass_utils.c b/libass/ass_utils.c index 58ee96d8..c545012f 100644 --- a/libass/ass_utils.c +++ b/libass/ass_utils.c @@ -149,11 +149,9 @@ int mystrtod(char **p, double *res) return 0; } -int strtocolor(ASS_Library *library, char **q, uint32_t *res, int hex) +uint32_t string2color(ASS_Library *library, char *p, int hex) { uint32_t color = 0; - int result; - char *p = *q; int base = hex ? 16 : 10; if (*p == '&') @@ -164,9 +162,9 @@ int strtocolor(ASS_Library *library, char **q, uint32_t *res, int hex) if (*p == 'H' || *p == 'h') { ++p; - result = mystrtou32(&p, 16, &color); + mystrtou32(&p, 16, &color); } else { - result = mystrtou32(&p, base, &color); + mystrtou32(&p, base, &color); } while (*p == '&' || *p == 'H') @@ -182,12 +180,8 @@ int strtocolor(ASS_Library *library, char **q, uint32_t *res, int hex) tmp[1] = tmp[2]; tmp[2] = b; } - if (*p == '&') - ++p; - *q = p; - *res = color; - return result; + return color; } // Return a boolean value for a string -- cgit v1.2.3