diff options
author | Max Kellermann <max@duempel.org> | 2013-10-14 21:43:41 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-14 21:43:41 +0200 |
commit | 9067da2df8472d6c5871f075654dc0561fbb13f3 (patch) | |
tree | 2d12e6d9099d7ba0bf7946764c3141b18ff56457 /src/Mapper.cxx | |
parent | 8cf2f52f7acfd22dc85e0ed5ef6bd04cf55d31aa (diff) | |
download | mpd-9067da2df8472d6c5871f075654dc0561fbb13f3.tar.gz mpd-9067da2df8472d6c5871f075654dc0561fbb13f3.tar.xz mpd-9067da2df8472d6c5871f075654dc0561fbb13f3.zip |
Mapper: map_fs_to_utf8() returns std::string
Avoid the conversion to an allocated char*, let the caller decide.
Diffstat (limited to '')
-rw-r--r-- | src/Mapper.cxx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/Mapper.cxx b/src/Mapper.cxx index e2d082122..7c89ba7c4 100644 --- a/src/Mapper.cxx +++ b/src/Mapper.cxx @@ -248,7 +248,7 @@ map_song_fs(const Song *song) return Path::FromUTF8(song->uri); } -char * +std::string map_fs_to_utf8(const char *path_fs) { if (!music_dir_fs.IsNull() && @@ -263,11 +263,7 @@ map_fs_to_utf8(const char *path_fs) while (path_fs[0] == G_DIR_SEPARATOR) ++path_fs; - const std::string path_utf8 = Path::ToUTF8(path_fs); - if (path_utf8.empty()) - return nullptr; - - return g_strdup(path_utf8.c_str()); + return Path::ToUTF8(path_fs); } const Path & |