Skip to content

Commit b947b0b

Browse files
committed
Merge pull request open-source-parsers#192 from marklakata/size_t
changed length argument of duplicateStringValue from unsigned int to siz...
2 parents c8bf184 + 8051cf6 commit b947b0b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/lib_json/json_value.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const LargestInt Value::maxLargestInt = LargestInt(LargestUInt(-1) / 2);
5252
const LargestUInt Value::maxLargestUInt = LargestUInt(-1);
5353

5454
/// Unknown size marker
55-
static const unsigned int unknown = (unsigned)-1;
55+
static const size_t unknown = (size_t)-1;
5656

5757
#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
5858
template <typename T, typename U>
@@ -82,13 +82,13 @@ static inline bool InRange(double d, T min, U max) {
8282
* @return Pointer on the duplicate instance of string.
8383
*/
8484
static inline char* duplicateStringValue(const char* value,
85-
unsigned int length = unknown) {
85+
size_t length = unknown) {
8686
if (length == unknown)
87-
length = (unsigned int)strlen(value);
87+
length = strlen(value);
8888

8989
// Avoid an integer overflow in the call to malloc below by limiting length
9090
// to a sane value.
91-
if (length >= (unsigned)Value::maxInt)
91+
if (length >= (size_t)Value::maxInt)
9292
length = Value::maxInt - 1;
9393

9494
char* newString = static_cast<char*>(malloc(length + 1));

0 commit comments

Comments
 (0)