[MPlayer-dev-eng] [PATCH 1/3] Add mp_dir_join function.

Clément Bœsch ubitux at gmail.com
Sat Jan 29 14:00:49 CET 2011


On Sat, Jan 29, 2011 at 01:51:18PM +0100, Reimar Döffinger wrote:
> On Sun, Jan 23, 2011 at 08:46:26PM +0100, Clément Bœsch wrote:
> > +    int dirlen = strlen(dir);
> > +    int i      = dirlen - 1;
> 
> 
> > +    if (i < 0 || dir[i] == '/')
> 
> I do not know if it really matters, but dirlen can be < 0.

You mean i?

> I can even be 0 on 64 bit systems without dir being an empty
> string.
> Returning NULL should be ok in these cases, but I do not
> know if whatever the current code ends up doing is ok.

We have i < 0 just in the case of dir="". Then this empty string is sent
to mp_path_join which called mp_dirname on it. mp_dirname then returns the
a new allocated string with "./" so it can be processed normally.

-- 
Clément B.


More information about the MPlayer-dev-eng mailing list