Convenient methods for JSON integer. (#5089)
* Fix parsing empty object.
This commit is contained in:
@@ -243,7 +243,7 @@ Json& JsonNumber::operator[](int ind) {
|
||||
|
||||
bool JsonNumber::operator==(Value const& rhs) const {
|
||||
if (!IsA<JsonNumber>(&rhs)) { return false; }
|
||||
return number_ == Cast<JsonNumber const>(&rhs)->getNumber();
|
||||
return std::abs(number_ - Cast<JsonNumber const>(&rhs)->getNumber()) < kRtEps;
|
||||
}
|
||||
|
||||
Value & JsonNumber::operator=(Value const &rhs) {
|
||||
@@ -504,7 +504,10 @@ Json JsonReader::ParseObject() {
|
||||
SkipSpaces();
|
||||
char ch = PeekNextChar();
|
||||
|
||||
if (ch == '}') return Json(std::move(data));
|
||||
if (ch == '}') {
|
||||
GetChar('}');
|
||||
return Json(std::move(data));
|
||||
}
|
||||
|
||||
while (true) {
|
||||
SkipSpaces();
|
||||
|
||||
Reference in New Issue
Block a user