summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Bailey <dbaileychess@gmail.com>2023-04-29 00:08:14 -0700
committerDerek Bailey <dbaileychess@gmail.com>2023-04-29 00:43:34 -0700
commitdbce69c63b0f3cee8f6d9521479fd3b087338314 (patch)
treeb10ff1c815360160743fe762fb6df5c64ca20375
parentaeba096403d8b1796c8781f4a1cbf4214bcf539f (diff)
downloadflatbuffers-dbce69c63b0f3cee8f6d9521479fd3b087338314.tar.gz
flatbuffers-dbce69c63b0f3cee8f6d9521479fd3b087338314.tar.bz2
flatbuffers-dbce69c63b0f3cee8f6d9521479fd3b087338314.zip
more window fixes
-rw-r--r--src/binary_annotator.cpp4
-rw-r--r--src/binary_annotator.h2
-rw-r--r--src/reflection.cpp8
3 files changed, 8 insertions, 6 deletions
diff --git a/src/binary_annotator.cpp b/src/binary_annotator.cpp
index 2c31fe5f..c5fa42f7 100644
--- a/src/binary_annotator.cpp
+++ b/src/binary_annotator.cpp
@@ -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;
diff --git a/src/binary_annotator.h b/src/binary_annotator.h
index 096f9a48..fd0a9af0 100644
--- a/src/binary_annotator.h
+++ b/src/binary_annotator.h
@@ -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;
diff --git a/src/reflection.cpp b/src/reflection.cpp
index 6ea2d20b..0d0814ef 100644
--- a/src/reflection.cpp
+++ b/src/reflection.cpp
@@ -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) {