[MPlayer-dev-eng] octal and hex surprise and perplex

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Jun 10 22:31:49 CEST 2006


Hi,
On Fri, Jun 09, 2006 at 03:44:13AM -0400, Alan Curry wrote:
> Rather than remove the highly useful ability to specify DVD tracks by octal
> number (which would inevitably lead to a huge debate over which _other_
> integers should be decimal-only on the command line and/or in a config file)

Sorry, you won't get around the problem :-P
I would suggest removing support for octal numbers (attached untested
patch would be one example, though I find it a bit ugly).

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: m_option.c
===================================================================
--- m_option.c	(revision 18673)
+++ m_option.c	(working copy)
@@ -138,12 +138,15 @@
 static int parse_int(m_option_t* opt,char *name, char *param, void* dst, int src) {
   long tmp_int;
   char *endptr;
+  char *tmp = param;
   src = 0;
 
   if (param == NULL)
     return M_OPT_MISSING_PARAM;
 
-  tmp_int = strtol(param, &endptr, 0);
+  if (tmp[0] == '0' && tmp[1] != 'x')
+    while (tmp[0] == '0') tmp++;
+  tmp_int = strtol(tmp, &endptr, 0);
   if (*endptr) {
     mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The %s option must be an integer: %s\n",name, param);
     return M_OPT_INVALID;


More information about the MPlayer-dev-eng mailing list