Skip to content

Commit a691cb1

Browse files
authored
Merge pull request open-source-parsers#553 from AlB80/master
Clarify code for value type return
2 parents 77632b2 + ee79359 commit a691cb1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/lib_json/json_value.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,11 @@ bool Value::isBool() const { return type_ == booleanValue; }
12791279
bool Value::isInt() const {
12801280
switch (type_) {
12811281
case intValue:
1282+
#if defined(JSON_HAS_INT64)
12821283
return value_.int_ >= minInt && value_.int_ <= maxInt;
1284+
#else
1285+
return true;
1286+
#endif
12831287
case uintValue:
12841288
return value_.uint_ <= UInt(maxInt);
12851289
case realValue:
@@ -1294,9 +1298,17 @@ bool Value::isInt() const {
12941298
bool Value::isUInt() const {
12951299
switch (type_) {
12961300
case intValue:
1301+
#if defined(JSON_HAS_INT64)
12971302
return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt);
1303+
#else
1304+
return value_.int_ >= 0;
1305+
#endif
12981306
case uintValue:
1307+
#if defined(JSON_HAS_INT64)
12991308
return value_.uint_ <= maxUInt;
1309+
#else
1310+
return true;
1311+
#endif
13001312
case realValue:
13011313
return value_.real_ >= 0 && value_.real_ <= maxUInt &&
13021314
IsIntegral(value_.real_);
@@ -1354,9 +1366,9 @@ bool Value::isIntegral() const {
13541366
#endif
13551367
}
13561368

1357-
bool Value::isDouble() const { return type_ == realValue || isIntegral(); }
1369+
bool Value::isDouble() const { return type_ == intValue || type_ == uintValue || type_ == realValue; }
13581370

1359-
bool Value::isNumeric() const { return isIntegral() || isDouble(); }
1371+
bool Value::isNumeric() const { return isDouble(); }
13601372

13611373
bool Value::isString() const { return type_ == stringValue; }
13621374

0 commit comments

Comments
 (0)