diff options
Diffstat (limited to '')
-rw-r--r-- | src/stored_playlist.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/stored_playlist.c b/src/stored_playlist.c index cd2818522..9b3ec4a7f 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2010 The Music Player Daemon Project + * Copyright (C) 2003-2011 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,6 +20,7 @@ #include "config.h" #include "stored_playlist.h" #include "playlist_save.h" +#include "text_file.h" #include "song.h" #include "mapper.h" #include "path.h" @@ -179,7 +180,6 @@ spl_load(const char *utf8path) { FILE *file; GPtrArray *list; - char buffer[MPD_PATH_MAX]; char *path_fs; if (!spl_valid_name(utf8path) || map_spl_path() == NULL) @@ -196,28 +196,20 @@ spl_load(const char *utf8path) list = g_ptr_array_new(); - while (fgets(buffer, sizeof(buffer), file)) { - char *s = buffer; - - if (*s == PLAYLIST_COMMENT) + GString *buffer = g_string_sized_new(1024); + char *s; + while ((s = read_text_line(file, buffer)) != NULL) { + if (*s == 0 || *s == PLAYLIST_COMMENT) continue; - g_strchomp(buffer); - if (!uri_has_scheme(s)) { char *path_utf8; - struct song *song; path_utf8 = map_fs_to_utf8(s); if (path_utf8 == NULL) continue; - song = db_get_song(path_utf8); - g_free(path_utf8); - if (song == NULL) - continue; - - s = song_get_uri(song); + s = path_utf8; } else s = g_strdup(s); |