Change size_t member of hidl_memory type to uint64_t
Also static_assert offsets to private members
in hidl_* types used in parcelling/unparcelling code.
Bug: 34986428 33846034
Test: hidl_test passes
Change-Id: Ib2ee81c45ee797f4933ed142160aeed250675819
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index 7737011..14afce3 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -270,7 +270,7 @@
return mName;
}
- size_t size() const {
+ uint64_t size() const {
return mSize;
}
@@ -280,9 +280,9 @@
static const size_t kOffsetOfName;
private:
- hidl_handle mHandle;
- size_t mSize;
- hidl_string mName;
+ hidl_handle mHandle __attribute__ ((aligned(8)));
+ uint64_t mSize __attribute__ ((aligned(8)));
+ hidl_string mName __attribute__ ((aligned(8)));
};
////////////////////////////////////////////////////////////////////////////////
@@ -293,6 +293,7 @@
: mBuffer(NULL),
mSize(0),
mOwnsBuffer(true) {
+ static_assert(hidl_vec<T>::kOffsetOfBuffer == 0, "wrong offset");
}
hidl_vec(const hidl_vec<T> &other) : hidl_vec() {