diff options
author | Max Kellermann <max@duempel.org> | 2013-01-17 00:56:57 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-18 15:34:01 +0100 |
commit | e5039c478aa93e3e107ee9031a3cf27a6c203fea (patch) | |
tree | 5d9fecc644b915fe02634911d65c29123e03c1b8 /src/UpdateContainer.cxx | |
parent | 890151450663abd581cab56e853e8e713d822851 (diff) | |
download | mpd-e5039c478aa93e3e107ee9031a3cf27a6c203fea.tar.gz mpd-e5039c478aa93e3e107ee9031a3cf27a6c203fea.tar.xz mpd-e5039c478aa93e3e107ee9031a3cf27a6c203fea.zip |
Path: new class "Path" wraps filesystem path strings
Diffstat (limited to '')
-rw-r--r-- | src/UpdateContainer.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/UpdateContainer.cxx b/src/UpdateContainer.cxx index daa7f1ec4..d59fa96c0 100644 --- a/src/UpdateContainer.cxx +++ b/src/UpdateContainer.cxx @@ -26,6 +26,7 @@ #include "song.h" #include "decoder_plugin.h" #include "Mapper.hxx" +#include "Path.hxx" extern "C" { #include "tag_handler.h" @@ -84,22 +85,22 @@ update_container_file(Directory *directory, contdir->device = DEVICE_CONTAINER; db_unlock(); - char *const pathname = map_directory_child_fs(directory, name); + const Path pathname = map_directory_child_fs(directory, name); char *vtrack; unsigned int tnum = 0; - while ((vtrack = plugin->container_scan(pathname, ++tnum)) != NULL) { + while ((vtrack = plugin->container_scan(pathname.c_str(), ++tnum)) != NULL) { struct song *song = song_file_new(vtrack, contdir); // shouldn't be necessary but it's there.. song->mtime = st->st_mtime; - char *child_path_fs = map_directory_child_fs(contdir, vtrack); + const Path child_path_fs = + map_directory_child_fs(contdir, vtrack); song->tag = tag_new(); - decoder_plugin_scan_file(plugin, child_path_fs, + decoder_plugin_scan_file(plugin, child_path_fs.c_str(), &add_tag_handler, song->tag); - g_free(child_path_fs); db_lock(); contdir->AddSong(song); @@ -111,8 +112,6 @@ update_container_file(Directory *directory, g_free(vtrack); } - g_free(pathname); - if (tnum == 1) { db_lock(); delete_directory(contdir); |