aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-04 21:30:35 +0100
committerMax Kellermann <max@duempel.org>2014-12-04 21:30:59 +0100
commit4f201d1e8515b336cb38905935baf52d0ee08d17 (patch)
tree1e2c1db9134febe45f2f033ed04e332982e6d16e /src/decoder
parent03cfef100fa90f81058a6fa8108ac1a4ff2a5fad (diff)
downloadmpd-4f201d1e8515b336cb38905935baf52d0ee08d17.tar.gz
mpd-4f201d1e8515b336cb38905935baf52d0ee08d17.tar.xz
mpd-4f201d1e8515b336cb38905935baf52d0ee08d17.zip
decoder/sidplay: use config_param::GetBlockPath()
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/plugins/SidplayDecoderPlugin.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/decoder/plugins/SidplayDecoderPlugin.cxx b/src/decoder/plugins/SidplayDecoderPlugin.cxx
index 76510a200..4e92e17f6 100644
--- a/src/decoder/plugins/SidplayDecoderPlugin.cxx
+++ b/src/decoder/plugins/SidplayDecoderPlugin.cxx
@@ -25,7 +25,9 @@
#include "fs/AllocatedPath.hxx"
#include "util/FormatString.hxx"
#include "util/Domain.hxx"
+#include "util/Error.hxx"
#include "system/ByteOrder.hxx"
+#include "system/FatalError.hxx"
#include "Log.hxx"
#include <errno.h>
@@ -49,16 +51,16 @@ static unsigned default_songlength;
static bool filter_setting;
static GKeyFile *
-sidplay_load_songlength_db(const char *path)
+sidplay_load_songlength_db(const Path path)
{
GError *error = nullptr;
gchar *data;
gsize size;
- if (!g_file_get_contents(path, &data, &size, &error)) {
+ if (!g_file_get_contents(path.c_str(), &data, &size, &error)) {
FormatError(sidplay_domain,
"unable to read songlengths file %s: %s",
- path, error->message);
+ path.c_str(), error->message);
g_error_free(error);
return nullptr;
}
@@ -75,7 +77,7 @@ sidplay_load_songlength_db(const char *path)
if (!success) {
FormatError(sidplay_domain,
"unable to parse songlengths file %s: %s",
- path, error->message);
+ path.c_str(), error->message);
g_error_free(error);
g_key_file_free(db);
return nullptr;
@@ -89,9 +91,12 @@ static bool
sidplay_init(const config_param &param)
{
/* read the songlengths database file */
- const char *songlength_file = param.GetBlockValue("songlength_database");
- if (songlength_file != nullptr)
- songlength_database = sidplay_load_songlength_db(songlength_file);
+ Error error;
+ const auto database_path = param.GetBlockPath("songlength_database", error);
+ if (!database_path.IsNull())
+ songlength_database = sidplay_load_songlength_db(database_path);
+ else if (error.IsDefined())
+ FatalError(error);
default_songlength = param.GetBlockValue("default_songlength", 0u);