summaryrefslogtreecommitdiff
path: root/src/decoder/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-02 17:22:25 +0100
committerMax Kellermann <max@musicpd.org>2018-01-02 17:24:34 +0100
commitbe65c7d5d0bb6a1bf46c58f0b488d0685966df1d (patch)
tree30ffdb42faf9b2ce1579a5c4b5dcd1d8c07deb1d /src/decoder/plugins
parent7c5306a84182f2dd5c3adce75980e31b4476b4c0 (diff)
config/Block: add method GetPositiveValue()
Adds missing checks to several plugins.
Diffstat (limited to 'src/decoder/plugins')
-rw-r--r--src/decoder/plugins/AdPlugDecoderPlugin.cxx2
-rw-r--r--src/decoder/plugins/FluidsynthDecoderPlugin.cxx2
-rw-r--r--src/decoder/plugins/MikmodDecoderPlugin.cxx2
-rw-r--r--src/decoder/plugins/SidplayDecoderPlugin.cxx2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/decoder/plugins/AdPlugDecoderPlugin.cxx b/src/decoder/plugins/AdPlugDecoderPlugin.cxx
index d3a8ecd55..4d46c281d 100644
--- a/src/decoder/plugins/AdPlugDecoderPlugin.cxx
+++ b/src/decoder/plugins/AdPlugDecoderPlugin.cxx
@@ -42,7 +42,7 @@ adplug_init(const ConfigBlock &block)
FormatDebug(adplug_domain, "adplug %s",
CAdPlug::get_version().c_str());
- sample_rate = block.GetBlockValue("sample_rate", 48000u);
+ sample_rate = block.GetPositiveValue("sample_rate", 48000u);
CheckSampleRate(sample_rate);
return true;
diff --git a/src/decoder/plugins/FluidsynthDecoderPlugin.cxx b/src/decoder/plugins/FluidsynthDecoderPlugin.cxx
index 3eaf1d67e..e92c1c306 100644
--- a/src/decoder/plugins/FluidsynthDecoderPlugin.cxx
+++ b/src/decoder/plugins/FluidsynthDecoderPlugin.cxx
@@ -74,7 +74,7 @@ fluidsynth_mpd_log_function(int level, char *message, gcc_unused void *data)
static bool
fluidsynth_init(const ConfigBlock &block)
{
- sample_rate = block.GetBlockValue("sample_rate", 48000u);
+ sample_rate = block.GetPositiveValue("sample_rate", 48000u);
CheckSampleRate(sample_rate);
soundfont_path = block.GetBlockValue("soundfont",
diff --git a/src/decoder/plugins/MikmodDecoderPlugin.cxx b/src/decoder/plugins/MikmodDecoderPlugin.cxx
index 788a13f73..6af5876c3 100644
--- a/src/decoder/plugins/MikmodDecoderPlugin.cxx
+++ b/src/decoder/plugins/MikmodDecoderPlugin.cxx
@@ -114,7 +114,7 @@ mikmod_decoder_init(const ConfigBlock &block)
static char params[] = "";
mikmod_loop = block.GetBlockValue("loop", false);
- mikmod_sample_rate = block.GetBlockValue("sample_rate", 44100u);
+ mikmod_sample_rate = block.GetPositiveValue("sample_rate", 44100u);
if (!audio_valid_sample_rate(mikmod_sample_rate))
throw FormatRuntimeError("Invalid sample rate in line %d: %u",
block.line, mikmod_sample_rate);
diff --git a/src/decoder/plugins/SidplayDecoderPlugin.cxx b/src/decoder/plugins/SidplayDecoderPlugin.cxx
index a217f2b00..c6b4c2ad5 100644
--- a/src/decoder/plugins/SidplayDecoderPlugin.cxx
+++ b/src/decoder/plugins/SidplayDecoderPlugin.cxx
@@ -93,7 +93,7 @@ sidplay_init(const ConfigBlock &block)
if (!database_path.IsNull())
songlength_database = sidplay_load_songlength_db(database_path);
- default_songlength = block.GetBlockValue("default_songlength", 0u);
+ default_songlength = block.GetPositiveValue("default_songlength", 0u);
all_files_are_containers =
block.GetBlockValue("all_files_are_containers", true);