🚨 fixed compiler warnings

This commit is contained in:
Niels Lohmann 2018-10-25 14:27:55 +02:00
parent 62126278a6
commit 19647e083c
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
5 changed files with 9 additions and 11 deletions

View File

@ -246,13 +246,13 @@ class binary_reader
case 0x10: // int32
{
std::int32_t value;
return get_number<std::int32_t, true>(input_format_t::bson, value) and sax->number_integer(static_cast<std::int32_t>(value));
return get_number<std::int32_t, true>(input_format_t::bson, value) and sax->number_integer(value);
}
case 0x12: // int64
{
std::int64_t value;
return get_number<std::int64_t, true>(input_format_t::bson, value) and sax->number_integer(static_cast<std::int64_t>(value));
return get_number<std::int64_t, true>(input_format_t::bson, value) and sax->number_integer(value);
}
default: // anything else not supported (yet)

View File

@ -463,6 +463,7 @@ class serializer
continue;
}
}
break;
}
default: // decode found yet incomplete multi-byte code point

View File

@ -6547,13 +6547,13 @@ class binary_reader
case 0x10: // int32
{
std::int32_t value;
return get_number<std::int32_t, true>(input_format_t::bson, value) and sax->number_integer(static_cast<std::int32_t>(value));
return get_number<std::int32_t, true>(input_format_t::bson, value) and sax->number_integer(value);
}
case 0x12: // int64
{
std::int64_t value;
return get_number<std::int64_t, true>(input_format_t::bson, value) and sax->number_integer(static_cast<std::int64_t>(value));
return get_number<std::int64_t, true>(input_format_t::bson, value) and sax->number_integer(value);
}
default: // anything else not supported (yet)
@ -11161,6 +11161,7 @@ class serializer
continue;
}
}
break;
}
default: // decode found yet incomplete multi-byte code point

View File

@ -60,10 +60,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
// parse errors are ok, because input may be random bytes
}
catch (const json::out_of_range&)
{
// parse errors are ok, because input may be random bytes
}
catch (const json::out_of_range&)
{
// out of range errors may happen if provided sizes are excessive
}

View File

@ -1013,7 +1013,7 @@ TEST_CASE("BSON numerical data")
{ "entry", i }
};
std::uint64_t iu = *reinterpret_cast<std::uint64_t*>(&i);
auto iu = i;
std::vector<uint8_t> expected_bson =
{
0x10u, 0x00u, 0x00u, 0x00u, // size (little endian)
@ -1068,7 +1068,7 @@ TEST_CASE("BSON numerical data")
{ "entry", i }
};
std::uint64_t iu = *reinterpret_cast<std::uint64_t*>(&i);
auto iu = i;
std::vector<uint8_t> expected_bson =
{
0x14u, 0x00u, 0x00u, 0x00u, // size (little endian)
@ -1118,7 +1118,7 @@ TEST_CASE("BSON numerical data")
{ "entry", i }
};
std::uint64_t iu = *reinterpret_cast<std::uint64_t*>(&i);
auto iu = i;
std::vector<uint8_t> expected_bson =
{
0x14u, 0x00u, 0x00u, 0x00u, // size (little endian)