mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-29 09:09:21 +00:00
fix(core): add explicit on some constructors
This commit is contained in:
parent
f492097cfd
commit
fa861d553d
10 changed files with 49 additions and 44 deletions
|
|
@ -55,7 +55,7 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
// TODO: This macro should be used but it is triggering a bug in doxygen that
|
||||
// has been fixed in the 1.8.8 version. See https://bugzilla.gnome.org/show_bug.cgi?id=731985
|
||||
// Meanwhile use 2 different macros
|
||||
// Meanwhile use 2 different macros.
|
||||
#if 0
|
||||
#define L_DECLARE_C_ENUM(NAME, VALUES) \
|
||||
typedef enum L_CONCAT(_, L_CONCAT(L_C_ENUM_PREFIX, NAME)) { \
|
||||
|
|
|
|||
|
|
@ -39,6 +39,26 @@ Address::Address (const string &address) : ClonableObject(*new AddressPrivate) {
|
|||
}
|
||||
}
|
||||
|
||||
Address::Address (const IdentityAddress &identityAddress) : ClonableObject(*new AddressPrivate) {
|
||||
L_D();
|
||||
|
||||
const string &username = identityAddress.getUsername();
|
||||
if (username.empty())
|
||||
return;
|
||||
const string &domain = identityAddress.getDomain();
|
||||
if (domain.empty())
|
||||
return;
|
||||
|
||||
string uri = identityAddress.getScheme() + ":" + username + "@" + (
|
||||
domain.find(':') != string::npos ? "[" + domain + "]" : domain
|
||||
);
|
||||
|
||||
if (identityAddress.hasGruu())
|
||||
uri += ";gr=" + identityAddress.getGruu();
|
||||
|
||||
d->internalAddress = sal_address_new(L_STRING_TO_C(uri));
|
||||
}
|
||||
|
||||
Address::Address (const Address &src) : ClonableObject(*new AddressPrivate) {
|
||||
L_D();
|
||||
SalAddress *salAddress = src.getPrivate()->internalAddress;
|
||||
|
|
@ -46,26 +66,6 @@ Address::Address (const Address &src) : ClonableObject(*new AddressPrivate) {
|
|||
d->internalAddress = sal_address_clone(salAddress);
|
||||
}
|
||||
|
||||
Address::Address (const IdentityAddress &src) : ClonableObject(*new AddressPrivate) {
|
||||
L_D();
|
||||
|
||||
const string &username = src.getUsername();
|
||||
if (username.empty())
|
||||
return;
|
||||
const string &domain = src.getDomain();
|
||||
if (domain.empty())
|
||||
return;
|
||||
|
||||
string uri = src.getScheme() + ":" + username + "@" + (
|
||||
domain.find(':') != string::npos ? "[" + domain + "]" : domain
|
||||
);
|
||||
|
||||
if (src.hasGruu())
|
||||
uri += ";gr=" + src.getGruu();
|
||||
|
||||
d->internalAddress = sal_address_new(L_STRING_TO_C(uri));
|
||||
}
|
||||
|
||||
Address::~Address () {
|
||||
L_D();
|
||||
if (d->internalAddress)
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ class LINPHONE_PUBLIC Address : public ClonableObject {
|
|||
|
||||
public:
|
||||
explicit Address (const std::string &address = "");
|
||||
Address (const IdentityAddress &identityAddress);
|
||||
Address (const Address &src);
|
||||
Address (const IdentityAddress &src);
|
||||
~Address ();
|
||||
|
||||
Address &operator= (const Address &src);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,15 @@ IdentityAddress::IdentityAddress (const string &address) : ClonableObject(*new I
|
|||
}
|
||||
}
|
||||
|
||||
IdentityAddress::IdentityAddress (const Address &address) : ClonableObject(*new IdentityAddressPrivate) {
|
||||
L_D();
|
||||
d->scheme = address.getScheme();
|
||||
d->username = address.getUsername();
|
||||
d->domain = address.getDomain();
|
||||
if (address.hasUriParam("gr"))
|
||||
d->gruu = address.getUriParamValue("gr");
|
||||
}
|
||||
|
||||
IdentityAddress::IdentityAddress (const IdentityAddress &src) : ClonableObject(*new IdentityAddressPrivate) {
|
||||
L_D();
|
||||
d->scheme = src.getScheme();
|
||||
|
|
@ -50,14 +59,6 @@ IdentityAddress::IdentityAddress (const IdentityAddress &src) : ClonableObject(*
|
|||
d->gruu = src.getGruu();
|
||||
}
|
||||
|
||||
IdentityAddress::IdentityAddress (const Address &src) : ClonableObject(*new IdentityAddressPrivate) {
|
||||
L_D();
|
||||
d->scheme = src.getScheme();
|
||||
d->username = src.getUsername();
|
||||
d->domain = src.getDomain();
|
||||
d->gruu = src.getUriParamValue("gr");
|
||||
}
|
||||
|
||||
IdentityAddress &IdentityAddress::operator= (const IdentityAddress &src) {
|
||||
L_D();
|
||||
if (this != &src) {
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ class IdentityAddressPrivate;
|
|||
class LINPHONE_PUBLIC IdentityAddress : public ClonableObject {
|
||||
public:
|
||||
explicit IdentityAddress (const std::string &address = "");
|
||||
IdentityAddress (const Address &address);
|
||||
IdentityAddress (const IdentityAddress &src);
|
||||
IdentityAddress (const Address &src);
|
||||
~IdentityAddress () = default;
|
||||
|
||||
IdentityAddress &operator= (const IdentityAddress &src);
|
||||
|
|
|
|||
|
|
@ -230,7 +230,9 @@ LinphoneChatRoomState linphone_chat_room_get_state (const LinphoneChatRoom *cr)
|
|||
}
|
||||
|
||||
void linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr) {
|
||||
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->addParticipant(*L_GET_CPP_PTR_FROM_C_OBJECT(addr), nullptr, false);
|
||||
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->addParticipant(
|
||||
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(addr)), nullptr, false
|
||||
);
|
||||
}
|
||||
|
||||
void linphone_chat_room_add_participants (LinphoneChatRoom *cr, const bctbx_list_t *addresses) {
|
||||
|
|
@ -246,14 +248,16 @@ bool_t linphone_chat_room_can_handle_participants (const LinphoneChatRoom *cr) {
|
|||
}
|
||||
|
||||
LinphoneParticipant *linphone_chat_room_find_participant (const LinphoneChatRoom *cr, const LinphoneAddress *addr) {
|
||||
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->findParticipant(*L_GET_CPP_PTR_FROM_C_OBJECT(addr)));
|
||||
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->findParticipant(
|
||||
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(addr))
|
||||
));
|
||||
}
|
||||
|
||||
const LinphoneAddress *linphone_chat_room_get_conference_address (const LinphoneChatRoom *cr) {
|
||||
if (cr->conferenceAddressCache)
|
||||
linphone_address_unref(cr->conferenceAddressCache);
|
||||
|
||||
const LinphonePrivate::Address &address = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getConferenceAddress();
|
||||
const LinphonePrivate::IdentityAddress &address = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getConferenceAddress();
|
||||
if (address.isValid())
|
||||
cr->conferenceAddressCache = linphone_address_new(address.asString().c_str());
|
||||
else
|
||||
|
|
@ -356,7 +360,7 @@ LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, cons
|
|||
from = L_GET_CPP_PTR_FROM_C_OBJECT(linphone_proxy_config_get_identity_address(proxy))->asString();
|
||||
if (from.empty())
|
||||
from = linphone_core_get_primary_contact(core);
|
||||
LinphonePrivate::Address me(from);
|
||||
LinphonePrivate::IdentityAddress me(from);
|
||||
LinphoneChatRoom *cr = L_INIT(ChatRoom);
|
||||
L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared<LinphonePrivate::ClientGroupChatRoom>(
|
||||
core->cppCore, L_C_TO_STRING(uri), me, L_C_TO_STRING(subject))
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void linphone_participant_set_user_data(LinphoneParticipant *participant, void *
|
|||
}
|
||||
|
||||
const LinphoneAddress *linphone_participant_get_address (const LinphoneParticipant *participant) {
|
||||
LinphonePrivate::Address addr = L_GET_CPP_PTR_FROM_C_OBJECT(participant)->getAddress();
|
||||
LinphonePrivate::Address addr(L_GET_CPP_PTR_FROM_C_OBJECT(participant)->getAddress());
|
||||
if (participant->addressCache)
|
||||
linphone_address_unref(participant->addressCache);
|
||||
participant->addressCache = linphone_address_new(addr.asString().c_str());
|
||||
|
|
|
|||
|
|
@ -49,14 +49,14 @@ Content::Content (Content &&src) : ClonableObject(*new ContentPrivate), AppDataC
|
|||
d->contentDisposition = move(src.getPrivate()->contentDisposition);
|
||||
}
|
||||
|
||||
Content::Content (ContentPrivate &p) : ClonableObject(p) {
|
||||
|
||||
}
|
||||
Content::Content (ContentPrivate &p) : ClonableObject(p) {}
|
||||
|
||||
Content::~Content () {
|
||||
L_D();
|
||||
/* Fills the body with zeros before releasing since it may contain
|
||||
private data like cipher keys or decoded messages. */
|
||||
/*
|
||||
* Fills the body with zeros before releasing since it may contain
|
||||
* private data like cipher keys or decoded messages.
|
||||
*/
|
||||
d->body.assign(d->body.size(), 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ shared_ptr<Core> Core::create (LinphoneCore *cCore) {
|
|||
// Do not use `make_shared` => Private constructor.
|
||||
shared_ptr<Core> core = shared_ptr<Core>(new Core);
|
||||
|
||||
CorePrivate * const d = core->getPrivate();
|
||||
CorePrivate *const d = core->getPrivate();
|
||||
|
||||
d->cCore = cCore;
|
||||
d->mainDb.reset(new MainDb(core->getSharedFromThis()));
|
||||
|
|
|
|||
|
|
@ -50,14 +50,14 @@ public:
|
|||
virtual std::string getConfigPath () = 0;
|
||||
|
||||
protected:
|
||||
inline PlatformHelpers (LinphoneCore *lc) : mCore(lc) {}
|
||||
inline explicit PlatformHelpers (LinphoneCore *lc) : mCore(lc) {}
|
||||
|
||||
LinphoneCore *mCore;
|
||||
};
|
||||
|
||||
class StubbedPlatformHelpers : public PlatformHelpers {
|
||||
public:
|
||||
StubbedPlatformHelpers (LinphoneCore *lc);
|
||||
explicit StubbedPlatformHelpers (LinphoneCore *lc);
|
||||
virtual ~StubbedPlatformHelpers () = default;
|
||||
|
||||
void setDnsServers () override;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue