more window fixes

This commit is contained in:
Derek Bailey
2023-04-29 00:08:14 -07:00
parent aeba096403
commit dbce69c63b
3 changed files with 8 additions and 6 deletions

View File

@@ -26,7 +26,7 @@ static BinaryRegion MakeBinaryRegion(
const uint64_t offset = 0, const uint64_t length = 0,
const BinaryRegionType type = BinaryRegionType::Unknown,
const uint64_t array_length = 0, const uint64_t points_to_offset = 0,
const BinaryRegionComment comment = {}) {
BinaryRegionComment comment = {}) {
BinaryRegion region;
region.offset = offset;
region.length = length;
@@ -39,7 +39,7 @@ static BinaryRegion MakeBinaryRegion(
static BinarySection MakeBinarySection(
const std::string &name, const BinarySectionType type,
const std::vector<BinaryRegion> regions) {
std::vector<BinaryRegion> regions) {
BinarySection section;
section.name = name;
section.type = type;

View File

@@ -258,7 +258,7 @@ class BinaryAnnotator {
uint16_t offset_from_table = 0;
};
const reflection::Object *referring_table;
const reflection::Object *referring_table = nullptr;
// Field ID -> {field def, offset from table}
std::map<uint16_t, Entry> fields;

View File

@@ -506,7 +506,9 @@ class ResizeContext {
// Recurse.
switch (base_type) {
case reflection::Obj: {
ResizeTable(*subobjectdef, reinterpret_cast<Table *>(ref));
if (subobjectdef) {
ResizeTable(*subobjectdef, reinterpret_cast<Table *>(ref));
}
break;
}
case reflection::Vector: {
@@ -564,7 +566,7 @@ void SetString(const reflection::Schema &schema, const std::string &val,
// Clear the old string, since we don't want parts of it remaining.
memset(flatbuf->data() + start, 0, str->size());
// Different size, we must expand (or contract).
ResizeContext(schema, start, delta, flatbuf, root_table);
ResizeContext ctx(schema, start, delta, flatbuf, root_table);
// Set the new length.
WriteScalar(flatbuf->data() + str_start,
static_cast<uoffset_t>(val.size()));
@@ -590,7 +592,7 @@ uint8_t *ResizeAnyVector(const reflection::Schema &schema, uoffset_t newsize,
auto size_clear = -delta_elem * elem_size;
memset(flatbuf->data() + start - size_clear, 0, size_clear);
}
ResizeContext(schema, start, delta_bytes, flatbuf, root_table);
ResizeContext ctx(schema, start, delta_bytes, flatbuf, root_table);
WriteScalar(flatbuf->data() + vec_start, newsize); // Length field.
// Set new elements to 0.. this can be overwritten by the caller.
if (delta_elem > 0) {