From 6a3956494c4f8cf0cd50dfcdbeae9c1de7fbf81e Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 26 Sep 2017 13:46:01 +0200 Subject: [PATCH] fix(core): coding style --- coreapi/chat.c | 8 +- daemon/commands/call-transfer.cc | 6 +- daemon/commands/conference.cc | 4 +- daemon/commands/register-info.cc | 32 ++++---- daemon/commands/video.cc | 4 +- daemon/daemon.cc | 22 +++--- src/c-wrapper/api/c-call.cpp | 8 +- src/c-wrapper/api/c-chat-message.cpp | 4 +- src/c-wrapper/api/c-chat-room.cpp | 6 +- src/call/call-listener.h | 2 +- src/call/call-p.h | 32 +++++--- src/call/call.cpp | 98 ++++++++++++++---------- src/call/call.h | 2 +- src/chat/chat-message.cpp | 8 +- src/chat/client-group-chat-room.cpp | 2 +- src/chat/is-composing.cpp | 4 +- src/conference/conference.cpp | 2 +- src/conference/conference.h | 6 +- src/conference/participant-p.h | 2 +- src/conference/remote-conference.h | 2 +- src/conference/session/call-session.cpp | 2 +- src/conference/session/media-session.cpp | 4 +- src/content/content-type.cpp | 4 +- src/content/content.cpp | 6 +- src/object/property-container.cpp | 2 +- 25 files changed, 152 insertions(+), 120 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index b033d8f34..7059cb04b 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -42,6 +42,8 @@ #include "chat/real-time-text-chat-room-p.h" #include "content/content-type.h" +using namespace std; + void linphone_core_disable_chat(LinphoneCore *lc, LinphoneReason deny_reason) { lc->chat_deny_code = deny_reason; } @@ -236,9 +238,9 @@ int linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, uint32_t character, LinphoneCall *call) { if (linphone_core_realtime_text_enabled(lc)) { - std::shared_ptr rttcr = - std::static_pointer_cast(L_GET_CPP_PTR_FROM_C_OBJECT(cr)); + shared_ptr rttcr = + static_pointer_cast(L_GET_CPP_PTR_FROM_C_OBJECT(cr)); L_GET_PRIVATE(rttcr)->realtimeTextReceived(character, call); - //L_GET_PRIVATE(std::static_pointer_cast(L_GET_CPP_PTR_FROM_C_OBJECT(cr)))->realtimeTextReceived(character, call); + //L_GET_PRIVATE(static_pointer_cast(L_GET_CPP_PTR_FROM_C_OBJECT(cr)))->realtimeTextReceived(character, call); } } diff --git a/daemon/commands/call-transfer.cc b/daemon/commands/call-transfer.cc index fbb41042a..e7d3f9e24 100644 --- a/daemon/commands/call-transfer.cc +++ b/daemon/commands/call-transfer.cc @@ -1,6 +1,6 @@ /* call-transfer.cc -Copyright (C) 2016 Belledonne Communications, Grenoble, France +Copyright (C) 2016 Belledonne Communications, Grenoble, France This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -85,7 +85,7 @@ void CallTransferCommand::exec(Daemon* app, const string& args) return; } if (linphone_call_transfer_to_another(call_to_transfer, call_to_transfer_to) == 0) { - std::ostringstream ostr; + ostringstream ostr; ostr << "Call ID: " << call_to_transfer_id << "\n"; ostr << "Transfer to: " << call_to_transfer_to_id << "\n"; app->sendResponse(Response(ostr.str(), Response::Ok)); @@ -93,7 +93,7 @@ void CallTransferCommand::exec(Daemon* app, const string& args) } } else { if (linphone_call_transfer(call_to_transfer, sip_uri_to_transfer_to.c_str()) == 0) { - std::ostringstream ostr; + ostringstream ostr; ostr << "Call ID: " << call_to_transfer_id << "\n"; ostr << "Transfer to: " << sip_uri_to_transfer_to << "\n"; app->sendResponse(Response(ostr.str(), Response::Ok)); diff --git a/daemon/commands/conference.cc b/daemon/commands/conference.cc index a4929f72c..6d1c83c93 100644 --- a/daemon/commands/conference.cc +++ b/daemon/commands/conference.cc @@ -1,6 +1,6 @@ /* conference.cc -Copyright (C) 2016 Belledonne Communications, Grenoble, France +Copyright (C) 2016 Belledonne Communications, Grenoble, France This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -79,7 +79,7 @@ void ConferenceCommand::exec(Daemon* app, const string& args) { } if (ret == 0) { - std::ostringstream ostr; + ostringstream ostr; ostr << "Call ID: " << id << "\n"; ostr << "Conference: " << subcommand << " OK" << "\n"; app->sendResponse(Response(ostr.str(), Response::Ok)); diff --git a/daemon/commands/register-info.cc b/daemon/commands/register-info.cc index 681d894e3..5b39259e5 100644 --- a/daemon/commands/register-info.cc +++ b/daemon/commands/register-info.cc @@ -1,6 +1,6 @@ /* register-info.cc -Copyright (C) 2016 Belledonne Communications, Grenoble, France +Copyright (C) 2016 Belledonne Communications, Grenoble, France This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -21,6 +21,8 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include #include "register-info.h" +using namespace std; + class RegisterInfoResponse: public Response { public: RegisterInfoResponse(): Response() {} @@ -28,19 +30,19 @@ public: append(id, cfg); } void append(int id, const ::LinphoneProxyConfig *cfg) { - std::ostringstream ost; + ostringstream ost; ost << getBody(); - if (ost.tellp() > 0) ost << std::endl; - ost << "Id: " << id << std::endl; - ost << "Identity: " << linphone_proxy_config_get_identity(cfg) << std::endl; - ost << "Proxy: " << linphone_proxy_config_get_server_addr(cfg) << std::endl; - + if (ost.tellp() > 0) ost << endl; + ost << "Id: " << id << endl; + ost << "Identity: " << linphone_proxy_config_get_identity(cfg) << endl; + ost << "Proxy: " << linphone_proxy_config_get_server_addr(cfg) << endl; + const char *route = linphone_proxy_config_get_route(cfg); if (route != NULL) { - ost << "Route: " << route << std::endl; + ost << "Route: " << route << endl; } - - ost << "State: " << linphone_registration_state_to_string(linphone_proxy_config_get_state(cfg)) << std::endl; + + ost << "State: " << linphone_registration_state_to_string(linphone_proxy_config_get_state(cfg)) << endl; setBody(ost.str()); } }; @@ -72,9 +74,9 @@ RegisterInfoCommand::RegisterInfoCommand(): "Reason: No register with such id.")); } -void RegisterInfoCommand::exec(Daemon *app, const std::string& args) { - std::string param; - std::istringstream ist(args); +void RegisterInfoCommand::exec(Daemon *app, const string& args) { + string param; + istringstream ist(args); ist >> param; if (ist.fail()) { app->sendResponse(Response("Missing parameter.", Response::Error)); @@ -93,10 +95,10 @@ void RegisterInfoCommand::exec(Daemon *app, const std::string& args) { int id; try { id = atoi(param.c_str()); - } catch (std::invalid_argument) { + } catch (invalid_argument) { app->sendResponse(Response("Invalid ID.", Response::Error)); return; - } catch (std::out_of_range) { + } catch (out_of_range) { app->sendResponse(Response("Out of range ID.", Response::Error)); return; } diff --git a/daemon/commands/video.cc b/daemon/commands/video.cc index 2b92a8db8..99679f7a4 100644 --- a/daemon/commands/video.cc +++ b/daemon/commands/video.cc @@ -1,6 +1,6 @@ /* video.cc -Copyright (C) 2016 Belledonne Communications, Grenoble, France +Copyright (C) 2016 Belledonne Communications, Grenoble, France This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -162,7 +162,7 @@ AutoVideo::AutoVideo(): "Auto video OFF")); } -void AutoVideo::exec(Daemon* app, const std::string& args) +void AutoVideo::exec(Daemon* app, const string& args) { bool enable = (args.compare("on") == 0); diff --git a/daemon/daemon.cc b/daemon/daemon.cc index af2474cb8..d97650863 100644 --- a/daemon/daemon.cc +++ b/daemon/daemon.cc @@ -1,6 +1,6 @@ /* daemon.cc -Copyright (C) 2016 Belledonne Communications, Grenoble, France +Copyright (C) 2016 Belledonne Communications, Grenoble, France This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -331,11 +331,11 @@ Daemon::Daemon(const char *config_path, const char *factory_config_path, const c linphone_core_set_user_data(mLc, this); linphone_core_enable_video_capture(mLc,capture_video); linphone_core_enable_video_display(mLc,display_video); - + for(const bctbx_list_t *proxy = linphone_core_get_proxy_config_list(mLc); proxy != NULL; proxy = bctbx_list_next(proxy)) { updateProxyId((LinphoneProxyConfig *)bctbx_list_get_data(proxy)); } - + initCommands(); mUseStatsEvents=true; } @@ -403,7 +403,7 @@ LinphoneAuthInfo *Daemon::findAuthInfo(int id) { } int Daemon::updateAudioStreamId(AudioStream *audio_stream) { - for (std::map::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) { + for (map::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) { if (it->second->stream == audio_stream) return it->first; } @@ -414,21 +414,21 @@ int Daemon::updateAudioStreamId(AudioStream *audio_stream) { } AudioStreamAndOther *Daemon::findAudioStreamAndOther(int id) { - std::map::iterator it = mAudioStreams.find(id); + map::iterator it = mAudioStreams.find(id); if (it != mAudioStreams.end()) return it->second; return NULL; } AudioStream *Daemon::findAudioStream(int id) { - std::map::iterator it = mAudioStreams.find(id); + map::iterator it = mAudioStreams.find(id); if (it != mAudioStreams.end()) return it->second->stream; return NULL; } void Daemon::removeAudioStream(int id) { - std::map::iterator it = mAudioStreams.find(id); + map::iterator it = mAudioStreams.find(id); if (it != mAudioStreams.end()) { mAudioStreams.erase(it); delete(it->second); @@ -542,7 +542,7 @@ void Daemon::dtmfReceived(LinphoneCore *lc, LinphoneCall *call, int dtmf) { } void Daemon::iterateStreamStats() { - for (std::map::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) { + for (map::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) { OrtpEvent *ev; while (it->second->queue && (NULL != (ev=ortp_ev_queue_get(it->second->queue)))){ OrtpEventType evt=ortp_event_get_type(ev); @@ -730,7 +730,7 @@ void Daemon::dumpCommandsHelpHtml(){ cout<<"

"<<"Description"<<"

"<"<getDescription())<<"

"<"<<"Examples"<<""< &examples=(*it)->getExamples(); + const list &examples=(*it)->getExamples(); cout<<"

"; for(list::const_iterator ex_it=examples.begin();ex_it!=examples.end();++ex_it){ cout<<""<")<getCommand())<<"
"<::max(), '\n'); + cin.ignore(numeric_limits::max(), '\n'); return outbuf.str(); #endif } @@ -851,7 +851,7 @@ void Daemon::enableLSD(bool enabled) { Daemon::~Daemon() { uninitCommands(); - for (std::map::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) { + for (map::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) { audio_stream_stop(it->second->stream); } diff --git a/src/c-wrapper/api/c-call.cpp b/src/c-wrapper/api/c-call.cpp index 5a22046c0..3a398b8fb 100644 --- a/src/c-wrapper/api/c-call.cpp +++ b/src/c-wrapper/api/c-call.cpp @@ -735,7 +735,7 @@ const char *linphone_call_get_remote_user_agent (LinphoneCall *call) { } const char * linphone_call_get_remote_contact (LinphoneCall *call) { - std::string contact = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getRemoteContact(); + string contact = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getRemoteContact(); if (contact.empty()) return nullptr; if (call->remoteContactCache) @@ -745,7 +745,7 @@ const char * linphone_call_get_remote_contact (LinphoneCall *call) { } const char *linphone_call_get_authentication_token (LinphoneCall *call) { - std::string token = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getAuthenticationToken(); + string token = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getAuthenticationToken(); return token.empty() ? nullptr : token.c_str(); } @@ -1184,7 +1184,7 @@ void linphone_call_set_user_data (LinphoneCall *call, void *ud) { LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg) { LinphoneCall *call = L_INIT(Call); - L_SET_CPP_PTR_FROM_C_OBJECT(call, std::make_shared(call, lc, LinphoneCallOutgoing, + L_SET_CPP_PTR_FROM_C_OBJECT(call, make_shared(call, lc, LinphoneCallOutgoing, *L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to), cfg, nullptr, L_GET_CPP_PTR_FROM_C_OBJECT(params))); call->currentParamsCache = linphone_call_params_new_for_wrapper(); @@ -1196,7 +1196,7 @@ LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddres LinphoneCall *linphone_call_new_incoming (LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, SalOp *op) { LinphoneCall *call = L_INIT(Call); - L_SET_CPP_PTR_FROM_C_OBJECT(call, std::make_shared(call, lc, LinphoneCallIncoming, + L_SET_CPP_PTR_FROM_C_OBJECT(call, make_shared(call, lc, LinphoneCallIncoming, *L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to), nullptr, op, nullptr)); call->currentParamsCache = linphone_call_params_new_for_wrapper(); diff --git a/src/c-wrapper/api/c-chat-message.cpp b/src/c-wrapper/api/c-chat-message.cpp index 3a8bc06d5..3b4b78881 100644 --- a/src/c-wrapper/api/c-chat-message.cpp +++ b/src/c-wrapper/api/c-chat-message.cpp @@ -498,8 +498,8 @@ void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm) { }LinphoneStatus linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t character) { LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg); if (linphone_core_realtime_text_enabled(linphone_chat_room_get_core(cr))) { - std::shared_ptr rttcr = - std::static_pointer_cast(L_GET_CPP_PTR_FROM_C_OBJECT(cr)); + shared_ptr rttcr = + static_pointer_cast(L_GET_CPP_PTR_FROM_C_OBJECT(cr)); LinphoneCall *call = rttcr->getCall(); LinphoneCore *lc = rttcr->getCore(); const uint32_t new_line = 0x2028; diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index 547f96705..6da8b0c6e 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -269,9 +269,9 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) { LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddress *addr) { LinphoneChatRoom *cr = L_INIT(ChatRoom); if (linphone_core_realtime_text_enabled(core)) - L_SET_CPP_PTR_FROM_C_OBJECT(cr, std::make_shared(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr))); + L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr))); else - L_SET_CPP_PTR_FROM_C_OBJECT(cr, std::make_shared(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr))); + L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr))); 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; @@ -284,7 +284,7 @@ LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core) { LinphoneAddress *factoryAddr = linphone_address_new(factoryUri); LinphoneProxyConfig *proxy = linphone_core_lookup_known_proxy(core, factoryAddr); linphone_address_unref(factoryAddr); - std::string from; + string from; if (proxy) from = L_GET_CPP_PTR_FROM_C_OBJECT(linphone_proxy_config_get_identity_address(proxy))->asString(); if (from.empty()) diff --git a/src/call/call-listener.h b/src/call/call-listener.h index 82f837989..11680c334 100644 --- a/src/call/call-listener.h +++ b/src/call/call-listener.h @@ -27,7 +27,7 @@ LINPHONE_BEGIN_NAMESPACE class CallListener { public: - virtual ~CallListener() = default; + virtual ~CallListener () = default; virtual void onAckBeingSent (LinphoneHeaders *headers) = 0; virtual void onAckReceived (LinphoneHeaders *headers) = 0; diff --git a/src/call/call-p.h b/src/call/call-p.h index 4be0b488c..c655c9052 100644 --- a/src/call/call-p.h +++ b/src/call/call-p.h @@ -29,25 +29,39 @@ LINPHONE_BEGIN_NAMESPACE -class CallPrivate : public ObjectPrivate, CallListener { +class CallPrivate : + public ObjectPrivate, + CallListener { public: - CallPrivate (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to, - LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp); + CallPrivate ( + LinphoneCall *call, + LinphoneCore *core, + LinphoneCallDir direction, + const Address &from, + const Address &to, + LinphoneProxyConfig *cfg, + SalOp *op, + const MediaSessionParams *msp + ); virtual ~CallPrivate (); void initiateIncoming (); bool initiateOutgoing (); void iterate (time_t currentRealTime, bool oneSecondElapsed); void startIncomingNotification (); - int startInvite (const Address *destination); /* If destination is nullptr, it is taken from the call log */ + + int startInvite (const Address *destination); std::shared_ptr getActiveSession () const; bool getAudioMuted () const; - Conference * getConference () const { return conference; } - LinphoneProxyConfig * getDestProxy () const; - IceSession * getIceSession () const; - MediaStream * getMediaStream (LinphoneStreamType type) const; - SalOp * getOp () const; + Conference *getConference () const { + return conference; + } + + LinphoneProxyConfig *getDestProxy () const; + IceSession *getIceSession () const; + MediaStream *getMediaStream (LinphoneStreamType type) const; + SalOp *getOp () const; void setAudioMuted (bool value); private: diff --git a/src/call/call.cpp b/src/call/call.cpp index b4f726bf5..9c9e6f613 100644 --- a/src/call/call.cpp +++ b/src/call/call.cpp @@ -23,16 +23,22 @@ #include "conference/session/media-session-p.h" #include "logger/logger.h" -#include "call.h" - // ============================================================================= using namespace std; LINPHONE_BEGIN_NAMESPACE -CallPrivate::CallPrivate (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to, - LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp) : lcall(call), core(core) { +CallPrivate::CallPrivate ( + LinphoneCall *call, + LinphoneCore *core, + LinphoneCallDir direction, + const Address &from, + const Address &to, + LinphoneProxyConfig *cfg, + SalOp *op, + const MediaSessionParams *msp +) : lcall(call), core(core) { nextVideoFrameDecoded._func = nullptr; nextVideoFrameDecoded._user_data = nullptr; } @@ -52,19 +58,19 @@ bool CallPrivate::getAudioMuted () const { return static_cast(getActiveSession().get())->getPrivate()->getAudioMuted(); } -LinphoneProxyConfig * CallPrivate::getDestProxy () const { +LinphoneProxyConfig *CallPrivate::getDestProxy () const { return getActiveSession()->getPrivate()->getDestProxy(); } -IceSession * CallPrivate::getIceSession () const { +IceSession *CallPrivate::getIceSession () const { return static_cast(getActiveSession().get())->getPrivate()->getIceSession(); } -MediaStream * CallPrivate::getMediaStream (LinphoneStreamType type) const { +MediaStream *CallPrivate::getMediaStream (LinphoneStreamType type) const { return static_cast(getActiveSession().get())->getPrivate()->getMediaStream(type); } -SalOp * CallPrivate::getOp () const { +SalOp *CallPrivate::getOp () const { return getActiveSession()->getPrivate()->getOp(); } @@ -119,16 +125,16 @@ void CallPrivate::onCallSetTerminated () { } if (linphone_core_del_call(core, lcall) != 0) lError() << "Could not remove the call from the list!!!"; -#if 0 - if (core->conf_ctx) - linphone_conference_on_call_terminating(core->conf_ctx, lcall); - if (lcall->ringing_beep){ - linphone_core_stop_dtmf(core); - lcall->ringing_beep = false; - } - if (lcall->chat_room) - linphone_chat_room_set_call(lcall->chat_room, nullptr); -#endif + #if 0 + if (core->conf_ctx) + linphone_conference_on_call_terminating(core->conf_ctx, lcall); + if (lcall->ringing_beep) { + linphone_core_stop_dtmf(core); + lcall->ringing_beep = false; + } + if (lcall->chat_room) + linphone_chat_room_set_call(lcall->chat_room, nullptr); + #endif // if 0 if (!core->calls) ms_bandwidth_controller_reset_state(core->bw_controller); } @@ -149,8 +155,8 @@ void CallPrivate::onCheckForAcceptation () { case LinphoneCallOutgoingProgress: case LinphoneCallOutgoingRinging: case LinphoneCallOutgoingEarlyMedia: - lInfo() << "Already existing call [" << call << "] in state [" << linphone_call_state_to_string(linphone_call_get_state(call)) - << "], canceling it before accepting new call [" << lcall << "]"; + lInfo() << "Already existing call [" << call << "] in state [" << linphone_call_state_to_string(linphone_call_get_state(call)) << + "], canceling it before accepting new call [" << lcall << "]"; linphone_call_terminate(call); break; default: @@ -198,16 +204,24 @@ void CallPrivate::onFirstVideoFrameDecoded () { } void CallPrivate::onResetFirstVideoFrameDecoded () { -#ifdef VIDEO_ENABLED - if (lcall && nextVideoFrameDecoded._func) - static_cast(getActiveSession().get())->resetFirstVideoFrameDecoded(); -#endif + #ifdef VIDEO_ENABLED + if (lcall && nextVideoFrameDecoded._func) + static_cast(getActiveSession().get())->resetFirstVideoFrameDecoded(); + #endif // ifdef VIDEO_ENABLED } // ============================================================================= -Call::Call (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to, - LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp) : Object(*new CallPrivate(call, core, direction, from, to, cfg, op, msp)) { +Call::Call ( + LinphoneCall *call, + LinphoneCore *core, + LinphoneCallDir direction, + const Address &from, + const Address &to, + LinphoneProxyConfig *cfg, + SalOp *op, + const MediaSessionParams *msp +) : Object(*new CallPrivate(call, core, direction, from, to, cfg, op, msp)) { L_D(Call); const Address *myAddress = (direction == LinphoneCallIncoming) ? &to : &from; string confType = lp_config_get_string(linphone_core_get_config(core), "misc", "conference_type", "local"); @@ -273,12 +287,12 @@ void Call::stopRecording () { static_cast(d->getActiveSession().get())->stopRecording(); } -LinphoneStatus Call::takePreviewSnapshot (const string& file) { +LinphoneStatus Call::takePreviewSnapshot (const string &file) { L_D(Call); return static_cast(d->getActiveSession().get())->takePreviewSnapshot(file); } -LinphoneStatus Call::takeVideoSnapshot (const string& file) { +LinphoneStatus Call::takeVideoSnapshot (const string &file) { L_D(Call); return static_cast(d->getActiveSession().get())->takeVideoSnapshot(file); } @@ -335,7 +349,7 @@ bool Call::getAllMuted () const { return static_cast(d->getActiveSession().get())->getAllMuted(); } -LinphoneCallStats * Call::getAudioStats () const { +LinphoneCallStats *Call::getAudioStats () const { L_D(const Call); return static_cast(d->getActiveSession().get())->getAudioStats(); } @@ -355,12 +369,12 @@ float Call::getAverageQuality () const { return static_cast(d->getActiveSession().get())->getAverageQuality(); } -LinphoneCore * Call::getCore () const { +LinphoneCore *Call::getCore () const { L_D(const Call); return d->core; } -const MediaSessionParams * Call::getCurrentParams () const { +const MediaSessionParams *Call::getCurrentParams () const { L_D(const Call); return static_cast(d->getActiveSession().get())->getCurrentParams(); } @@ -380,22 +394,22 @@ int Call::getDuration () const { return d->getActiveSession()->getDuration(); } -const LinphoneErrorInfo * Call::getErrorInfo () const { +const LinphoneErrorInfo *Call::getErrorInfo () const { L_D(const Call); return d->getActiveSession()->getErrorInfo(); } -LinphoneCallLog * Call::getLog () const { +LinphoneCallLog *Call::getLog () const { L_D(const Call); return d->getActiveSession()->getLog(); } -RtpTransport * Call::getMetaRtcpTransport (int streamIndex) const { +RtpTransport *Call::getMetaRtcpTransport (int streamIndex) const { L_D(const Call); return static_cast(d->getActiveSession().get())->getMetaRtcpTransport(streamIndex); } -RtpTransport * Call::getMetaRtpTransport (int streamIndex) const { +RtpTransport *Call::getMetaRtpTransport (int streamIndex) const { L_D(const Call); return static_cast(d->getActiveSession().get())->getMetaRtpTransport(streamIndex); } @@ -405,12 +419,12 @@ float Call::getMicrophoneVolumeGain () const { return static_cast(d->getActiveSession().get())->getMicrophoneVolumeGain(); } -void * Call::getNativeVideoWindowId () const { +void *Call::getNativeVideoWindowId () const { L_D(const Call); return static_cast(d->getActiveSession().get())->getNativeVideoWindowId(); } -const MediaSessionParams * Call::getParams () const { +const MediaSessionParams *Call::getParams () const { L_D(const Call); return static_cast(d->getActiveSession().get())->getMediaParams(); } @@ -430,7 +444,7 @@ float Call::getRecordVolume () const { return static_cast(d->getActiveSession().get())->getRecordVolume(); } -const Address& Call::getRemoteAddress () const { +const Address &Call::getRemoteAddress () const { L_D(const Call); return d->getActiveSession()->getRemoteAddress(); } @@ -445,7 +459,7 @@ string Call::getRemoteContact () const { return d->getActiveSession()->getRemoteContact(); } -const MediaSessionParams * Call::getRemoteParams () const { +const MediaSessionParams *Call::getRemoteParams () const { L_D(const Call); return static_cast(d->getActiveSession().get())->getRemoteParams(); } @@ -460,7 +474,7 @@ LinphoneCallState Call::getState () const { return d->getActiveSession()->getState(); } -LinphoneCallStats * Call::getStats (LinphoneStreamType type) const { +LinphoneCallStats *Call::getStats (LinphoneStreamType type) const { L_D(const Call); return static_cast(d->getActiveSession().get())->getStats(type); } @@ -475,12 +489,12 @@ MSFormatType Call::getStreamType (int streamIndex) const { return static_cast(d->getActiveSession().get())->getStreamType(streamIndex); } -LinphoneCallStats * Call::getTextStats () const { +LinphoneCallStats *Call::getTextStats () const { L_D(const Call); return static_cast(d->getActiveSession().get())->getTextStats(); } -LinphoneCallStats * Call::getVideoStats () const { +LinphoneCallStats *Call::getVideoStats () const { L_D(const Call); return static_cast(d->getActiveSession().get())->getVideoStats(); } diff --git a/src/call/call.h b/src/call/call.h index cbf4b7aca..d809c3563 100644 --- a/src/call/call.h +++ b/src/call/call.h @@ -19,7 +19,6 @@ #ifndef _CALL_CALL_H_ #define _CALL_CALL_H_ -#include "address/address.h" #include "conference/params/media-session-params.h" #include "object/object.h" @@ -27,6 +26,7 @@ LINPHONE_BEGIN_NAMESPACE +class Address; class CallPrivate; class CallSessionPrivate; class MediaSessionPrivate; diff --git a/src/chat/chat-message.cpp b/src/chat/chat-message.cpp index de28edd49..c73be1e5f 100644 --- a/src/chat/chat-message.cpp +++ b/src/chat/chat-message.cpp @@ -40,14 +40,14 @@ using namespace std; // ----------------------------------------------------------------------------- -ChatMessagePrivate::ChatMessagePrivate (const std::shared_ptr &room) +ChatMessagePrivate::ChatMessagePrivate (const shared_ptr &room) : chatRoom(room) {} ChatMessagePrivate::~ChatMessagePrivate () {} // ----------------------------------------------------------------------------- -ChatMessage::ChatMessage (const std::shared_ptr &room) : Object(*new ChatMessagePrivate(room)) {} +ChatMessage::ChatMessage (const shared_ptr &room) : Object(*new ChatMessagePrivate(room)) {} ChatMessage::ChatMessage (ChatMessagePrivate &p) : Object(p) {} @@ -62,7 +62,7 @@ shared_ptr ChatMessage::getChatRoom () const { // ----------------------------------------------------------------------------- -std::string ChatMessage::getExternalBodyUrl() const { +string ChatMessage::getExternalBodyUrl() const { L_D(const ChatMessage); return d->externalBodyUrl; } @@ -127,7 +127,7 @@ void ChatMessage::setState(State state) { ms_message("Chat message %p: moving from state %s to %s", msg, linphone_chat_message_state_to_string(msg->state), linphone_chat_message_state_to_string(state)); */ d->state = state; - + LinphoneChatMessage *msg = L_GET_C_BACK_PTR(this); /* TODO if (msg->message_state_changed_cb) { diff --git a/src/chat/client-group-chat-room.cpp b/src/chat/client-group-chat-room.cpp index 4ecf2ee45..912383cf4 100644 --- a/src/chat/client-group-chat-room.cpp +++ b/src/chat/client-group-chat-room.cpp @@ -141,7 +141,7 @@ void ClientGroupChatRoom::onParticipantSetAdmin (const Address &addr, bool isAdm // ----------------------------------------------------------------------------- -void ClientGroupChatRoom::onCallSessionStateChanged (const CallSession &session, LinphoneCallState state, const std::string &message) { +void ClientGroupChatRoom::onCallSessionStateChanged (const CallSession &session, LinphoneCallState state, const string &message) { if (state == LinphoneCallConnected) { // TODO: Get the conference ID instead of the remote address onConferenceCreated(session.getRemoteAddress()); diff --git a/src/chat/is-composing.cpp b/src/chat/is-composing.cpp index 7a4560aa5..e1ef360b1 100644 --- a/src/chat/is-composing.cpp +++ b/src/chat/is-composing.cpp @@ -42,7 +42,7 @@ IsComposing::~IsComposing () { // ----------------------------------------------------------------------------- -std::string IsComposing::marshal (bool isComposing) { +string IsComposing::marshal (bool isComposing) { string content; xmlBufferPtr buf = xmlBufferCreate(); @@ -192,7 +192,7 @@ unsigned int IsComposing::getRefreshTimerDuration () { unsigned int IsComposing::getRemoteRefreshTimerDuration () { int remoteRefreshTimerDuration = lp_config_get_int(core->config, "sip", "composing_remote_refresh_timeout", defaultRemoteRefreshTimeout); - return remoteRefreshTimerDuration < 0 ? 0 : static_cast(remoteRefreshTimerDuration); + return remoteRefreshTimerDuration < 0 ? 0 : static_cast(remoteRefreshTimerDuration); } void IsComposing::parse (xmlparsing_context_t *xmlCtx) { diff --git a/src/conference/conference.cpp b/src/conference/conference.cpp index 99463295a..b26f83845 100644 --- a/src/conference/conference.cpp +++ b/src/conference/conference.cpp @@ -149,7 +149,7 @@ void Conference::onResetFirstVideoFrameDecoded (const CallSession &session) { // ----------------------------------------------------------------------------- -std::shared_ptr Conference::findParticipant (const Address &addr) { +shared_ptr Conference::findParticipant (const Address &addr) { for (const auto &participant : participants) { if (addr.equal(participant->getAddress())) return participant; diff --git a/src/conference/conference.h b/src/conference/conference.h index b1a1f4fee..d80c50298 100644 --- a/src/conference/conference.h +++ b/src/conference/conference.h @@ -82,10 +82,10 @@ protected: LinphoneCore *core = nullptr; CallListener *callListener = nullptr; - std::shared_ptr activeParticipant = nullptr; - std::string id; - std::shared_ptr me = nullptr; + std::shared_ptr activeParticipant; + std::shared_ptr me; std::list> participants; + std::string id; private: L_DISABLE_COPY(Conference); diff --git a/src/conference/participant-p.h b/src/conference/participant-p.h index 4abcb974a..8d863a9eb 100644 --- a/src/conference/participant-p.h +++ b/src/conference/participant-p.h @@ -44,7 +44,7 @@ public: private: Address addr; bool isAdmin = false; - std::shared_ptr session = nullptr; + std::shared_ptr session; L_DECLARE_PUBLIC(Participant); }; diff --git a/src/conference/remote-conference.h b/src/conference/remote-conference.h index 3277ba520..8e7593320 100644 --- a/src/conference/remote-conference.h +++ b/src/conference/remote-conference.h @@ -32,7 +32,7 @@ public: virtual ~RemoteConference(); protected: - std::shared_ptr focus = nullptr; + std::shared_ptr focus; public: /* ConferenceInterface */ diff --git a/src/conference/session/call-session.cpp b/src/conference/session/call-session.cpp index 392c632ca..d38fa5e85 100644 --- a/src/conference/session/call-session.cpp +++ b/src/conference/session/call-session.cpp @@ -558,7 +558,7 @@ void CallSessionPrivate::setTerminated() { listener->onCallSessionSetTerminated(*q); } -LinphoneStatus CallSessionPrivate::startAcceptUpdate (LinphoneCallState nextState, const std::string &stateInfo) { +LinphoneStatus CallSessionPrivate::startAcceptUpdate (LinphoneCallState nextState, const string &stateInfo) { sal_call_accept(op); setState(nextState, stateInfo); return 0; diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index 5f8703d42..c1bce3c98 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -4348,7 +4348,7 @@ void MediaSession::resetFirstVideoFrameDecoded () { ms_filter_call_method_noarg(d->videoStream->ms.decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION); } -LinphoneStatus MediaSession::takePreviewSnapshot (const std::string& file) { +LinphoneStatus MediaSession::takePreviewSnapshot (const string& file) { #ifdef VIDEO_ENABLED L_D(MediaSession); if (d->videoStream && d->videoStream->local_jpegwriter) { @@ -4360,7 +4360,7 @@ LinphoneStatus MediaSession::takePreviewSnapshot (const std::string& file) { return -1; } -LinphoneStatus MediaSession::takeVideoSnapshot (const std::string& file) { +LinphoneStatus MediaSession::takeVideoSnapshot (const string& file) { #ifdef VIDEO_ENABLED L_D(MediaSession); if (d->videoStream && d->videoStream->jpegwriter) { diff --git a/src/content/content-type.cpp b/src/content/content-type.cpp index 4fc11faf0..6d0815811 100644 --- a/src/content/content-type.cpp +++ b/src/content/content-type.cpp @@ -79,7 +79,7 @@ const string &ContentType::getType () const { return d->type; } -bool ContentType::setType (const std::string &type) { +bool ContentType::setType (const string &type) { L_D(ContentType); if (type.find('/') == string::npos) { d->type = type; @@ -93,7 +93,7 @@ const string &ContentType::getSubType () const { return d->subType; } -bool ContentType::setSubType (const std::string &subType) { +bool ContentType::setSubType (const string &subType) { L_D(ContentType); if (subType.find('/') == string::npos) { d->subType = subType; diff --git a/src/content/content.cpp b/src/content/content.cpp index c2b1a425a..efac402a1 100644 --- a/src/content/content.cpp +++ b/src/content/content.cpp @@ -92,7 +92,7 @@ void Content::setContentDisposition (const string &contentDisposition) { d->contentDisposition = contentDisposition; } -const std::vector &Content::getBody () const { +const vector &Content::getBody () const { L_D(const Content); return d->body; } @@ -102,12 +102,12 @@ string Content::getBodyAsString () const { return string(d->body.begin(), d->body.end()); } -void Content::setBody (const std::vector &body) { +void Content::setBody (const vector &body) { L_D(Content); d->body = body; } -void Content::setBody (const std::string &body) { +void Content::setBody (const string &body) { L_D(Content); d->body = vector(body.cbegin(), body.cend()); } diff --git a/src/object/property-container.cpp b/src/object/property-container.cpp index fadc32082..b0c472588 100644 --- a/src/object/property-container.cpp +++ b/src/object/property-container.cpp @@ -28,7 +28,7 @@ LINPHONE_BEGIN_NAMESPACE class PropertyContainerPrivate { public: - unordered_map properties; + unordered_map properties; }; // -----------------------------------------------------------------------------