summaryrefslogtreecommitdiffstats
path: root/libass/ass_utils.c
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@blackbox>2009-08-12 06:20:26 +0200
committerGrigori Goronzy <greg@blackbox>2009-08-12 06:20:26 +0200
commit8a9ef5e2014068a348cb3e0f965113a827d93cd7 (patch)
treee94067b5011b2b4ce251dc5f2348022667fd3eb6 /libass/ass_utils.c
parente8032bc820dd0079db103165cf3d4d84f429edb7 (diff)
downloadlibass-8a9ef5e2014068a348cb3e0f965113a827d93cd7.tar.bz2
libass-8a9ef5e2014068a348cb3e0f965113a827d93cd7.tar.xz
Always parse colors as hex for ASS tracks
According to the ASS specification, colors can only be specified in hex. Modify the color parsing accordingly; this especially means that colors where the hex sigil (the "H") is missing can now be parsed.
Diffstat (limited to 'libass/ass_utils.c')
-rw-r--r--libass/ass_utils.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libass/ass_utils.c b/libass/ass_utils.c
index e8fce67..6ca78b8 100644
--- a/libass/ass_utils.c
+++ b/libass/ass_utils.c
@@ -74,11 +74,12 @@ int mystrtod(char **p, double *res)
return 0;
}
-int strtocolor(ASS_Library *library, char **q, uint32_t *res)
+int strtocolor(ASS_Library *library, char **q, uint32_t *res, int hex)
{
uint32_t color = 0;
int result;
char *p = *q;
+ int base = hex ? 16 : 10;
if (*p == '&')
++p;
@@ -89,7 +90,7 @@ int strtocolor(ASS_Library *library, char **q, uint32_t *res)
++p;
result = mystrtou32(&p, 16, &color);
} else {
- result = mystrtou32(&p, 0, &color);
+ result = mystrtou32(&p, base, &color);
}
{