diff options
author | Max Kellermann <max@duempel.org> | 2013-01-17 00:56:57 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-17 00:56:57 +0100 |
commit | 2cca3ed6ad118b58365ec2a87e71536f03055cf8 (patch) | |
tree | a511887a2b7a38a98969e04f6501dcbb711f1236 /src/SongUpdate.cxx | |
parent | 21fe376d1d9ffa6064cf89faab7860d443d9f7fd (diff) | |
download | mpd-2cca3ed6ad118b58365ec2a87e71536f03055cf8.tar.gz mpd-2cca3ed6ad118b58365ec2a87e71536f03055cf8.tar.xz mpd-2cca3ed6ad118b58365ec2a87e71536f03055cf8.zip |
Path: new class "Path" wraps filesystem path stringspath
Diffstat (limited to 'src/SongUpdate.cxx')
-rw-r--r-- | src/SongUpdate.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx index b96c7c43e..6353737e7 100644 --- a/src/SongUpdate.cxx +++ b/src/SongUpdate.cxx @@ -26,6 +26,7 @@ extern "C" { #include "Directory.hxx" #include "Mapper.hxx" +#include "Path.hxx" #include "tag.h" #include "input_stream.h" @@ -85,7 +86,6 @@ bool song_file_update(struct song *song) { const char *suffix; - char *path_fs; const struct decoder_plugin *plugin; struct stat st; struct input_stream *is = NULL; @@ -102,8 +102,8 @@ song_file_update(struct song *song) if (plugin == NULL) return false; - path_fs = map_song_fs(song); - if (path_fs == NULL) + const Path path_fs = map_song_fs(song); + if (path_fs.IsNull()) return false; if (song->tag != NULL) { @@ -111,8 +111,7 @@ song_file_update(struct song *song) song->tag = NULL; } - if (stat(path_fs, &st) < 0 || !S_ISREG(st.st_mode)) { - g_free(path_fs); + if (stat(path_fs.c_str(), &st) < 0 || !S_ISREG(st.st_mode)) { return false; } @@ -129,7 +128,7 @@ song_file_update(struct song *song) do { /* load file tag */ song->tag = tag_new(); - if (decoder_plugin_scan_file(plugin, path_fs, + if (decoder_plugin_scan_file(plugin, path_fs.c_str(), &full_tag_handler, song->tag)) break; @@ -143,7 +142,8 @@ song_file_update(struct song *song) if (is == NULL) { mutex = g_mutex_new(); cond = g_cond_new(); - is = input_stream_open(path_fs, mutex, cond, + is = input_stream_open(path_fs.c_str(), + mutex, cond, NULL); } @@ -174,9 +174,9 @@ song_file_update(struct song *song) } if (song->tag != NULL && tag_is_empty(song->tag)) - tag_scan_fallback(path_fs, &full_tag_handler, song->tag); + tag_scan_fallback(path_fs.c_str(), &full_tag_handler, + song->tag); - g_free(path_fs); return song->tag != NULL; } |