[MPlayer-cvslog] r20009 - trunk/m_option.c

reimar subversion at mplayerhq.hu
Sat Sep 30 01:23:42 CEST 2006


Author: reimar
Date: Sat Sep 30 01:23:41 2006
New Revision: 20009

Modified:
   trunk/m_option.c

Log:
Fix broken parse_time_size, it would cause MPlayer to parse its parameter twice,
e.g. "mplayer file -endpos 01" would try to play the file "01", too


Modified: trunk/m_option.c
==============================================================================
--- trunk/m_option.c	(original)
+++ trunk/m_option.c	Sat Sep 30 01:23:41 2006
@@ -1178,13 +1178,7 @@
 // Time or size (-endpos)
 
 static int parse_time_size(m_option_t* opt,char *name, char *param, void* dst, int src) {
-
-  if (dst == NULL)
-    return 0;
-
-  m_time_size_t* ts = dst;
-  ts->pos=0;
-
+  m_time_size_t ts;
   char unit[4];
   int a,b;
   float d;
@@ -1193,9 +1187,10 @@
   if (param == NULL || strlen(param) == 0)
     return M_OPT_MISSING_PARAM;
   
+  ts.pos=0;
   /* End at size parsing */
   if(sscanf(param, "%lf%3s", &end_at, unit) == 2) {
-    ts->type = END_AT_SIZE;
+    ts.type = END_AT_SIZE;
     if(!strcasecmp(unit, "b"))
       ;
     else if(!strcasecmp(unit, "kb"))
@@ -1205,11 +1200,11 @@
     else if(!strcasecmp(unit, "gb"))
       end_at *= 1024*1024*1024;
     else
-      ts->type = END_AT_NONE;
+      ts.type = END_AT_NONE;
 
-    if (ts->type == END_AT_SIZE) {
-      ts->pos  = end_at;
-      return 1;
+    if (ts.type == END_AT_SIZE) {
+      ts.pos  = end_at;
+      goto out;
     }
   }
 
@@ -1227,9 +1222,11 @@
     return M_OPT_INVALID;
   }
   
-  ts->type = END_AT_TIME;
-  ts->pos  = end_at;
-
+  ts.type = END_AT_TIME;
+  ts.pos  = end_at;
+out:
+  if(dst)
+    *(m_time_size_t *)dst = ts;
   return 1;
 }
 



More information about the MPlayer-cvslog mailing list