Commit 37ec29b2 authored by Max Kellermann's avatar Max Kellermann

Mapper: remove unused function map_song_fs()

parent ca7f6a26
......@@ -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)
{
......
......@@ -92,25 +92,6 @@ 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.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment