Stop stripping the size prefix off
This turns out to be super dangerous to do. A flatbuffer is aligned
assuming that the size is either there or not there. By removing it,
you break alignment.
This necesitates having 2 subclasses of Flatbuffer. A SizePrefixed
version and a non size prefixed version. That lets us distinguish for
methods which care.
Once all that's done, deal with the fallout through the code base,
including logfile_utils and the chaos that causes rippling out.
Change-Id: I91b7be355279a1c19e5c956c33359df01a17eacf
diff --git a/aos/events/logging/logger_test.cc b/aos/events/logging/logger_test.cc
index c55b18b..dbc8a78 100644
--- a/aos/events/logging/logger_test.cc
+++ b/aos/events/logging/logger_test.cc
@@ -263,7 +263,7 @@
{
// Confirm that the UUIDs match for both the parts and the logger, and the
// parts_index increments.
- std::vector<FlatbufferVector<LogFileHeader>> log_header;
+ std::vector<SizePrefixedFlatbufferVector<LogFileHeader>> log_header;
for (std::string_view f : {logfile0, logfile1}) {
log_header.emplace_back(ReadHeader(f).value());
}
@@ -563,7 +563,7 @@
message_reader.log_file_header()->configuration()->channels()->size(), 0);
while (true) {
- std::optional<FlatbufferVector<MessageHeader>> msg =
+ std::optional<SizePrefixedFlatbufferVector<MessageHeader>> msg =
message_reader.ReadMessage();
if (!msg) {
break;
@@ -636,7 +636,7 @@
std::set<std::string> parts_uuids;
// Confirm that we have the expected number of UUIDs for both the logfile
// UUIDs and parts UUIDs.
- std::vector<FlatbufferVector<LogFileHeader>> log_header;
+ std::vector<SizePrefixedFlatbufferVector<LogFileHeader>> log_header;
for (std::string_view f : logfiles_) {
log_header.emplace_back(ReadHeader(f).value());
logfile_uuids.insert(log_header.back().message().log_event_uuid()->str());