remove C-style casting

This commit is contained in:
Tomasz Maciejewski 2016-02-28 12:56:04 +01:00
parent b4d2b65841
commit ccd70540e3

View File

@ -86,7 +86,7 @@ static inline char* duplicateStringValue(const char* value,
size_t length) {
// Avoid an integer overflow in the call to malloc below by limiting length
// to a sane value.
if (length >= (size_t)Value::maxInt)
if (length >= static_cast<size_t>(Value::maxInt))
length = Value::maxInt - 1;
char* newString = static_cast<char*>(malloc(length + 1));
@ -108,7 +108,7 @@ static inline char* duplicateAndPrefixStringValue(
{
// Avoid an integer overflow in the call to malloc below by limiting length
// to a sane value.
JSON_ASSERT_MESSAGE(length <= (unsigned)Value::maxInt - sizeof(unsigned) - 1U,
JSON_ASSERT_MESSAGE(length <= static_cast<unsigned>(Value::maxInt) - sizeof(unsigned) - 1U,
"in Json::Value::duplicateAndPrefixStringValue(): "
"length too big for prefixing");
unsigned actualLength = length + static_cast<unsigned>(sizeof(unsigned)) + 1U;