From 37ec29b225095e9c02b974134e056f8ba1a8678c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 7 Feb 2014 18:48:38 +0100 Subject: Mapper: remove unused function map_song_fs() --- src/Mapper.cxx | 67 ---------------------------------------------------------- src/Mapper.hxx | 19 ----------------- 2 files changed, 86 deletions(-) (limited to 'src') diff --git a/src/Mapper.cxx b/src/Mapper.cxx index 4e7efff67..5a02096e8 100644 --- a/src/Mapper.cxx +++ b/src/Mapper.cxx @@ -193,73 +193,6 @@ map_uri_fs(const char *uri) return AllocatedPath::Build(music_dir_fs, uri_fs); } -gcc_pure -static AllocatedPath -map_directory_fs(const Directory &directory) -{ - assert(!music_dir_fs.IsNull()); - - if (directory.IsRoot()) - return music_dir_fs; - - return map_uri_fs(directory.GetPath()); -} - -/** - * Determines the file system path of a directory's child (may be a - * sub directory or a song). - * - * @param directory the parent directory object - * @param name the child's name in UTF-8 - * @return the path in file system encoding, or nullptr if mapping failed - */ -static AllocatedPath -map_directory_child_fs(const Directory &directory, const char *name) -{ - assert(!music_dir_fs.IsNull()); - - /* check for invalid or unauthorized base names */ - if (*name == 0 || strchr(name, '/') != nullptr || - strcmp(name, ".") == 0 || strcmp(name, "..") == 0) - return AllocatedPath::Null(); - - const auto parent_fs = map_directory_fs(directory); - if (parent_fs.IsNull()) - return AllocatedPath::Null(); - - const auto name_fs = AllocatedPath::FromUTF8(name); - if (name_fs.IsNull()) - return AllocatedPath::Null(); - - return AllocatedPath::Build(parent_fs, name_fs); -} - -AllocatedPath -map_song_fs(const Song &song) -{ - assert(song.parent != nullptr); - - return map_directory_child_fs(*song.parent, song.uri); -} - -#endif - -AllocatedPath -map_song_fs(const DetachedSong &song) -{ - if (song.IsAbsoluteFile()) - return AllocatedPath::FromUTF8(song.GetRealURI()); - else { -#ifdef ENABLE_DATABASE - return map_uri_fs(song.GetURI()); -#else - return AllocatedPath::Null(); -#endif - } -} - -#ifdef ENABLE_DATABASE - std::string map_fs_to_utf8(const char *path_fs) { diff --git a/src/Mapper.hxx b/src/Mapper.hxx index 3ddee5568..a9551c929 100644 --- a/src/Mapper.hxx +++ b/src/Mapper.hxx @@ -91,25 +91,6 @@ gcc_pure AllocatedPath map_uri_fs(const char *uri); -/** - * Determines the file system path of a song. This must not be a - * remote song. - * - * @param song the song object - * @return the path in file system encoding, or nullptr if mapping failed - */ -gcc_pure -AllocatedPath -map_song_fs(const Song &song); - -#endif - -gcc_pure -AllocatedPath -map_song_fs(const DetachedSong &song); - -#ifdef ENABLE_DATABASE - /** * Maps a file system path (relative to the music directory or * absolute) to a relative path in UTF-8 encoding. -- cgit v1.2.3