[PATCH] fixed if check before strchr

Joerg Mayer jmayer at loplof.de
Tue May 6 16:56:38 CDT 2008


On Tue, May 06, 2008 at 10:00:38PM +0200, Eric Pouech wrote:
> >              spath = strchr(spath, '\\');
> > -            if (!spath) spath = strchr(spath, '/');
> > +            if (spath) spath = strchr(spath, '/');

So the correct solution would be something like

bpath=strchr(spath, '\\');
spath=strchr(spath, '/');
if (bpath && spath)
	spath=MIN(bpath, spath);
else
	spath=MAX(bpath,spath);

?
Btw, are Unix filenames that contain a '\' a problem?

 Ciao
       Joerg
-- 
Joerg Mayer                                           <jmayer at loplof.de>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.



More information about the wine-devel mailing list