template<typename T> Offset<Vector<const T *>> CreateVectorOfStructs(
const T *v, size_t len) {
NotNested();
- StartVector(len, AlignOf<T>());
+ StartVector(len * sizeof(T) / AlignOf<T>(), AlignOf<T>());
PushBytes(reinterpret_cast<const uint8_t *>(v), sizeof(T) * len);
return Offset<Vector<const T *>>(EndVector(len));
}
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE) \
case BASE_TYPE_ ## ENUM: \
builder_.Pad(field->padding); \
- builder_.AddElement(value.offset, \
+ if (struct_def.fixed) { \
+ builder_.PushElement(atot<CTYPE>(value.constant.c_str())); \
+ } else { \
+ builder_.AddElement(value.offset, \
atot<CTYPE>( value.constant.c_str()), \
atot<CTYPE>(field->value.constant.c_str())); \
+ } \
break;
FLATBUFFERS_GEN_TYPES_SCALAR(FLATBUFFERS_TD);
#undef FLATBUFFERS_TD
}
Next();
- builder_.StartVector(count * InlineSize(type), InlineAlignment((type)));
+ builder_.StartVector(count * InlineSize(type) / InlineAlignment(type),
+ InlineAlignment(type));
for (int i = 0; i < count; i++) {
// start at the back, since we're building the data backwards.
auto &val = field_stack_.back().first;