Move more .data()'s to .span() inside flatbuffers.h
We missed a couple...
Change-Id: I105d9c73680628579518ed68777bb687160f8bc8
diff --git a/aos/flatbuffers.h b/aos/flatbuffers.h
index efb4f0e..81a8cee 100644
--- a/aos/flatbuffers.h
+++ b/aos/flatbuffers.h
@@ -313,9 +313,11 @@
void CopyFrom(const NonSizePrefixedFlatbuffer<T> &other) {
CHECK(!allocator_.is_allocated()) << ": May not overwrite while building";
- memcpy(buffer_.begin(), other.data(), other.size());
+ CHECK_LE(other.span().size(), Size)
+ << ": Source flatbuffer is larger than the target.";
+ memcpy(buffer_.begin(), other.span().data(), other.span().size());
data_ = buffer_.begin();
- size_ = other.size();
+ size_ = other.span().size();
}
void Reset() {