InputPlugin: allow init() to soft-fail

Add enum InputResult which is a tri-state.  Input plugins may now fail
and just become unavailable.
This commit is contained in:
Max Kellermann
2014-03-02 00:17:32 +01:00
parent 7453c26ec4
commit 2bf2f34b12
6 changed files with 65 additions and 16 deletions

View File

@@ -87,7 +87,7 @@ static constexpr Domain cdio_domain("cdio");
static bool default_reverse_endian;
static bool
static InputPlugin::InitResult
input_cdio_init(const config_param &param, Error &error)
{
const char *value = param.GetBlockValue("default_byte_order");
@@ -100,11 +100,11 @@ input_cdio_init(const config_param &param, Error &error)
error.Format(config_domain, 0,
"Unrecognized 'default_byte_order' setting: %s",
value);
return false;
return InputPlugin::InitResult::ERROR;
}
}
return true;
return InputPlugin::InitResult::SUCCESS;
}
static void