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/event_loop.cc b/aos/events/event_loop.cc
index 5c0b628..08fa7fd 100644
--- a/aos/events/event_loop.cc
+++ b/aos/events/event_loop.cc
@@ -193,12 +193,12 @@
// Also, flatbuffers build from the back end. So place this at the back end
// of the buffer. We only have to care because we are using this in a very
// raw fashion.
- CHECK_LE(timing_report_.size(), timing_report_sender_->size())
+ CHECK_LE(timing_report_.span().size(), timing_report_sender_->size())
<< ": Timing report bigger than the sender size.";
- std::copy(timing_report_.data(),
- timing_report_.data() + timing_report_.size(),
+ std::copy(timing_report_.span().data(),
+ timing_report_.span().data() + timing_report_.span().size(),
reinterpret_cast<uint8_t *>(timing_report_sender_->data()) +
- timing_report_sender_->size() - timing_report_.size());
+ timing_report_sender_->size() - timing_report_.span().size());
for (const std::unique_ptr<TimerHandler> &timer : timers_) {
timer->timing_.ResetTimingReport();
@@ -215,7 +215,7 @@
for (RawFetcher *fetcher : fetchers_) {
fetcher->timing_.ResetTimingReport();
}
- timing_report_sender_->Send(timing_report_.size());
+ timing_report_sender_->Send(timing_report_.span().size());
}
void EventLoop::UpdateTimingReport() {