[MPlayer-dev-eng] [PATCH] Fix parse comment bug for input.conf

Ulion ulion2002 at gmail.com
Tue Oct 16 15:58:27 CEST 2007


2007/10/16, Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de>:
> Hello,
> On Tue, Oct 16, 2007 at 09:43:35AM -0400, Rich Felker wrote:
> > On Tue, Oct 16, 2007 at 03:02:04PM +0800, Ulion wrote:
> > > For a reported bug:
> > > http://lists.mplayerhq.hu/pipermail/mplayer-users/2007-October/069603.html
> > > I tested, it is a bug when parsing input comand followed by comment in
> > > the same line.
> > > I make a patch for this, so when parse cmd, comment will be ignored.
> >
> > Are you sure this does not break bindings/commands with # in them?
>
> I think not, there is a strchr for a space directly before that IIRC, so
> only the " #" sequence matches.
> The code looks a bit weird though, it looks like using only tab to
> separate the arguments won't work (I didn't check the code thoroughly
> though).

Agree, that's another bug. Can be fixed by:

Index: input/input.c
===================================================================
--- input/input.c       (revision 24795)
+++ input/input.c       (working copy)
@@ -754,8 +754,8 @@
   ptr = str;

   for(i=0; ptr && i < MP_CMD_MAX_ARGS; i++) {
-    ptr = strchr(ptr,' ');
-    if(!ptr) break;
+    while(ptr[0] != ' ' && ptr[0] != '\t' && ptr[0] != '\0') ptr++;
+    if(ptr[0] == '\0') break;
     while(ptr[0] == ' ' || ptr[0] == '\t') ptr++;
     if(ptr[0] == '\0') break;
     cmd->args[i].type = cmd_def->args[i].type;

-- 
Ulion



More information about the MPlayer-dev-eng mailing list