Skip to content

Commit

Permalink
remove C-style casting
Browse files Browse the repository at this point in the history
  • Loading branch information
tmaciejewski committed Feb 28, 2016
1 parent b4d2b65 commit ccd7054
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib_json/json_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
Expand Down

0 comments on commit ccd7054

Please sign in to comment.