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
|
||||
}
|
||||
|
||||
{
|
||||
const auto path_fs = storage->MapFS(uri);
|
||||
if (!path_fs.IsNull())
|
||||
if (const auto path_fs = storage->MapFS(uri); !path_fs.IsNull())
|
||||
return TagScanFile(path_fs, handler);
|
||||
}
|
||||
|
||||
{
|
||||
const auto absolute_uri = storage->MapUTF8(uri);
|
||||
if (uri_has_scheme(absolute_uri))
|
||||
if (const auto absolute_uri = storage->MapUTF8(uri);
|
||||
uri_has_scheme(absolute_uri))
|
||||
return TagScanStream(absolute_uri.c_str(), handler);
|
||||
}
|
||||
|
||||
throw ProtocolError(ACK_ERROR_NO_EXIST, "No such file");
|
||||
#endif
|
||||
|
|
|
@ -40,11 +40,8 @@ playlist_open_in_storage(const char *uri, const Storage *storage, Mutex &mutex)
|
|||
if (storage == nullptr)
|
||||
return nullptr;
|
||||
|
||||
{
|
||||
const auto path = storage->MapFS(uri);
|
||||
if (!path.IsNull())
|
||||
if (const auto path = storage->MapFS(uri); !path.IsNull())
|
||||
return playlist_open_path(path, mutex);
|
||||
}
|
||||
|
||||
const auto uri2 = storage->MapUTF8(uri);
|
||||
return playlist_open_remote(uri2.c_str(), mutex);
|
||||
|
|
Loading…
Reference in New Issue