template <typename T>
void Parcel::Impl::Write(T d) {
- WriteSize(sizeof(T));
auto* p = reinterpret_cast<uint8_t*>(&d);
std::copy(p, p + sizeof(T), std::back_inserter(data_));
}
template <typename T>
int Parcel::Impl::Read(T* d) {
- uint32_t size = 0;
- int ret = ReadSize(&size);
- if (ret != TIZEN_ERROR_NONE)
- return ret;
-
- if (size == 0 || size != sizeof(T))
- return TIZEN_ERROR_ILLEGAL_BYTE_SEQ;
-
+ uint32_t size = sizeof(T);
if (reader_ + size > data_.size())
return TIZEN_ERROR_ILLEGAL_BYTE_SEQ;