mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-07 05:47:36 +00:00
Fixed whole-number float default values missing a .0 suffix.
A previous commit that added "f" for C++/Java/C# would break on gcc of constants like 3f, which are now output as 3.0f Tested: on Linux Change-Id: If9cabbe3c6d6948a5050b8b123bda9c06e181f52
This commit is contained in:
@@ -543,6 +543,10 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
|
||||
if (!IsScalar(type.base_type))
|
||||
return Error("default values currently only supported for scalars");
|
||||
ECHECK(ParseSingleValue(field->value));
|
||||
if (IsFloat(field->value.type.base_type)) {
|
||||
if (!strpbrk(field->value.constant.c_str(), ".eE"))
|
||||
field->value.constant += ".0";
|
||||
}
|
||||
}
|
||||
|
||||
if (type.enum_def &&
|
||||
|
||||
Reference in New Issue
Block a user