diff options
-rw-r--r-- | apps/playlist.c | 21 | ||||
-rw-r--r-- | apps/playlist.h | 2 | ||||
-rw-r--r-- | apps/wps-display.c | 3 |
3 files changed, 14 insertions, 12 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 3cd40deb45..ce812c7c67 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -111,18 +111,21 @@ int playlist_first_index(void) | |||
111 | return playlist.first_index; | 111 | return playlist.first_index; |
112 | } | 112 | } |
113 | 113 | ||
114 | void playlist_name(char *name, int name_size) | 114 | char *playlist_name(char *buf, int buf_size) |
115 | { | 115 | { |
116 | char buf[MAX_PATH+1]; | 116 | char *sep; |
117 | int i = 0; | 117 | |
118 | snprintf(buf, buf_size, "%s", playlist.filename+playlist.dirlen); | ||
118 | 119 | ||
119 | snprintf(buf, sizeof(buf), "%s", playlist.filename+playlist.dirlen); | 120 | if (0 == buf[0]) |
120 | while((buf[i] != '.') && (buf[i] != 0)) | 121 | return NULL; |
121 | i++; | ||
122 | buf[i] = 0; | ||
123 | 122 | ||
124 | snprintf(name, name_size, "%s", buf); | 123 | /* Remove extension */ |
125 | return; | 124 | sep = strrchr(buf, '.'); |
125 | if (NULL != sep) | ||
126 | *sep = 0; | ||
127 | |||
128 | return buf; | ||
126 | } | 129 | } |
127 | 130 | ||
128 | int playlist_next(int steps) | 131 | int playlist_next(int steps) |
diff --git a/apps/playlist.h b/apps/playlist.h index 39ed3a568d..47422a40a5 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -45,13 +45,13 @@ int play_list(char *dir, char *file, int start_index, | |||
45 | bool shuffled_index, int start_offset, | 45 | bool shuffled_index, int start_offset, |
46 | int random_seed, int first_index); | 46 | int random_seed, int first_index); |
47 | char* playlist_peek(int steps); | 47 | char* playlist_peek(int steps); |
48 | char* playlist_name(char *name, int name_size); | ||
48 | int playlist_next(int steps); | 49 | int playlist_next(int steps); |
49 | void randomise_playlist( unsigned int seed ); | 50 | void randomise_playlist( unsigned int seed ); |
50 | void sort_playlist(bool start_current); | 51 | void sort_playlist(bool start_current); |
51 | void empty_playlist(void); | 52 | void empty_playlist(void); |
52 | void add_indices_to_playlist(void); | 53 | void add_indices_to_playlist(void); |
53 | void playlist_clear(void); | 54 | void playlist_clear(void); |
54 | void playlist_name(char *name, int name_size); | ||
55 | int playlist_add(char *filename); | 55 | int playlist_add(char *filename); |
56 | int playlist_amount(void); | 56 | int playlist_amount(void); |
57 | int playlist_first_index(void); | 57 | int playlist_first_index(void); |
diff --git a/apps/wps-display.c b/apps/wps-display.c index 88bfa73687..f095fe5c58 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c | |||
@@ -319,8 +319,7 @@ static char* get_tag(struct mp3entry* id3, | |||
319 | return buf; | 319 | return buf; |
320 | 320 | ||
321 | case 'n': /* Playlist Name (without path) */ | 321 | case 'n': /* Playlist Name (without path) */ |
322 | playlist_name(buf, buf_size); | 322 | return playlist_name(buf, buf_size); |
323 | return buf; | ||
324 | 323 | ||
325 | case 'e': /* Playlist Total Entries */ | 324 | case 'e': /* Playlist Total Entries */ |
326 | snprintf(buf, buf_size, "%d", playlist_amount()); | 325 | snprintf(buf, buf_size, "%d", playlist_amount()); |