Commit 1431e151 authored by Ronan's avatar Ronan

feat(c-wrapper): remove CPP_TYPE parameter of L_GET_PRIVATE_FROM_C_OBJECT

parent 78646be7
......@@ -169,7 +169,7 @@ static void call_received(SalOp *h) {
LinphoneCall *call = linphone_call_new_incoming(lc, fromAddr, toAddr, h);
linphone_address_unref(fromAddr);
linphone_address_unref(toAddr);
L_GET_PRIVATE_FROM_C_OBJECT(call, Call)->startIncomingNotification();
L_GET_PRIVATE_FROM_C_OBJECT(call)->startIncomingNotification();
}
static void call_rejected(SalOp *h){
......
......@@ -225,7 +225,7 @@ int linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage
LinphoneAddress *addr = linphone_address_new(sal_msg->from);
linphone_address_clean(addr);
LinphoneChatRoom *cr = linphone_core_get_chat_room(lc, addr);
LinphoneReason reason = L_GET_PRIVATE_FROM_C_OBJECT(cr, ChatRoom)->messageReceived(op, sal_msg);
LinphoneReason reason = L_GET_PRIVATE_FROM_C_OBJECT(cr)->messageReceived(op, sal_msg);
linphone_address_unref(addr);
return reason;
}
......
......@@ -3205,7 +3205,7 @@ void linphone_core_iterate(LinphoneCore *lc){
/* Get immediately a reference to next one in case the one we are going to examine is destroyed
* and removed during linphone_call_start_invite() */
calls = bctbx_list_next(calls);
L_GET_PRIVATE_FROM_C_OBJECT(call, Call)->iterate(current_real_time, one_second_elapsed);
L_GET_PRIVATE_FROM_C_OBJECT(call)->iterate(current_real_time, one_second_elapsed);
}
if (linphone_core_video_preview_enabled(lc)){
......@@ -3341,7 +3341,7 @@ static bctbx_list_t *make_routes_for_proxy(LinphoneProxyConfig *proxy, const Lin
ret=bctbx_list_append(ret,sal_address_new(local_route));
}
if (srv_route){
ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_OBJECT(srv_route, Address)->getInternalAddress()));
ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_OBJECT(srv_route)->getInternalAddress()));
}
if (ret==NULL){
/*if the proxy address matches the domain part of the destination, then use the same transport
......@@ -3530,9 +3530,9 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
if (linphone_call_params_get_local_conference_mode(params) == FALSE)
#endif
lc->current_call=call;
bool defer = L_GET_PRIVATE_FROM_C_OBJECT(call, Call)->initiateOutgoing();
bool defer = L_GET_PRIVATE_FROM_C_OBJECT(call)->initiateOutgoing();
if (!defer) {
if (L_GET_PRIVATE_FROM_C_OBJECT(call, Call)->startInvite(nullptr) != 0) {
if (L_GET_PRIVATE_FROM_C_OBJECT(call)->startInvite(nullptr) != 0) {
/* The call has already gone to error and released state, so do not return it */
call = nullptr;
}
......
......@@ -492,7 +492,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
linphone_configure_op(cfg->lc, cfg->op, cfg->identity_address, cfg->sent_headers, FALSE);
if ((contact=guess_contact_for_register(cfg))) {
sal_op_set_contact_address(cfg->op, L_GET_PRIVATE_FROM_C_OBJECT(contact, Address)->getInternalAddress());
sal_op_set_contact_address(cfg->op, L_GET_PRIVATE_FROM_C_OBJECT(contact)->getInternalAddress());
linphone_address_unref(contact);
}
......@@ -503,7 +503,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
proxy_string,
cfg->reg_identity,
cfg->expires,
cfg->pending_contact ? L_GET_PRIVATE_FROM_C_OBJECT(cfg->pending_contact, Address)->getInternalAddress() : NULL
cfg->pending_contact ? L_GET_PRIVATE_FROM_C_OBJECT(cfg->pending_contact)->getInternalAddress() : NULL
)==0) {
if (cfg->pending_contact) {
linphone_address_unref(cfg->pending_contact);
......@@ -1364,7 +1364,7 @@ const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg)
bool_t destroy_route_addr = FALSE;
if (linphone_proxy_config_get_service_route(cfg)) {
route_addr = L_GET_PRIVATE_FROM_C_OBJECT(linphone_proxy_config_get_service_route(cfg), Address)->getInternalAddress();
route_addr = L_GET_PRIVATE_FROM_C_OBJECT(linphone_proxy_config_get_service_route(cfg))->getInternalAddress();
} else if (linphone_proxy_config_get_route(cfg)) {
addr=linphone_proxy_config_get_route(cfg);
} else if(linphone_proxy_config_get_addr(cfg)) {
......
......@@ -380,7 +380,7 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
* (port, transport, maddr), then it is sent directly.
* Otherwise it is routed as any LinphoneEvent publish, following proxy config policy.
**/
salAddress = L_GET_PRIVATE_FROM_C_OBJECT(request_uri, Address)->getInternalAddress();
salAddress = L_GET_PRIVATE_FROM_C_OBJECT(request_uri)->getInternalAddress();
if (sal_address_has_uri_param(salAddress, "transport") ||
sal_address_has_uri_param(salAddress, "maddr") ||
linphone_address_get_port(request_uri) != 0) {
......
......@@ -23,7 +23,7 @@
// =============================================================================
#define GET_MEDIA_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_OBJECT(obj)
#define GET_MEDIA_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj, MediaSessionParams)
#define GET_MEDIA_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj)
L_DECLARE_C_CLONABLE_STRUCT_IMPL(CallParams)
......
......@@ -29,7 +29,7 @@
// =============================================================================
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_OBJECT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj, Call)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj)
using namespace std;
......
......@@ -31,7 +31,7 @@
// =============================================================================
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_OBJECT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj, ChatMessage, ChatMessage)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj)
using namespace std;
......@@ -309,7 +309,7 @@ void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMe
linphone_chat_message_store_state(msg);
if (msg->state == LinphoneChatMessageStateDelivered || msg->state == LinphoneChatMessageStateNotDelivered) {
L_GET_PRIVATE_FROM_C_OBJECT(msg->chat_room, ChatRoom)->moveTransientMessageToWeakMessages(msg);
L_GET_PRIVATE_FROM_C_OBJECT(msg->chat_room)->moveTransientMessageToWeakMessages(msg);
}
}
......@@ -440,7 +440,7 @@ static char *linphone_chat_message_create_imdn_xml(LinphoneChatMessage *cm, Imdn
void linphone_chat_message_send_imdn(LinphoneChatMessage *cm, ImdnType imdn_type, LinphoneReason reason) {
char *content = linphone_chat_message_create_imdn_xml(cm, imdn_type, reason);
if (content) {
L_GET_PRIVATE_FROM_C_OBJECT(linphone_chat_message_get_chat_room(cm), ChatRoom)->sendImdn(content, reason);
L_GET_PRIVATE_FROM_C_OBJECT(linphone_chat_message_get_chat_room(cm))->sendImdn(content, reason);
ms_free(content);
}
}
......
......@@ -30,7 +30,7 @@
// =============================================================================
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_OBJECT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj, ChatRoom)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_OBJECT(obj)
using namespace std;
......@@ -276,8 +276,8 @@ LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddr
else
L_SET_CPP_PTR_FROM_C_OBJECT(cr, std::make_shared<LinphonePrivate::BasicChatRoom>(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr)));
linphone_core_notify_chat_room_instantiated(core, cr);
L_GET_PRIVATE_FROM_C_OBJECT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
L_GET_PRIVATE_FROM_C_OBJECT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Created);
L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Created);
return cr;
}
......@@ -298,8 +298,8 @@ LinphoneChatRoom *linphone_client_group_chat_room_new (LinphoneCore *core, const
LinphoneChatRoom *cr = _linphone_ChatRoom_init();
L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared<LinphonePrivate::ClientGroupChatRoom>(core, me, l));
linphone_core_notify_chat_room_instantiated(core, cr);
L_GET_PRIVATE_FROM_C_OBJECT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
L_GET_PRIVATE_FROM_C_OBJECT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::CreationPending);
L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::CreationPending);
return cr;
}
......
......@@ -395,24 +395,24 @@ LINPHONE_END_NAMESPACE
#define L_INIT(C_TYPE) _linphone_ ## C_TYPE ## _init ()
// Get the cpp-ptr of a wrapped C object.
#define L_GET_CPP_PTR_FROM_C_OBJECT(OBJECT) \
#define L_GET_CPP_PTR_FROM_C_OBJECT(C_OBJECT) \
LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC< \
L_CPP_TYPE_OF_C_OBJECT(OBJECT), \
std::remove_pointer<decltype(OBJECT)>::type \
>(OBJECT)
L_CPP_TYPE_OF_C_OBJECT(C_OBJECT), \
std::remove_pointer<decltype(C_OBJECT)>::type \
>(C_OBJECT)
// Set the cpp-ptr of a wrapped C object.
#define L_SET_CPP_PTR_FROM_C_OBJECT(OBJECT, CPP_PTR) \
LINPHONE_NAMESPACE::Wrapper::setCppPtrFromC(OBJECT, CPP_PTR)
#define L_SET_CPP_PTR_FROM_C_OBJECT(C_OBJECT, CPP_PTR) \
LINPHONE_NAMESPACE::Wrapper::setCppPtrFromC(C_OBJECT, CPP_PTR)
// Get the private data of a shared or simple cpp-ptr.
#define L_GET_PRIVATE(OBJECT) \
LINPHONE_NAMESPACE::Wrapper::getPrivate(OBJECT)
#define L_GET_PRIVATE(CPP_OBJECT) \
LINPHONE_NAMESPACE::Wrapper::getPrivate(CPP_OBJECT)
// Get the private data of a shared or simple cpp-ptr of a wrapped C object.
#define L_GET_PRIVATE_FROM_C_OBJECT(OBJECT, CPP_TYPE) \
#define L_GET_PRIVATE_FROM_C_OBJECT(C_OBJECT) \
L_GET_PRIVATE(LINPHONE_NAMESPACE::Wrapper::getCppPtr( \
L_GET_CPP_PTR_FROM_C_OBJECT(OBJECT) \
L_GET_CPP_PTR_FROM_C_OBJECT(C_OBJECT) \
))
// Get the wrapped C object of a C++ object.
......
......@@ -454,7 +454,7 @@ LinphoneStatus CallSessionPrivate::checkForAcceptation () const {
bctbx_list_t *copy = bctbx_list_copy(linphone_core_get_calls(core));
for (bctbx_list_t *it = copy; it != nullptr; it = bctbx_list_next(it)) {
LinphoneCall *call = reinterpret_cast<LinphoneCall *>(bctbx_list_get_data(it));
shared_ptr<CallSession> session = L_GET_PRIVATE_FROM_C_OBJECT(call, Call)->getActiveSession();
shared_ptr<CallSession> session = L_GET_PRIVATE_FROM_C_OBJECT(call)->getActiveSession();
if (session.get() == q) continue;
switch (session->getState()) {
case LinphoneCallOutgoingInit:
......@@ -616,7 +616,7 @@ void CallSessionPrivate::setContactOp () {
SalAddress *salAddress = nullptr;
LinphoneAddress *contact = getFixedContact();
if (contact) {
salAddress = const_cast<SalAddress *>(L_GET_PRIVATE_FROM_C_OBJECT(contact, Address)->getInternalAddress());
salAddress = const_cast<SalAddress *>(L_GET_PRIVATE_FROM_C_OBJECT(contact)->getInternalAddress());
sal_address_ref(salAddress);
linphone_address_unref(contact);
}
......
......@@ -913,7 +913,7 @@ int MediaSessionPrivate::selectFixedPort (int streamIndex, pair<int, int> portRa
bool alreadyUsed = false;
for (const bctbx_list_t *elem = linphone_core_get_calls(core); elem != nullptr; elem = bctbx_list_next(elem)) {
LinphoneCall *lcall = reinterpret_cast<LinphoneCall *>(bctbx_list_get_data(elem));
MediaSession *session = dynamic_cast<MediaSession *>(L_GET_PRIVATE_FROM_C_OBJECT(lcall, Call)->getConference()->getActiveParticipant()->getPrivate()->getSession().get());
MediaSession *session = dynamic_cast<MediaSession *>(L_GET_PRIVATE_FROM_C_OBJECT(lcall)->getConference()->getActiveParticipant()->getPrivate()->getSession().get());
int existingPort = session->getPrivate()->mediaPorts[streamIndex].rtpPort;
if (existingPort == triedPort) {
alreadyUsed = true;
......@@ -935,7 +935,7 @@ int MediaSessionPrivate::selectRandomPort (int streamIndex, pair<int, int> portR
if (triedPort < portRange.first) triedPort = portRange.first + 2;
for (const bctbx_list_t *elem = linphone_core_get_calls(core); elem != nullptr; elem = bctbx_list_next(elem)) {
LinphoneCall *lcall = reinterpret_cast<LinphoneCall *>(bctbx_list_get_data(elem));
MediaSession *session = dynamic_cast<MediaSession *>(L_GET_PRIVATE_FROM_C_OBJECT(lcall, Call)->getConference()->getActiveParticipant()->getPrivate()->getSession().get());
MediaSession *session = dynamic_cast<MediaSession *>(L_GET_PRIVATE_FROM_C_OBJECT(lcall)->getConference()->getActiveParticipant()->getPrivate()->getSession().get());
int existingPort = session->getPrivate()->mediaPorts[streamIndex].rtpPort;
if (existingPort == triedPort) {
alreadyUsed = true;
......@@ -1107,7 +1107,7 @@ void MediaSessionPrivate::selectOutgoingIpVersion () {
}
const LinphoneAddress *to = linphone_call_log_get_to_address(log);
if (sal_address_is_ipv6(L_GET_PRIVATE_FROM_C_OBJECT(to, Address)->getInternalAddress()))
if (sal_address_is_ipv6(L_GET_PRIVATE_FROM_C_OBJECT(to)->getInternalAddress()))
af = AF_INET6;
else if (destProxy && destProxy->op)
af = sal_op_get_address_family(destProxy->op);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment