From: Hwankyu Jhun Date: Thu, 11 Mar 2021 05:07:28 +0000 (+0900) Subject: Fix rpc-port-parcel implementation related to bundle X-Git-Tag: accepted/tizen/unified/20210318.055950~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=562f8f294546b490dfb2ab2c0c12d43067f1651e;p=platform%2Fcore%2Fappfw%2Frpc-port.git Fix rpc-port-parcel implementation related to bundle Parcel APIs related to Bundle API will be removed. rpc_port_parcel_write_bundle() modifies to use use parcel_write_string() instead of parcel_write_bundle(). rpc_port_parcel_read_bundle() modifies to use parcel_read_string() instead of parcel_read_bundle(). Change-Id: Iad0b6e347bb72197ebeffd1a630862a5eb8ffbbc Signed-off-by: Hwankyu Jhun --- diff --git a/src/rpc-port-parcel.cc b/src/rpc-port-parcel.cc index e934efb..2276a77 100644 --- a/src/rpc-port-parcel.cc +++ b/src/rpc-port-parcel.cc @@ -18,6 +18,8 @@ #include #include +#include + #include "log-private.hh" #include "port-internal.hh" #include "rpc-port-parcel.h" @@ -203,8 +205,13 @@ RPC_API int rpc_port_parcel_write_bundle(rpc_port_parcel_h h, bundle* b) { 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(raw, std::free); + parcel_h parcel = static_cast(h); - parcel_write_bundle(parcel, b); + parcel_write_string(parcel, reinterpret_cast(raw)); return RPC_PORT_ERROR_NONE; } @@ -334,10 +341,14 @@ RPC_API int rpc_port_parcel_read_bundle(rpc_port_parcel_h h, bundle** b) { return RPC_PORT_ERROR_INVALID_PARAMETER; parcel_h parcel = static_cast(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(raw), strlen(raw)); + std::free(raw); } return RPC_PORT_ERROR_NONE;