[MPlayer-cvslog] r33602 - trunk/sub/vobsub.c

cboesch subversion at mplayerhq.hu
Sun Jun 12 12:56:03 CEST 2011


Author: cboesch
Date: Sun Jun 12 12:56:03 2011
New Revision: 33602

Log:
vobsub: simplify origin parsing.

Modified:
   trunk/sub/vobsub.c

Modified: trunk/sub/vobsub.c
==============================================================================
--- trunk/sub/vobsub.c	Sun Jun 12 12:55:24 2011	(r33601)
+++ trunk/sub/vobsub.c	Sun Jun 12 12:56:03 2011	(r33602)
@@ -704,17 +704,14 @@ static int vobsub_parse_timestamp(vobsub
 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)


More information about the MPlayer-cvslog mailing list