🚨 fixed some compiler warnings

This commit is contained in:
Niels Lohmann 2018-08-16 18:20:30 +02:00
parent d5b21b051c
commit 07494e06d7
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
7 changed files with 43 additions and 43 deletions

View file

@ -1560,7 +1560,7 @@ class binary_reader
}
else
{
if (JSON_UNLIKELY(not sax->start_array(-1)))
if (JSON_UNLIKELY(not sax->start_array(std::size_t(-1))))
{
return false;
}
@ -1630,7 +1630,7 @@ class binary_reader
}
else
{
if (JSON_UNLIKELY(not sax->start_object(-1)))
if (JSON_UNLIKELY(not sax->start_object(std::size_t(-1))))
{
return false;
}

View file

@ -190,7 +190,7 @@ class json_sax_dom_parser
{
ref_stack.push_back(handle_value(BasicJsonType::value_t::object));
if (JSON_UNLIKELY(len != -1 and len > ref_stack.back()->max_size()))
if (JSON_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
{
JSON_THROW(out_of_range::create(408,
"excessive object size: " + std::to_string(len)));
@ -216,7 +216,7 @@ class json_sax_dom_parser
{
ref_stack.push_back(handle_value(BasicJsonType::value_t::array));
if (JSON_UNLIKELY(len != -1 and len > ref_stack.back()->max_size()))
if (JSON_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
{
JSON_THROW(out_of_range::create(408,
"excessive array size: " + std::to_string(len)));
@ -373,7 +373,7 @@ class json_sax_dom_callback_parser
// check object limit
if (ref_stack.back())
{
if (JSON_UNLIKELY(len != -1 and len > ref_stack.back()->max_size()))
if (JSON_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
{
JSON_THROW(out_of_range::create(408,
"excessive object size: " + std::to_string(len)));
@ -446,7 +446,7 @@ class json_sax_dom_callback_parser
// check array limit
if (ref_stack.back())
{
if (JSON_UNLIKELY(len != -1 and len > ref_stack.back()->max_size()))
if (JSON_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
{
JSON_THROW(out_of_range::create(408,
"excessive array size: " + std::to_string(len)));
@ -649,7 +649,7 @@ class json_sax_acceptor
return true;
}
bool start_object(std::size_t = -1)
bool start_object(std::size_t = std::size_t(-1))
{
return true;
}
@ -664,7 +664,7 @@ class json_sax_acceptor
return true;
}
bool start_array(std::size_t = -1)
bool start_array(std::size_t = std::size_t(-1))
{
return true;
}

View file

@ -146,7 +146,7 @@ class parser
template <typename SAX>
bool sax_parse(SAX* sax, const bool strict = true)
{
(void)detail::is_sax_static_asserts<SAX, BasicJsonType>{};
(void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};
const bool result = sax_parse_internal(sax);
// strict mode: next byte must be EOF
@ -179,7 +179,7 @@ class parser
{
case token_type::begin_object:
{
if (JSON_UNLIKELY(not sax->start_object(-1)))
if (JSON_UNLIKELY(not sax->start_object(std::size_t(-1))))
{
return false;
}
@ -227,7 +227,7 @@ class parser
case token_type::begin_array:
{
if (JSON_UNLIKELY(not sax->start_array(-1)))
if (JSON_UNLIKELY(not sax->start_array(std::size_t(-1))))
{
return false;
}