mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 04:21:13 +00:00
various fixes for google merge
This commit is contained in:
@@ -1102,8 +1102,9 @@ CheckedError Parser::ParseAnyValue(Value &val, FieldDef *field,
|
||||
uint8_t enum_idx;
|
||||
if (vector_of_union_types) {
|
||||
if (vector_of_union_types->size() <= count)
|
||||
return Error("union types vector smaller than union values vector"
|
||||
" for: " + field->name);
|
||||
return Error(
|
||||
"union types vector smaller than union values vector for: " +
|
||||
field->name);
|
||||
enum_idx = vector_of_union_types->Get(count);
|
||||
} else {
|
||||
ECHECK(atot(constant.c_str(), *this, &enum_idx));
|
||||
@@ -2884,7 +2885,8 @@ CheckedError Parser::ParseProtoFields(StructDef *struct_def, bool isextend,
|
||||
if (key == "default") {
|
||||
// Temp: skip non-numeric and non-boolean defaults (enums).
|
||||
auto numeric = strpbrk(val.c_str(), "0123456789-+.");
|
||||
if (IsScalar(type.base_type) && numeric == val.c_str()) {
|
||||
if (IsScalar(type.base_type) &&
|
||||
(numeric == val.c_str() || val == "inf" || val == "-inf")) {
|
||||
field->value.constant = val;
|
||||
} else if (val == "true") {
|
||||
field->value.constant = val;
|
||||
@@ -3255,7 +3257,6 @@ CheckedError Parser::ParseRoot(const char *source, const char **include_paths,
|
||||
}
|
||||
// Parse JSON object only if the scheme has been parsed.
|
||||
if (token_ == '{') { ECHECK(DoParseJson()); }
|
||||
EXPECT(kTokenEof);
|
||||
return NoError();
|
||||
}
|
||||
|
||||
@@ -3423,6 +3424,7 @@ CheckedError Parser::DoParse(const char *source, const char **include_paths,
|
||||
ECHECK(ParseDecl(source_filename));
|
||||
}
|
||||
}
|
||||
EXPECT(kTokenEof);
|
||||
if (opts.warnings_as_errors && has_warning_) {
|
||||
return Error("treating warnings as errors, failed due to above warnings");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user