private:
std::string sender_;
std::string instance_;
- rpc_port_h port_;
+ rpc_port_h port_ = nullptr;
std::unique_ptr<ActiveObject> active_object_;
};)__cpp_cb";
_E("Failed to create security handle. error(%d)", ret);
throw InvalidIOException();
}
+ auto security_auto = std::unique_ptr<
+ std::remove_pointer<cion_security_h>::type, decltype(cion_security_destroy)*>(
+ security, cion_security_destroy);
- ret = cion_client_create(&cion_client_, service_name.c_str(), security);
+ cion_client_h client = nullptr;
+ ret = cion_client_create(&client, service_name.c_str(), security);
if (ret != CION_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret);
throw InvalidIOException();
}
+ auto client_auto = std::unique_ptr<
+ std::remove_pointer<cion_client_h>::type, decltype(cion_client_destroy)*>(
+ client, cion_client_destroy);
- ret = cion_client_add_disconnected_cb(cion_client_, OnDisconnectedCB,
+ ret = cion_client_add_disconnected_cb(client, OnDisconnectedCB,
this);
if (ret != CION_ERROR_NONE) {
_E("Failed to cion_client_add_disconnected_cb. error(%d)", ret);
}
- ret = cion_client_add_connection_result_cb(cion_client_, OnConnectionResultCB,
+ ret = cion_client_add_connection_result_cb(client, OnConnectionResultCB,
this);
if (ret != CION_ERROR_NONE) {
_E("Failed to cion_client_add_connection_result_cb. error(%d)", ret);
throw InvalidIOException();
}
- ret = cion_client_add_payload_received_cb(cion_client_, OnPayloadReceivedCB,
+ ret = cion_client_add_payload_received_cb(client, OnPayloadReceivedCB,
this);
if (ret != CION_ERROR_NONE) {
_E("Failed to cion_client_add_payload_received_cb. error(%d)", ret);
throw InvalidIOException();
}
+
+ cion_security_ = security_auto.release();
+ cion_client_ = client_auto.release();
}
)__cpp_cb";
cion_payload_transfer_status_e status,
void *user_data);
- cion_client_h cion_client_;
- cion_peer_info_h peer_;
+ cion_client_h cion_client_ = nullptr;
+ cion_security_h cion_security_ = nullptr;
+ cion_peer_info_h peer_ = nullptr;
IEventListener* listener_;
std::string service_name_;
std::string target_appid_;
void JavaCionGeneratorBase::GenListSerializer(std::ofstream& stream,
const BaseType& type) {
+ auto* ptr = type.GetMetaType();
+ if (ptr == nullptr)
+ return;
+
+ auto& mt = *ptr;
stream << Tab(1) << "private static void serialize(CionParcel h, "
<< ConvertTypeToString(type) << " param, "
- << ConvertTypeToString(*(type.GetMetaType()), true) << " a) ";
+ << ConvertTypeToString(mt, true) << " a) ";
GenBrace(stream, TAB_SIZE, [&]() {
stream << Tab(2)
<< "h.write(param.size());"
<< NLine(1);
- stream << Tab(2) << "for (" << ConvertTypeToString(*(type.GetMetaType()), true)
+ stream << Tab(2) << "for (" << ConvertTypeToString(mt, true)
<< " i : param) ";
GenBrace(stream, TAB_SIZE * 2, [&]() {
- auto* ptr = type.GetMetaType();
- if (ptr == nullptr) return;
-
- auto& mt = *ptr;
if (!mt.IsUserDefinedType() && mt.GetMetaType() == nullptr) {
stream << Tab(3) << "h.write(i);" << NLine(1);
} else {
stream << Tab(1) << "private static void deserialize(CionParcel h, "
<< ConvertTypeToString(type) << " param, "
- << ConvertTypeToString(*(type.GetMetaType()), true) << " a) ";
+ << ConvertTypeToString(mt, true) << " a) ";
GenBrace(stream, TAB_SIZE, [&]() {
stream << Tab(2)
<< "int l = h.readInt();"
<< NLine(1);
stream << Tab(2) << "for (int i = 0; i < l; i++) ";
GenBrace(stream, TAB_SIZE * 2, [&]() {
- auto* ptr = type.GetMetaType();
- if (ptr == nullptr)
- return;
-
- auto& mt = *ptr;
- if (!mt.IsUserDefinedType() && mt.GetMetaType() == nullptr) {
- stream << Tab(3) << ConvertTypeToString(*(type.GetMetaType()), true)
+ if (!mt.IsUserDefinedType() && mt.GetMetaType() == nullptr) {
+ stream << Tab(3) << ConvertTypeToString(mt, true)
<< " v = h.read"
<< ConvertTypeToParcelType(mt.ToString())
<< "();" << NLine(1);
} else {
- stream << Tab(3) << ConvertTypeToString(*(type.GetMetaType()), true)
+ stream << Tab(3) << ConvertTypeToString(mt, true)
<< " v = new " << ConvertTypeToString(mt)
<< "();" << NLine(1);
if (mt.GetMetaType() != nullptr) {