[MPlayer-cvslog] r32630 - in trunk: gui/interface.c libmenu/menu_pt.c mplayer.c path.c path.h
Clément Bœsch
ubitux at gmail.com
Wed Nov 17 16:52:58 CET 2010
On Wed, Nov 17, 2010 at 06:33:22PM +0300, Yuriy Kaminskiy wrote:
> cboesch wrote:
> > Author: cboesch
> > Date: Tue Nov 16 22:06:52 2010
> > New Revision: 32630
> >
> > Log:
> > Export mp_basename in a function instead of duplicate macros in various places
> >
> > Modified:
> > trunk/gui/interface.c
> > trunk/libmenu/menu_pt.c
> > trunk/mplayer.c
> > trunk/path.c
> > trunk/path.h
> >
> [...]
> > Modified: trunk/path.c
> > ==============================================================================
> > --- trunk/path.c Tue Nov 16 20:58:54 2010 (r32629)
> > +++ trunk/path.c Tue Nov 16 22:06:52 2010 (r32630)
> > @@ -193,3 +193,16 @@ void set_codec_path(const char *path)
> > strcpy(codec_path, path);
> > needs_free = 1;
> > }
> > +
> > +const char *mp_basename(const char *path)
> > +{
> > + char *s;
> > +
> > +#if HAVE_DOS_PATHS
> > + s = strrchr(path, '\\');
> > + if (s)
> > + return s + 1;
> > +#endif
> > + s = strrchr(path, '/');
> > + return s ? s + 1 : s;
> 1) Return NULL and sigsegv on filenames without /.
> s/: s;/: path;/
Huh, strange I didn't noticed it, and it doesn't crash here. Anyway the
patch seems indeed good to me.
> 2) Not that I care about DoSish OS, but it does not work nice with both \ and /
> in paths, like c:\foo/bar.avi
>
What about c:/foo\bar.avi?
> > +}
> >
> > Modified: trunk/path.h
> > ==============================================================================
> > --- trunk/path.h Tue Nov 16 20:58:54 2010 (r32629)
> > +++ trunk/path.h Tue Nov 16 22:06:52 2010 (r32630)
> > @@ -26,5 +26,6 @@ extern char *codec_path;
> > char *get_path(const char *filename);
> > void set_path_env(void);
> > void set_codec_path(const char *path);
> > +const char *mp_basename(const char *path);
> >
> > #endif /* MPLAYER_PATH_H */
>
> Index: MPlayer-20101117+lavc-mt/path.c
> ===================================================================
> --- MPlayer-20101117+lavc-mt.orig/path.c 2010-11-17 18:25:16.000000000 +0300
> +++ MPlayer-20101117+lavc-mt/path.c 2010-11-17 18:28:39.000000000 +0300
> @@ -204,5 +204,5 @@ const char *mp_basename(const char *path
> return s + 1;
> #endif
> s = strrchr(path, '/');
> - return s ? s + 1 : s;
> + return s ? s + 1 : path;
> }
> Index: MPlayer-20101117+lavc-mt/path.c
> ===================================================================
> --- MPlayer-20101117+lavc-mt.orig/path.c 2010-11-17 18:29:16.000000000 +0300
> +++ MPlayer-20101117+lavc-mt/path.c 2010-11-17 18:29:36.000000000 +0300
> @@ -201,7 +201,7 @@ const char *mp_basename(const char *path
> #if HAVE_DOS_PATHS
> s = strrchr(path, '\\');
> if (s)
> - return s + 1;
> + path = s + 1;
> #endif
> s = strrchr(path, '/');
> return s ? s + 1 : path;
> _______________________________________________
> MPlayer-cvslog mailing list
> MPlayer-cvslog at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-cvslog
--
Clément B.
Not sent from a jesusPhone.
More information about the MPlayer-cvslog
mailing list