summaryrefslogtreecommitdiff
path: root/src/command/StorageCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-11-19 19:19:20 +0100
committerMax Kellermann <max@musicpd.org>2018-11-19 19:38:20 +0100
commitbda77ffc5b0893a16983b4e3da5ced5beae1ab1f (patch)
tree34362ac233aa3b55313d1c4f8e3772017382d187 /src/command/StorageCommands.cxx
parented9ece5ea309bf443acc957dc0b772195db51747 (diff)
db/Interface: remove IsPlugin(), use `dynamic_cast` instead
Diffstat (limited to 'src/command/StorageCommands.cxx')
-rw-r--r--src/command/StorageCommands.cxx14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/command/StorageCommands.cxx b/src/command/StorageCommands.cxx
index cd016586a..ef779a318 100644
--- a/src/command/StorageCommands.cxx
+++ b/src/command/StorageCommands.cxx
@@ -209,12 +209,9 @@ handle_mount(Client &client, Request args, Response &r)
instance.EmitIdle(IDLE_MOUNT);
#ifdef ENABLE_DATABASE
- Database *_db = instance.database;
- if (_db != nullptr && _db->IsPlugin(simple_db_plugin)) {
- SimpleDatabase &db = *(SimpleDatabase *)_db;
-
+ if (auto *db = dynamic_cast<SimpleDatabase *>(instance.database)) {
try {
- db.Mount(local_uri, remote_uri);
+ db->Mount(local_uri, remote_uri);
} catch (...) {
composite.Unmount(local_uri);
throw;
@@ -256,11 +253,8 @@ handle_unmount(Client &client, Request args, Response &r)
destroy here */
instance.update->CancelMount(local_uri);
- Database *_db = instance.database;
- if (_db != nullptr && _db->IsPlugin(simple_db_plugin)) {
- SimpleDatabase &db = *(SimpleDatabase *)_db;
-
- if (db.Unmount(local_uri))
+ if (auto *db = dynamic_cast<SimpleDatabase *>(instance.database)) {
+ if (db->Unmount(local_uri))
// TODO: call Instance::OnDatabaseModified()?
instance.EmitIdle(IDLE_DATABASE);
}