mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-28 12:00:07 +08:00
remove C-style casting
This commit is contained in:
parent
b4d2b65841
commit
ccd70540e3
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user