diff options
-rw-r--r-- | src/Main.cxx | 3 | ||||
-rw-r--r-- | src/db/Interface.hxx | 5 | ||||
-rw-r--r-- | src/db/plugins/ProxyDatabasePlugin.cxx | 8 | ||||
-rw-r--r-- | src/db/plugins/simple/SimpleDatabasePlugin.cxx | 11 | ||||
-rw-r--r-- | src/db/plugins/simple/SimpleDatabasePlugin.hxx | 2 | ||||
-rw-r--r-- | src/db/plugins/upnp/UpnpDatabasePlugin.cxx | 8 | ||||
-rw-r--r-- | test/DumpDatabase.cxx | 5 |
7 files changed, 15 insertions, 27 deletions
diff --git a/src/Main.cxx b/src/Main.cxx index f6146faf1..5f91a19b7 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -214,8 +214,7 @@ glue_db_init_and_load(void) "because the database does not need it"); } - if (!instance->database->Open(error)) - FatalError(error); + instance->database->Open(); if (!instance->database->IsPlugin(simple_db_plugin)) return true; diff --git a/src/db/Interface.hxx b/src/db/Interface.hxx index 852084280..e0c29395c 100644 --- a/src/db/Interface.hxx +++ b/src/db/Interface.hxx @@ -55,9 +55,10 @@ public: /** * Open the database. Read it into memory if applicable. + * + * Throws #DatabaseError or std::runtime_error on error. */ - virtual bool Open(gcc_unused Error &error) { - return true; + virtual void Open() { } /** diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx index 251f39193..9a9f3e2f1 100644 --- a/src/db/plugins/ProxyDatabasePlugin.cxx +++ b/src/db/plugins/ProxyDatabasePlugin.cxx @@ -113,7 +113,7 @@ public: const ConfigBlock &block, Error &error); - virtual bool Open(Error &error) override; + virtual void Open() override; virtual void Close() override; virtual const LightSong *GetSong(const char *uri_utf8, Error &error) const override; @@ -362,14 +362,12 @@ ProxyDatabase::Configure(const ConfigBlock &block, gcc_unused Error &error) return true; } -bool -ProxyDatabase::Open(gcc_unused Error &error) +void +ProxyDatabase::Open() { Connect(); update_stamp = 0; - - return true; } void diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx index f7bae65d8..b10f9e8ee 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx @@ -184,8 +184,8 @@ SimpleDatabase::Load(Error &error) return true; } -bool -SimpleDatabase::Open(gcc_unused Error &error) +void +SimpleDatabase::Open() { assert(prefixed_light_song == nullptr); @@ -216,8 +216,6 @@ SimpleDatabase::Open(gcc_unused Error &error) root = Directory::NewRoot(); } - - return true; } void @@ -459,10 +457,7 @@ SimpleDatabase::Mount(const char *local_uri, const char *storage_uri, name_fs.c_str()), compress); try { - if (!db->Open(error)) { - delete db; - return false; - } + db->Open(); } catch (...) { delete db; throw; diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.hxx b/src/db/plugins/simple/SimpleDatabasePlugin.hxx index bdb71e420..c0ecdbd13 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.hxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.hxx @@ -107,7 +107,7 @@ public: bool Unmount(const char *uri); /* virtual methods from class Database */ - virtual bool Open(Error &error) override; + virtual void Open() override; virtual void Close() override; const LightSong *GetSong(const char *uri_utf8, diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 6b3aa2236..2e23b206c 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -80,7 +80,7 @@ public: const ConfigBlock &block, Error &error); - virtual bool Open(Error &error) override; + virtual void Open() override; virtual void Close() override; virtual const LightSong *GetSong(const char *uri_utf8, Error &error) const override; @@ -168,8 +168,8 @@ UpnpDatabase::Configure(const ConfigBlock &, Error &) return true; } -bool -UpnpDatabase::Open(gcc_unused Error &error) +void +UpnpDatabase::Open() { UpnpClientGlobalInit(handle); @@ -181,8 +181,6 @@ UpnpDatabase::Open(gcc_unused Error &error) UpnpClientGlobalFinish(); throw; } - - return true; } void diff --git a/test/DumpDatabase.cxx b/test/DumpDatabase.cxx index 5032cab69..e673dc698 100644 --- a/test/DumpDatabase.cxx +++ b/test/DumpDatabase.cxx @@ -136,10 +136,7 @@ try { AtScopeExit(db) { delete db; }; - if (!db->Open(error)) { - cerr << error.GetMessage() << endl; - return EXIT_FAILURE; - } + db->Open(); AtScopeExit(db) { db->Close(); }; |