mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-19 05:53:06 +00:00
committed by
Wouter van Oortmerssen
parent
a3d8391f7b
commit
20396a1760
@@ -2163,9 +2163,11 @@ class CppGenerator : public BaseGenerator {
|
||||
auto cpp_type = field.attributes.Lookup("cpp_type");
|
||||
std::string indexing;
|
||||
if (field.value.type.enum_def) {
|
||||
indexing += "(" + WrapInNameSpace(*field.value.type.enum_def) + ")";
|
||||
indexing += "static_cast<" +
|
||||
WrapInNameSpace(*field.value.type.enum_def) + ">(";
|
||||
}
|
||||
indexing += "_e->Get(_i)";
|
||||
if (field.value.type.enum_def) { indexing += ")"; }
|
||||
if (field.value.type.element == BASE_TYPE_BOOL) { indexing += " != 0"; }
|
||||
|
||||
// Generate code that pushes data from _e to _o in the form:
|
||||
|
||||
@@ -395,7 +395,7 @@ static void StructBuilderArgs(const StructDef &struct_def,
|
||||
(nameprefix + (field.name + "_")).c_str(), code_ptr);
|
||||
} else {
|
||||
std::string &code = *code_ptr;
|
||||
code += (std::string) ", " + nameprefix;
|
||||
code += std::string(", ") + nameprefix;
|
||||
code += GoIdentity(field.name);
|
||||
code += " " + GenTypeBasic(field.value.type);
|
||||
}
|
||||
|
||||
@@ -459,8 +459,9 @@ class JsGenerator : public BaseGenerator {
|
||||
case BASE_TYPE_LONG:
|
||||
case BASE_TYPE_ULONG: {
|
||||
int64_t constant = StringToInt(value.constant.c_str());
|
||||
return context + ".createLong(" + NumToString((int32_t)constant) +
|
||||
", " + NumToString((int32_t)(constant >> 32)) + ")";
|
||||
return context + ".createLong(" +
|
||||
NumToString(static_cast<int32_t>(constant)) + ", " +
|
||||
NumToString(static_cast<int32_t>(constant >> 32)) + ")";
|
||||
}
|
||||
|
||||
default: return value.constant;
|
||||
|
||||
@@ -362,7 +362,7 @@ namespace lua {
|
||||
}
|
||||
else {
|
||||
std::string &code = *code_ptr;
|
||||
code += (std::string) ", " + nameprefix;
|
||||
code += std::string(", ") + nameprefix;
|
||||
code += MakeCamel(NormalizedName(field), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ class PhpGenerator : public BaseGenerator {
|
||||
(nameprefix + (field.name + "_")).c_str(), code_ptr);
|
||||
} else {
|
||||
std::string &code = *code_ptr;
|
||||
code += (std::string) ", $" + nameprefix;
|
||||
code += std::string(", $") + nameprefix;
|
||||
code += MakeCamel(field.name, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ class PythonGenerator : public BaseGenerator {
|
||||
(nameprefix + (NormalizedName(field) + "_")).c_str(), code_ptr);
|
||||
} else {
|
||||
std::string &code = *code_ptr;
|
||||
code += (std::string) ", " + nameprefix;
|
||||
code += std::string(", ") + nameprefix;
|
||||
code += MakeCamel(NormalizedName(field), false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user