config/Block: add method GetPositiveValue()
Adds missing checks to several plugins.
This commit is contained in:
@@ -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;
|
||||
|
@@ -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",
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user