Skip to content

Commit

Permalink
Remove gcc compilation warning in json_reader.cpp
Browse files Browse the repository at this point in the history
Submitting Patch for Issue : open-source-parsers#77
It will fix warnings in json_reader.cpp
  • Loading branch information
ya1gaurav committed Nov 17, 2014
1 parent 3e3a8d5 commit 767713b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/lib_json/json_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,9 @@ std::vector<Reader::StructuredError> Reader::getStructuredErrors() const {
}

bool Reader::pushError(const Value& value, const std::string& message) {
if(value.getOffsetStart() > end_ - begin_
|| value.getOffsetLimit() > end_ - begin_)
size_t length = end_ - begin_;
if(value.getOffsetStart() > length
|| value.getOffsetLimit() > length)
return false;
Token token;
token.type_ = tokenError;
Expand All @@ -847,9 +848,10 @@ bool Reader::pushError(const Value& value, const std::string& message) {
}

bool Reader::pushError(const Value& value, const std::string& message, const Value& extra) {
if(value.getOffsetStart() > end_ - begin_
|| value.getOffsetLimit() > end_ - begin_
|| extra.getOffsetLimit() > end_ - begin_)
size_t length = end_ - begin_;
if(value.getOffsetStart() > length
|| value.getOffsetLimit() > length
|| extra.getOffsetLimit() > length)
return false;
Token token;
token.type_ = tokenError;
Expand Down

0 comments on commit 767713b

Please sign in to comment.