Fix warning: enumeration value not handled in switch

In this case the switch is useless since the other cases
are already excluded by the initial asserts.
Removing the switch altogether seems the best way forward.
This commit is contained in:
Cristian Maglie 2017-04-15 13:18:41 +02:00
parent 523cc21514
commit 14dcd918a8
2 changed files with 32 additions and 52 deletions

View File

@ -12093,37 +12093,27 @@ basic_json_parser_74:
strtonum num_converter(reinterpret_cast<const char*>(m_start),
reinterpret_cast<const char*>(m_cursor));
switch (token)
if (token == lexer::token_type::value_unsigned)
{
case lexer::token_type::value_unsigned:
number_unsigned_t val;
if (num_converter.to(val))
{
number_unsigned_t val;
if (num_converter.to(val))
{
// parsing successful
result.m_type = value_t::number_unsigned;
result.m_value = val;
return true;
}
break;
// parsing successful
result.m_type = value_t::number_unsigned;
result.m_value = val;
return true;
}
}
case lexer::token_type::value_integer:
if (token == lexer::token_type::value_integer)
{
number_integer_t val;
if (num_converter.to(val))
{
number_integer_t val;
if (num_converter.to(val))
{
// parsing successful
result.m_type = value_t::number_integer;
result.m_value = val;
return true;
}
break;
}
default:
{
break;
// parsing successful
result.m_type = value_t::number_integer;
result.m_value = val;
return true;
}
}

View File

@ -11126,37 +11126,27 @@ class basic_json
strtonum num_converter(reinterpret_cast<const char*>(m_start),
reinterpret_cast<const char*>(m_cursor));
switch (token)
if (token == lexer::token_type::value_unsigned)
{
case lexer::token_type::value_unsigned:
number_unsigned_t val;
if (num_converter.to(val))
{
number_unsigned_t val;
if (num_converter.to(val))
{
// parsing successful
result.m_type = value_t::number_unsigned;
result.m_value = val;
return true;
}
break;
// parsing successful
result.m_type = value_t::number_unsigned;
result.m_value = val;
return true;
}
}
case lexer::token_type::value_integer:
if (token == lexer::token_type::value_integer)
{
number_integer_t val;
if (num_converter.to(val))
{
number_integer_t val;
if (num_converter.to(val))
{
// parsing successful
result.m_type = value_t::number_integer;
result.m_value = val;
return true;
}
break;
}
default:
{
break;
// parsing successful
result.m_type = value_t::number_integer;
result.m_value = val;
return true;
}
}