TagAny, playlist/Mapper: use `if` with initializer
This commit is contained in:
parent
a701da6386
commit
4e7b554605
|
@ -111,17 +111,12 @@ TagScanDatabase(Client &client, const char *uri, TagHandler &handler)
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
if (const auto path_fs = storage->MapFS(uri); !path_fs.IsNull())
|
||||||
const auto path_fs = storage->MapFS(uri);
|
|
||||||
if (!path_fs.IsNull())
|
|
||||||
return TagScanFile(path_fs, handler);
|
return TagScanFile(path_fs, handler);
|
||||||
}
|
|
||||||
|
|
||||||
{
|
if (const auto absolute_uri = storage->MapUTF8(uri);
|
||||||
const auto absolute_uri = storage->MapUTF8(uri);
|
uri_has_scheme(absolute_uri))
|
||||||
if (uri_has_scheme(absolute_uri))
|
|
||||||
return TagScanStream(absolute_uri.c_str(), handler);
|
return TagScanStream(absolute_uri.c_str(), handler);
|
||||||
}
|
|
||||||
|
|
||||||
throw ProtocolError(ACK_ERROR_NO_EXIST, "No such file");
|
throw ProtocolError(ACK_ERROR_NO_EXIST, "No such file");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,11 +40,8 @@ playlist_open_in_storage(const char *uri, const Storage *storage, Mutex &mutex)
|
||||||
if (storage == nullptr)
|
if (storage == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
{
|
if (const auto path = storage->MapFS(uri); !path.IsNull())
|
||||||
const auto path = storage->MapFS(uri);
|
|
||||||
if (!path.IsNull())
|
|
||||||
return playlist_open_path(path, mutex);
|
return playlist_open_path(path, mutex);
|
||||||
}
|
|
||||||
|
|
||||||
const auto uri2 = storage->MapUTF8(uri);
|
const auto uri2 = storage->MapUTF8(uri);
|
||||||
return playlist_open_remote(uri2.c_str(), mutex);
|
return playlist_open_remote(uri2.c_str(), mutex);
|
||||||
|
|
Loading…
Reference in New Issue