mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
arg_string: return default value on parsing error
This commit is contained in:
parent
bd045c65a2
commit
9288fe63ad
@ -140,16 +140,18 @@ class Genode::Arg
|
||||
bool bool_value(bool default_value) const
|
||||
{
|
||||
bool result = default_value;
|
||||
switch(_value.type()) {
|
||||
switch (_value.type()) {
|
||||
|
||||
/* result is passed to 'ascii_to' by reference */
|
||||
case Token::IDENT:;
|
||||
if (ascii_to(_value.start(), result) == _value.len())
|
||||
return result;
|
||||
return default_value;
|
||||
|
||||
case Token::STRING:
|
||||
if (ascii_to(_value.start()+1, result) == _value.len()-2)
|
||||
return result;
|
||||
return default_value;
|
||||
|
||||
default:
|
||||
/* read values 0 (false) / !0 (true) */
|
||||
|
Loading…
Reference in New Issue
Block a user