summaryrefslogtreecommitdiffstats
path: root/apps/playlist_catalog.c
diff options
context:
space:
mode:
authorMagnus Holmgren <magnushol@gmail.com>2006-12-03 20:45:12 +0000
committerMagnus Holmgren <magnushol@gmail.com>2006-12-03 20:45:12 +0000
commitdc956ce993ad01d8304415d4524f4217198a3102 (patch)
treeb0eac8b043389fc4ae99d285fa883c0c4cbd21ef /apps/playlist_catalog.c
parentec14b0f989fce4f295df8882ce0509b5599dfca4 (diff)
downloadrockbox-dc956ce993ad01d8304415d4524f4217198a3102.tar.gz
rockbox-dc956ce993ad01d8304415d4524f4217198a3102.tar.bz2
rockbox-dc956ce993ad01d8304415d4524f4217198a3102.zip
Make playlist catalog and playlist save screen handle .m3u/.m3u8 better. Also fix a possible null-pointer case in the playlist save screen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11654 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist_catalog.c')
-rw-r--r--apps/playlist_catalog.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c
index 0b047b0fee..54326d3ff9 100644
--- a/apps/playlist_catalog.c
+++ b/apps/playlist_catalog.c
@@ -453,13 +453,17 @@ bool catalog_add_to_a_playlist(char* sel, int sel_attr, bool new_playlist)
if (new_playlist)
{
+ size_t len;
snprintf(playlist, MAX_PATH, "%s/", playlist_dir);
if (kbd_input(playlist, MAX_PATH))
return false;
- if(strlen(playlist) <= 4 ||
- strcasecmp(&playlist[strlen(playlist)-4], ".m3u"))
- strcat(playlist, ".m3u");
+ len = strlen(playlist);
+
+ if(len > 4 && !strcasecmp(&playlist[len-4], ".m3u"))
+ strcat(playlist, "8");
+ else if(len <= 5 || strcasecmp(&playlist[len-5], ".m3u8"))
+ strcat(playlist, ".m3u8");
}
else
{