summaryrefslogtreecommitdiffstats
path: root/libass/ass_utils.c
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2014-05-17 22:47:45 +0100
committerOleg Oshmyan <chortos@inbox.lv>2014-06-06 15:08:16 +0100
commitcc9aaeb4596af2c57d09ae8853670b5c811d19cd (patch)
tree2aebc55cae7b3dfa93b19048850d0ea50c64485c /libass/ass_utils.c
parent722fc526e33df96994bd38f4ae7853d20d2e2544 (diff)
downloadlibass-cc9aaeb4596af2c57d09ae8853670b5c811d19cd.tar.bz2
libass-cc9aaeb4596af2c57d09ae8853670b5c811d19cd.tar.xz
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.
Diffstat (limited to 'libass/ass_utils.c')
-rw-r--r--libass/ass_utils.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/libass/ass_utils.c b/libass/ass_utils.c
index 58ee96d..c545012 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