Mercurial > mplayer.hg
changeset 33514:30e54bd66d39
vobsub: simplify origin parsing.
author | cboesch |
---|---|
date | Sun, 12 Jun 2011 10:56:03 +0000 |
parents | 65e6c1de4afa |
children | c80d57ec577b |
files | sub/vobsub.c |
diffstat | 1 files changed, 8 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/sub/vobsub.c Sun Jun 12 10:55:24 2011 +0000 +++ b/sub/vobsub.c Sun Jun 12 10:56:03 2011 +0000 @@ -704,17 +704,14 @@ static int vobsub_parse_origin(vobsub_t *vob, const char *line) { // org: X,Y - char *p; - while (isspace(*line)) - ++line; - if (!isdigit(*line)) - return -1; - vob->origin_x = strtoul(line, &p, 10); - if (*p != ',') - return -1; - ++p; - vob->origin_y = strtoul(p, NULL, 10); - return 0; + unsigned x, y; + + if (sscanf(line, " %u,%u", &x, &y) == 2) { + vob->origin_x = x; + vob->origin_y = y; + return 0; + } + return -1; } unsigned int vobsub_palette_to_yuv(unsigned int pal)