Merge "libutils: Make LightFlattenablePod safe for unaligned ptr" into oc-dev

am: ba73a138e0

Change-Id: I4a3e0d4a84465e35109c27032ad92e4577240a74
This commit is contained in:
Chris Forbes 2017-05-04 20:31:36 +00:00 committed by android-build-merger
commit efa6100129
1 changed files with 2 additions and 2 deletions

View File

@ -189,11 +189,11 @@ public:
}
inline status_t flatten(void* buffer, size_t size) const {
if (size < sizeof(T)) return NO_MEMORY;
*reinterpret_cast<T*>(buffer) = *static_cast<T const*>(this);
memcpy(buffer, static_cast<T const*>(this), sizeof(T));
return NO_ERROR;
}
inline status_t unflatten(void const* buffer, size_t) {
*static_cast<T*>(this) = *reinterpret_cast<T const*>(buffer);
memcpy(static_cast<T*>(this), buffer, sizeof(T));
return NO_ERROR;
}
};