Fix Parcel implementation
[platform/core/base/bundle.git] / parcel / parcel.cc
index e310654..9171895 100644 (file)
@@ -76,7 +76,6 @@ void Parcel::Impl::WriteSize(uint32_t size) {
 
 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_));
 }
@@ -96,14 +95,7 @@ int Parcel::Impl::ReadSize(uint32_t* size) {
 
 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;