mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +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 bool_value(bool default_value) const
|
||||||
{
|
{
|
||||||
bool result = default_value;
|
bool result = default_value;
|
||||||
switch(_value.type()) {
|
switch (_value.type()) {
|
||||||
|
|
||||||
/* result is passed to 'ascii_to' by reference */
|
/* result is passed to 'ascii_to' by reference */
|
||||||
case Token::IDENT:;
|
case Token::IDENT:;
|
||||||
if (ascii_to(_value.start(), result) == _value.len())
|
if (ascii_to(_value.start(), result) == _value.len())
|
||||||
return result;
|
return result;
|
||||||
|
return default_value;
|
||||||
|
|
||||||
case Token::STRING:
|
case Token::STRING:
|
||||||
if (ascii_to(_value.start()+1, result) == _value.len()-2)
|
if (ascii_to(_value.start()+1, result) == _value.len()-2)
|
||||||
return result;
|
return result;
|
||||||
|
return default_value;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* read values 0 (false) / !0 (true) */
|
/* read values 0 (false) / !0 (true) */
|
||||||
|
Loading…
Reference in New Issue
Block a user