From e8757fb88311329a35d874b43ff1aaf095ed4147 Mon Sep 17 00:00:00 2001 From: cboesch Date: Tue, 16 Nov 2010 21:06:52 +0000 Subject: path.c: add function for mp_basename, remove duplicated macros git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32630 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix crash on path without directories. Regression introduced in r32630. Patch by Yuriy Kaminskiy yumkam at mail ru. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32631 b3059339-0415-0410-9bf9-f77b7e298cf2 Handle correctly paths with mixed '/' and '\' in it. Patch by Yuriy Kaminskiy (yumkam at mail ru) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32632 b3059339-0415-0410-9bf9-f77b7e298cf2 Handle ':' on systems with DOS paths: it allows paths like C:foo.avi. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32642 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 4707936447..4a36afd2f2 100644 --- a/mplayer.c +++ b/mplayer.c @@ -361,8 +361,6 @@ int use_filename_title; #include "metadata.h" -#define mp_basename2(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1)) - const void *mpctx_get_video_out(MPContext *mpctx) { return mpctx->video_out; @@ -477,7 +475,7 @@ char *get_metadata(struct MPContext *mpctx, metadata_t type) { case META_NAME: { - return strdup (mp_basename2 (mpctx->filename)); + return strdup(mp_basename(mpctx->filename)); } case META_VIDEO_CODEC: @@ -1082,8 +1080,6 @@ static int libmpdemux_was_interrupted(struct MPContext *mpctx, int stop_play) return stop_play; } -#define mp_basename(s) (strrchr(s,'\\')==NULL?(mp_basename2(s)):(strrchr(s,'\\')+1)) - static int playtree_add_playlist(struct MPContext *mpctx, play_tree_t* entry) { play_tree_add_bpf(entry,mpctx->filename); @@ -3661,7 +3657,7 @@ while (opts->player_idle_mode && !mpctx->filename) { mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"\nPlaying %s.\n", filename_recode(mpctx->filename)); if(use_filename_title && opts->vo_wintitle == NULL) - opts->vo_wintitle = strdup(mp_basename2(mpctx->filename)); + opts->vo_wintitle = strdup(mp_basename(mpctx->filename)); } if (edl_filename) { @@ -3857,7 +3853,8 @@ if (mpctx->demuxer && mpctx->demuxer->type==DEMUXER_TYPE_PLAYLIST) current_module="handle_demux_playlist"; while (ds_get_packet(mpctx->demuxer->video,&playlist_entry)>0) { - char *temp, *bname; + char *temp; + const char *bname; mp_msg(MSGT_CPLAYER,MSGL_V,"Adding file %s to element entry.\n", filename_recode(playlist_entry)); -- cgit v1.2.3