👌 fixed some compiler warnings

This commit is contained in:
Niels Lohmann 2018-02-25 18:35:16 +01:00
parent 8c7f46f7d0
commit 8d6b3d44d6
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
4 changed files with 22 additions and 18 deletions

View file

@ -96,7 +96,9 @@ class parser
/// a parse error occurred
/// the byte position and the last token are reported
virtual bool parse_error(int position, const std::string& last_token) = 0;
virtual bool parse_error(std::size_t position, const std::string& last_token) = 0;
virtual ~SAX() = default;
};
using parser_callback_t =
@ -585,7 +587,7 @@ class parser
{
case token_type::begin_object:
{
if (not sax->start_object(-1))
if (not sax->start_object(std::size_t(-1)))
{
return false;
}
@ -654,7 +656,7 @@ class parser
case token_type::begin_array:
{
if (not sax->start_array(-1))
if (not sax->start_array(std::size_t(-1)))
{
return false;
}

View file

@ -3219,7 +3219,9 @@ class parser
/// a parse error occurred
/// the byte position and the last token are reported
virtual bool parse_error(int position, const std::string& last_token) = 0;
virtual bool parse_error(std::size_t position, const std::string& last_token) = 0;
virtual ~SAX() = default;
};
using parser_callback_t =
@ -3708,7 +3710,7 @@ class parser
{
case token_type::begin_object:
{
if (not sax->start_object(-1))
if (not sax->start_object(std::size_t(-1)))
{
return false;
}
@ -3777,7 +3779,7 @@ class parser
case token_type::begin_array:
{
if (not sax->start_array(-1))
if (not sax->start_array(std::size_t(-1)))
{
return false;
}

View file

@ -61,7 +61,7 @@ class SaxEventLogger : public nlohmann::json::SAX
return true;
}
bool number_float(json::number_float_t val, const std::string& s) override
bool number_float(json::number_float_t, const std::string& s) override
{
events.push_back("number_float(" + s + ")");
return true;
@ -75,7 +75,7 @@ class SaxEventLogger : public nlohmann::json::SAX
bool start_object(std::size_t elements) override
{
if (elements == -1)
if (elements == std::size_t(-1))
{
events.push_back("start_object()");
}
@ -100,7 +100,7 @@ class SaxEventLogger : public nlohmann::json::SAX
bool start_array(std::size_t elements) override
{
if (elements == -1)
if (elements == std::size_t(-1))
{
events.push_back("start_array()");
}
@ -117,13 +117,13 @@ class SaxEventLogger : public nlohmann::json::SAX
return true;
}
bool binary(const std::vector<uint8_t>& vec) override
bool binary(const std::vector<uint8_t>&) override
{
events.push_back("binary()");
return true;
}
bool parse_error(int position, const std::string& last_token) override
bool parse_error(std::size_t position, const std::string&) override
{
errored = true;
events.push_back("parse_error(" + std::to_string(position) + ")");

View file

@ -60,7 +60,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
return true;
}
bool number_float(json::number_float_t val, const std::string& s) override
bool number_float(json::number_float_t, const std::string& s) override
{
events.push_back("number_float(" + s + ")");
return true;
@ -74,7 +74,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
bool start_object(std::size_t elements) override
{
if (elements == -1)
if (elements == std::size_t(-1))
{
events.push_back("start_object()");
}
@ -99,7 +99,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
bool start_array(std::size_t elements) override
{
if (elements == -1)
if (elements == std::size_t(-1))
{
events.push_back("start_array()");
}
@ -116,13 +116,13 @@ struct SaxEventLogger : public nlohmann::json::SAX
return true;
}
bool binary(const std::vector<uint8_t>& vec) override
bool binary(const std::vector<uint8_t>&) override
{
events.push_back("binary()");
return true;
}
bool parse_error(int position, const std::string& last_token) override
bool parse_error(std::size_t position, const std::string&) override
{
events.push_back("parse_error(" + std::to_string(position) + ")");
return false;
@ -135,7 +135,7 @@ struct SaxEventLoggerExitAfterStartObject : public SaxEventLogger
{
bool start_object(std::size_t elements) override
{
if (elements == -1)
if (elements == std::size_t(-1))
{
events.push_back("start_object()");
}
@ -160,7 +160,7 @@ struct SaxEventLoggerExitAfterStartArray : public SaxEventLogger
{
bool start_array(std::size_t elements) override
{
if (elements == -1)
if (elements == std::size_t(-1))
{
events.push_back("start_array()");
}