Merge pull request #2035 from sergiocampama/cpp
Fixes static analyzer issues from xcode.
This commit is contained in:
commit
142e2fa45e
5 changed files with 7 additions and 4 deletions
|
@ -570,6 +570,7 @@ bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) {
|
||||||
|
|
||||||
input_ = NULL;
|
input_ = NULL;
|
||||||
source_code_info_ = NULL;
|
source_code_info_ = NULL;
|
||||||
|
assert(file != NULL);
|
||||||
source_code_info.Swap(file->mutable_source_code_info());
|
source_code_info.Swap(file->mutable_source_code_info());
|
||||||
return !had_errors_;
|
return !had_errors_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,9 @@ void SubstituteAndAppend(
|
||||||
for (int i = 0; format[i] != '\0'; i++) {
|
for (int i = 0; format[i] != '\0'; i++) {
|
||||||
if (format[i] == '$') {
|
if (format[i] == '$') {
|
||||||
if (ascii_isdigit(format[i+1])) {
|
if (ascii_isdigit(format[i+1])) {
|
||||||
const SubstituteArg* src = args_array[format[i+1] - '0'];
|
unsigned int index = format[i+1] - '0';
|
||||||
|
assert(index < 10);
|
||||||
|
const SubstituteArg* src = args_array[index];
|
||||||
memcpy(target, src->data(), src->size());
|
memcpy(target, src->data(), src->size());
|
||||||
target += src->size();
|
target += src->size();
|
||||||
++i; // Skip next char.
|
++i; // Skip next char.
|
||||||
|
|
|
@ -586,7 +586,6 @@ void DefaultValueObjectWriter::RenderDataPiece(StringPiece name,
|
||||||
new Node(name.ToString(), NULL, PRIMITIVE, data, false,
|
new Node(name.ToString(), NULL, PRIMITIVE, data, false,
|
||||||
child == NULL ? current_->path() : child->path(),
|
child == NULL ? current_->path() : child->path(),
|
||||||
suppress_empty_list_, field_scrub_callback_.get()));
|
suppress_empty_list_, field_scrub_callback_.get()));
|
||||||
child = node.get();
|
|
||||||
current_->AddChild(node.release());
|
current_->AddChild(node.release());
|
||||||
} else {
|
} else {
|
||||||
child->set_data(data);
|
child->set_data(data);
|
||||||
|
|
|
@ -315,7 +315,6 @@ util::Status JsonStreamParser::ParseStringHelper() {
|
||||||
// We're about to handle an escape, copy all bytes from last to data.
|
// We're about to handle an escape, copy all bytes from last to data.
|
||||||
if (last < data) {
|
if (last < data) {
|
||||||
parsed_storage_.append(last, data - last);
|
parsed_storage_.append(last, data - last);
|
||||||
last = data;
|
|
||||||
}
|
}
|
||||||
// If we ran out of string after the \, cancel or report an error
|
// If we ran out of string after the \, cancel or report an error
|
||||||
// depending on if we expect more data later.
|
// depending on if we expect more data later.
|
||||||
|
@ -371,7 +370,6 @@ util::Status JsonStreamParser::ParseStringHelper() {
|
||||||
} else {
|
} else {
|
||||||
if (last < data) {
|
if (last < data) {
|
||||||
parsed_storage_.append(last, data - last);
|
parsed_storage_.append(last, data - last);
|
||||||
last = data;
|
|
||||||
}
|
}
|
||||||
parsed_ = StringPiece(parsed_storage_);
|
parsed_ = StringPiece(parsed_storage_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -626,6 +626,7 @@ bool MessageDifferencer::CompareWithFieldsInternal(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reporter_ != NULL) {
|
if (reporter_ != NULL) {
|
||||||
|
assert(field1 != NULL);
|
||||||
int count = field1->is_repeated() ?
|
int count = field1->is_repeated() ?
|
||||||
reflection1->FieldSize(message1, field1) : 1;
|
reflection1->FieldSize(message1, field1) : 1;
|
||||||
|
|
||||||
|
@ -706,6 +707,7 @@ bool MessageDifferencer::CompareWithFieldsInternal(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fieldDifferent = false;
|
bool fieldDifferent = false;
|
||||||
|
assert(field1 != NULL);
|
||||||
if (field1->is_repeated()) {
|
if (field1->is_repeated()) {
|
||||||
fieldDifferent = !CompareRepeatedField(message1, message2, field1,
|
fieldDifferent = !CompareRepeatedField(message1, message2, field1,
|
||||||
parent_fields);
|
parent_fields);
|
||||||
|
@ -875,6 +877,7 @@ bool MessageDifferencer::CompareRepeatedField(
|
||||||
|
|
||||||
for (int i = 0; i < count1; ++i) {
|
for (int i = 0; i < count1; ++i) {
|
||||||
if (match_list1[i] != -1) continue;
|
if (match_list1[i] != -1) continue;
|
||||||
|
assert(reporter_ != NULL);
|
||||||
specific_field.index = i;
|
specific_field.index = i;
|
||||||
parent_fields->push_back(specific_field);
|
parent_fields->push_back(specific_field);
|
||||||
reporter_->ReportDeleted(message1, message2, *parent_fields);
|
reporter_->ReportDeleted(message1, message2, *parent_fields);
|
||||||
|
|
Loading…
Add table
Reference in a new issue