diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-02-25 18:29:39 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-02-25 18:29:39 +0000 |
commit | 1e9b166574c8da323fb2868876730dc5674b9a84 (patch) | |
tree | d07c9be92ecad40209a227b48b955131594f737c /src | |
parent | 46c66a2a3ee71b149cb9bd31349744a5bf532424 (diff) | |
download | mpd-1e9b166574c8da323fb2868876730dc5674b9a84.tar.gz mpd-1e9b166574c8da323fb2868876730dc5674b9a84.tar.xz mpd-1e9b166574c8da323fb2868876730dc5674b9a84.zip |
some cleanups for utf8 in playerSeek and using strncpy for copying filenames
git-svn-id: https://svn.musicpd.org/mpd/trunk@54 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r-- | src/player.c | 10 | ||||
-rw-r--r-- | src/player.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/player.c b/src/player.c index 081219e2d..5cb209334 100644 --- a/src/player.c +++ b/src/player.c @@ -165,7 +165,7 @@ int playerPlay(FILE * fp, char * utf8file) { return 0; } - strcpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file))); + strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN); pc->play = 1; if(player_pid==0 && playerInit()<0) { @@ -295,7 +295,7 @@ int queueSong(char * utf8file) { PlayerControl * pc = &(getPlayerData()->playerControl); if(pc->queueState==PLAYER_QUEUE_BLANK) { - strcpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file))); + strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN); if(0); #ifdef HAVE_MAD @@ -352,8 +352,9 @@ void playerQueueUnlock() { } } -int playerSeek(FILE * fp, char * file, float time) { +int playerSeek(FILE * fp, char * utf8file, float time) { PlayerControl * pc = &(getPlayerData()->playerControl); + char * file; if(pc->state==PLAYER_STATE_STOP) { myfprintf(fp,"%s player not currently playing\n", @@ -361,7 +362,8 @@ int playerSeek(FILE * fp, char * file, float time) { return -1; } - if(strcmp(pc->file,rmp2amp(file))!=0) strcpy(pc->file,rmp2amp(file)); + file = rmp2amp(utf8ToFsCharset(utf8file)); + if(strcmp(pc->file,file)!=0) strncpy(pc->file,file,MAXPATHLEN); /*if(playerStop(fp)<0) return -1; if(playerPlay(stderr,file)<0) return -1;*/ /*}*/ diff --git a/src/player.h b/src/player.h index 0b0578b68..43c136e3a 100644 --- a/src/player.h +++ b/src/player.h @@ -113,7 +113,7 @@ void playerQueueLock(); void playerQueueUnlock(); -int playerSeek(FILE * fp, char * file, float time); +int playerSeek(FILE * fp, char * utf8file, float time); void setPlayerCrossFade(float crossFadeInSeconds); |