void ##::OnDisconnectedCB(const char *service_name,
const cion_peer_info_h peer_info, void *user_data) {
##* stub = static_cast<##*>(user_data);
- char *peer_app_id, *peer_uuid;
- cion_peer_info_get_app_id(peer_info, &peer_app_id);
- cion_peer_info_get_app_id(peer_info, &peer_uuid);
-
- for (auto s = stub->services_.begin();
- s != stub->services_.end(); s++) {
- char *service_app_id, *service_uuid;
- cion_peer_info_get_app_id(s->get()->GetPeer(), &service_app_id);
- cion_peer_info_get_app_id(s->get()->GetPeer(), &service_uuid);
+ char* peer_app_id = nullptr;
+ int ret = cion_peer_info_get_app_id(peer_info, &peer_app_id);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+ return;
+ }
+ auto perr_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(peer_app_id, std::free);
+
+ char* peer_uuid = nullptr;
+ ret = cion_peer_info_get_uuid(peer_info, &peer_uuid);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+ return;
+ }
+ auto peer_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(peer_uuid, std::free);
+
+ for (auto s = stub->services_.begin(); s != stub->services_.end(); s++) {
+ char* service_app_id = nullptr;
+ ret = cion_peer_info_get_app_id(s->get()->GetPeer(), &service_app_id);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+ return;
+ }
+ auto service_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(service_app_id, std::free);
+
+ char* service_uuid = nullptr;;
+ ret = cion_peer_info_get_uuid(s->get()->GetPeer(), &service_uuid);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peeer_info_get_uuid() is failed. error(%d)", ret);
+ return;
+ }
+ auto service_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(service_uuid, std::free);
+
if (strcmp(peer_app_id, service_app_id) == 0 &&
strcmp(peer_uuid, service_uuid) == 0) {
stub->services_.erase(s);
$$* stub = static_cast<$$*>(user_data);
std::shared_ptr<ServiceBase> b;
rpc_port_parcel_h p;
- char *peer_app_id, *peer_uuid;
- cion_peer_info_get_app_id(peer_info, &peer_app_id);
- cion_peer_info_get_app_id(peer_info, &peer_uuid);
+ char* peer_app_id = nullptr;
+ int ret = cion_peer_info_get_app_id(peer_info, &peer_app_id);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+ return;
+ }
+ auto peer_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(peer_app_id, std::free);
+
+ char* peer_uuid = nullptr;;
+ ret = cion_peer_info_get_uuid(peer_info, &peer_uuid);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+ return;
+ }
+ auto peer_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(peer_uuid, std::free);
for (auto& s : stub->services_) {
- char *service_app_id, *service_uuid;
- cion_peer_info_get_app_id(s->GetPeer(), &service_app_id);
- cion_peer_info_get_app_id(s->GetPeer(), &service_uuid);
+ char* service_app_id = nullptr;
+ ret = cion_peer_info_get_app_id(s->GetPeer(), &service_app_id);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+ return;
+ }
+ auto service_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(service_app_id, std::free);
+
+ char* service_uuid = nullptr;
+ ret = cion_peer_info_get_uuid(s->GetPeer(), &service_uuid);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+ return;
+ }
+ auto service_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(service_uuid, std::free);
+
if (strcmp(peer_app_id, service_app_id) == 0 &&
strcmp(peer_uuid, service_uuid) == 0) {
b = s;
}
cion_payload_type_e type;
- int ret = cion_payload_get_type(payload, &type);
+ ret = cion_payload_get_type(payload, &type);
if (ret != CION_ERROR_NONE) {
_E("Failed to cion_payload_get_type. error(%d)", ret);
return;
$$* stub = static_cast<$$*>(user_data);
std::shared_ptr<ServiceBase> b;
rpc_port_parcel_h p;
- char *peer_app_id, *peer_uuid;
- cion_peer_info_get_app_id(peer_info, &peer_app_id);
- cion_peer_info_get_app_id(peer_info, &peer_uuid);
+ char* peer_app_id = nullptr;
+ int ret = cion_peer_info_get_app_id(peer_info, &peer_app_id);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+ return;
+ }
+ auto peer_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(peer_app_id, std::free);
+
+ char* peer_uuid = nullptr;
+ ret = cion_peer_info_get_uuid(peer_info, &peer_uuid);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+ return;
+ }
+ auto peer_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(peer_uuid, std::free);
for (auto& s : stub->services_) {
- char *service_app_id, *service_uuid;
- cion_peer_info_get_app_id(s->GetPeer(), &service_app_id);
- cion_peer_info_get_app_id(s->GetPeer(), &service_uuid);
+ char* service_app_id = nullptr;
+ ret = cion_peer_info_get_app_id(s->GetPeer(), &service_app_id);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+ return;
+ }
+ auto service_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(service_app_id, std::free);
+
+ char* service_uuid = nullptr;
+ ret = cion_peer_info_get_uuid(s->GetPeer(), &service_uuid);
+ if (ret != CION_ERROR_NONE) {
+ _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+ return;
+ }
+ auto service_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(service_uuid, std::free);
+
if (strcmp(peer_app_id, service_app_id) == 0 &&
strcmp(peer_uuid, service_uuid) == 0) {
b = s;
return;
}
- int ret = rpc_port_parcel_create_from_raw(&p, data, data_size);
+ ret = rpc_port_parcel_create_from_raw(&p, data, data_size);
if (ret != 0) {
_E("Failed to create parcel from port");
return;