[MPlayer-cvslog] r32642 - trunk/path.c

Clément Bœsch ubitux at gmail.com
Sun Nov 21 21:33:16 CET 2010


On Sun, Nov 21, 2010 at 09:09:32PM +0100, Reimar Döffinger wrote:
> On Sun, Nov 21, 2010 at 08:46:37PM +0100, cboesch wrote:
> > Author: cboesch
> > Date: Sun Nov 21 20:46:37 2010
> > New Revision: 32642
> > 
> > Log:
> > Handle ':' on systems with DOS paths: it allows paths like C:foo.avi.
> > 
> > Modified:
> >    trunk/path.c
> > 
> > Modified: trunk/path.c
> > ==============================================================================
> > --- trunk/path.c	Sun Nov 21 18:07:34 2010	(r32641)
> > +++ trunk/path.c	Sun Nov 21 20:46:37 2010	(r32642)
> > @@ -202,6 +202,9 @@ const char *mp_basename(const char *path
> >      s = strrchr(path, '\\');
> >      if (s)
> >          path = s + 1;
> > +    s = strrchr(path, ':');
> > +    if (s)
> > +        path = s + 1;
> 
> That's not right, now
> c:\test.avi
> will have a basename of
> \test.avi
> You must only search for ':' if neither / or \ exists
> in the path.

No, it works fine:

s = strrchr(path, '\\')
path = s + 1

  C:\test.avi
     ^
     `-- path

s = strrchr(path, ':')

     test.avi
     ^
     `-- path

C:\ is not part of the path anymore. Test confirms it.

-- 
Clément B.
Not sent from a jesusPhone.


More information about the MPlayer-cvslog mailing list