#include <stdint.h>
#include <string.h>
+#include <memory>
+
#include "log-private.hh"
#include "port-internal.hh"
#include "rpc-port-parcel.h"
if (h == nullptr || b == nullptr)
return RPC_PORT_ERROR_INVALID_PARAMETER;
+ bundle_raw* raw = nullptr;
+ int len = 0;
+ bundle_encode(b, &raw, &len);
+ auto ptr = std::unique_ptr<bundle_raw, decltype(std::free)*>(raw, std::free);
+
parcel_h parcel = static_cast<parcel_h>(h);
- parcel_write_bundle(parcel, b);
+ parcel_write_string(parcel, reinterpret_cast<char*>(raw));
return RPC_PORT_ERROR_NONE;
}
return RPC_PORT_ERROR_INVALID_PARAMETER;
parcel_h parcel = static_cast<parcel_h>(h);
- int ret = parcel_read_bundle(parcel, b);
+ char* raw = nullptr;
+ int ret = parcel_read_string(parcel, &raw);
if (ret != PARCEL_ERROR_NONE) {
- _E("parcel_read_bundle() is failed. error(%d)", ret);
+ _E("parcel_read_string() is failed. error(%d)", ret);
*b = bundle_create();
+ } else {
+ *b = bundle_decode(reinterpret_cast<bundle_raw*>(raw), strlen(raw));
+ std::free(raw);
}
return RPC_PORT_ERROR_NONE;