Added functionality to obtain a buffer pointer from a root.

Change-Id: Ia63e41d0304e8668ea4ce09a4c31dd999eb96994
Tested: on Linux.
Bug: 32218623
This commit is contained in:
Wouter van Oortmerssen
2016-10-17 18:02:19 -07:00
parent 22e87071dd
commit 6862b2ff08
4 changed files with 58 additions and 10 deletions

View File

@@ -1352,10 +1352,11 @@ CheckedError Parser::ParseDecl() {
auto align = static_cast<size_t>(atoi(force_align->constant.c_str()));
if (force_align->type.base_type != BASE_TYPE_INT ||
align < struct_def->minalign ||
align > 16 ||
align > FLATBUFFERS_MAX_ALIGNMENT ||
align & (align - 1))
return Error("force_align must be a power of two integer ranging from the"
"struct\'s natural alignment to 16");
"struct\'s natural alignment to " +
NumToString(FLATBUFFERS_MAX_ALIGNMENT));
struct_def->minalign = align;
}
struct_def->PadLastField(struct_def->minalign);