From 3c7cf94643bc45237d1e61c4e6015d498e4400b0 Mon Sep 17 00:00:00 2001 From: Denis Krjuchkov Date: Thu, 24 Jan 2013 02:26:38 +0600 Subject: Path: convert fs_charset_to_utf8() to static method Path::ToUTF8() --- src/PlaylistSong.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/PlaylistSong.cxx') diff --git a/src/PlaylistSong.cxx b/src/PlaylistSong.cxx index 6c59600f6..4df4d22d4 100644 --- a/src/PlaylistSong.cxx +++ b/src/PlaylistSong.cxx @@ -65,18 +65,15 @@ apply_song_metadata(struct song *dest, const struct song *src) return dest; if (song_in_database(dest)) { - char *path_fs = map_song_fs(dest).Steal(); - if (path_fs == nullptr) + const Path &path_fs = map_song_fs(dest); + if (path_fs.IsNull()) return dest; - char *path_utf8 = fs_charset_to_utf8(path_fs); - if (path_utf8 != NULL) - g_free(path_fs); - else - path_utf8 = path_fs; + std::string path_utf8 = path_fs.ToUTF8(); + if (path_utf8.empty()) + path_utf8 = path_fs.c_str(); - tmp = song_file_new(path_utf8, NULL); - g_free(path_utf8); + tmp = song_file_new(path_utf8.c_str(), NULL); merge_song_metadata(tmp, dest, src); } else { -- cgit v1.2.3