From 8ae87e2f3f155e82b4d5a11a6f1c3e1aedb5bb79 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 19 Sep 2017 14:20:14 +0200 Subject: [PATCH] feat(Core): deal with more warning options! --- CMakeLists.txt | 21 +++++++-- coreapi/private.h | 2 +- src/CMakeLists.txt | 10 +++- src/c-wrapper/api/c-address.cpp | 2 +- src/call/call-p.h | 26 +++++----- src/chat/basic-chat-room.h | 16 +++---- src/chat/chat-room-p.h | 14 +++--- src/chat/chat-room.cpp | 12 +++-- src/chat/client-group-chat-room.h | 16 +++---- src/chat/modifier/chat-message-modifier.h | 42 +++++++++-------- .../modifier/cpim-chat-message-modifier.cpp | 20 ++++---- .../modifier/cpim-chat-message-modifier.h | 41 ++++++++-------- .../multipart-chat-message-modifier.cpp | 32 +++++++------ .../multipart-chat-message-modifier.h | 41 ++++++++-------- src/chat/real-time-text-chat-room.h | 18 +++---- src/conference/conference.h | 47 +++++++++---------- .../local-conference-event-handler.cpp | 12 ++++- src/conference/local-conference.h | 10 +++- .../params/media-session-params.cpp | 2 +- src/conference/params/media-session-params.h | 6 +-- .../remote-conference-event-handler.cpp | 14 +++++- src/conference/session/media-session-p.h | 34 +++++++------- src/conference/session/media-session.h | 14 +++--- 23 files changed, 249 insertions(+), 203 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24d225847..9cddd930e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(CheckSymbolExists) include(CMakePushCheckState) include(GNUInstallDirs) +include(CheckCXXCompilerFlag) if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX) set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) @@ -205,7 +206,7 @@ endif() set(LINPHONE_LDFLAGS "${BELLESIP_LDFLAGS} ${MEDIASTREAMER2_LDFLAGS}") if(BELCARD_FOUND AND APPLE) - set(LINPHONE_LDFLAGS "${LINPHONE_LDFLAGS} -stdlib=libc++") + set(LINPHONE_LDFLAGS "${LINPHONE_LDFLAGS} -stdlib=libc++") endif() # include_directories must be called only UNDER THIS LINE in order to use our @@ -281,7 +282,22 @@ if(MSVC) list(APPEND STRICT_OPTIONS_CPP "/WX") endif() else() - list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized" "-Wno-error=deprecated-declarations") + list(APPEND STRICT_OPTIONS_CPP "\ +-Wall \ +-Wcast-align \ +-Wconversion \ +-Werror=return-type \ +-Wfloat-equal \ +-Winit-self \ +-Wno-error=deprecated-declarations \ +-Woverloaded-virtual \ +-Wpointer-arith \ +-Wuninitialized \ +-Wunused") + CHECK_CXX_COMPILER_FLAG("-Wsuggest-override" SUGGEST_OVERRIDE) + if (SUGGEST_OVERRIDE) + list(APPEND STRICT_OPTIONS_CPP "-Wsuggest-override -Werror=suggest-override") + endif () list(APPEND STRICT_OPTIONS_C "-Wstrict-prototypes" "-Werror=strict-prototypes") if(CMAKE_C_COMPILER_ID STREQUAL "GNU") list(APPEND STRICT_OPTIONS_C "-fno-inline-small-functions") @@ -307,7 +323,6 @@ if(STRICT_OPTIONS_C) list(REMOVE_DUPLICATES STRICT_OPTIONS_C) endif() - set(GETTEXT_PACKAGE "linphone") if(ENABLE_RELATIVE_PREFIX) set(LINPHONE_DATA_DIR ".") diff --git a/coreapi/private.h b/coreapi/private.h index 7f25bb906..cd4673aef 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -407,7 +407,7 @@ static MS2_INLINE void set_string(char **dest, const char *src, bool_t lowercase *dest=ms_strdup(src); if (lowercase) { char *cur = *dest; - for (; *cur; cur++) *cur = tolower(*cur); + for (; *cur; cur++) *cur = (char)tolower(*cur); } } } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8c8b2a14c..ae40aa80b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -178,13 +178,19 @@ set(LINPHONE_PRIVATE_HEADER_FILES ${LINPHONE_PRIVATE_HEADER_FILES} PARENT_SCOPE) bc_apply_compile_flags(LINPHONE_CXX_OBJECTS_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX) if(ENABLE_STATIC) - add_library(linphone-cxx-objects-static OBJECT ${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES}) + add_library( + linphone-cxx-objects-static OBJECT + ${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} + ) target_compile_definitions(linphone-cxx-objects-static PRIVATE ${LINPHONE_CXX_OBJECTS_DEFINITIONS}) target_include_directories(linphone-cxx-objects-static SYSTEM PRIVATE ${LINPHONE_CXX_OBJECTS_INCLUDE_DIRS} ${LINPHONE_INCLUDE_DIRS}) endif() if(ENABLE_SHARED) - add_library(linphone-cxx-objects OBJECT ${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES}) + add_library( + linphone-cxx-objects OBJECT + ${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} + ) target_compile_definitions(linphone-cxx-objects PRIVATE ${LINPHONE_CXX_OBJECTS_DEFINITIONS}) target_include_directories(linphone-cxx-objects SYSTEM PRIVATE ${LINPHONE_CXX_OBJECTS_INCLUDE_DIRS} ${LINPHONE_INCLUDE_DIRS}) target_compile_options(linphone-cxx-objects PRIVATE "-fPIC") diff --git a/src/c-wrapper/api/c-address.cpp b/src/c-wrapper/api/c-address.cpp index 9e966dfc7..32add40aa 100644 --- a/src/c-wrapper/api/c-address.cpp +++ b/src/c-wrapper/api/c-address.cpp @@ -42,7 +42,7 @@ LinphoneAddress *linphone_address_new (const char *address) { } LinphoneAddress *linphone_address_clone (const LinphoneAddress *address) { - return (LinphoneAddress *)belle_sip_object_clone(BELLE_SIP_OBJECT(address)); + return reinterpret_cast(belle_sip_object_clone(BELLE_SIP_OBJECT(address))); } LinphoneAddress *linphone_address_ref (LinphoneAddress *address) { diff --git a/src/call/call-p.h b/src/call/call-p.h index 98b062f74..d0035ac9c 100644 --- a/src/call/call-p.h +++ b/src/call/call-p.h @@ -59,19 +59,19 @@ public: private: /* CallListener */ - void onAckBeingSent (LinphoneHeaders *headers); - void onAckReceived (LinphoneHeaders *headers); - void onCallSetReleased (); - void onCallSetTerminated (); - void onCallStateChanged (LinphoneCallState state, const std::string &message); - void onIncomingCallStarted (); - void onIncomingCallToBeAdded (); - void onEncryptionChanged (bool activated, const std::string &authToken); - void onStatsUpdated (const LinphoneCallStats *stats); - void onResetCurrentCall (); - void onSetCurrentCall (); - void onFirstVideoFrameDecoded (); - void onResetFirstVideoFrameDecoded (); + void onAckBeingSent (LinphoneHeaders *headers) override; + void onAckReceived (LinphoneHeaders *headers) override; + void onCallSetReleased () override; + void onCallSetTerminated () override; + void onCallStateChanged (LinphoneCallState state, const std::string &message) override; + void onIncomingCallStarted () override; + void onIncomingCallToBeAdded () override; + void onEncryptionChanged (bool activated, const std::string &authToken) override; + void onStatsUpdated (const LinphoneCallStats *stats) override; + void onResetCurrentCall () override; + void onSetCurrentCall () override; + void onFirstVideoFrameDecoded () override; + void onResetFirstVideoFrameDecoded () override; private: LinphoneCall *lcall = nullptr; diff --git a/src/chat/basic-chat-room.h b/src/chat/basic-chat-room.h index 1aced22f7..01864f3a9 100644 --- a/src/chat/basic-chat-room.h +++ b/src/chat/basic-chat-room.h @@ -39,14 +39,14 @@ public: virtual ~BasicChatRoom () = default; /* ConferenceInterface */ - std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia); - void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia); - bool canHandleParticipants () const; - const std::string& getId () const; - int getNbParticipants () const; - std::list> getParticipants () const; - void removeParticipant (const std::shared_ptr &participant); - void removeParticipants (const std::list> &participants); + std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override; + void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia) override; + bool canHandleParticipants () const override; + const std::string& getId () const override; + int getNbParticipants () const override; + std::list> getParticipants () const override; + void removeParticipant (const std::shared_ptr &participant) override; + void removeParticipants (const std::list> &participants) override; private: L_DECLARE_PRIVATE(BasicChatRoom); diff --git a/src/chat/chat-room-p.h b/src/chat/chat-room-p.h index 1f082da49..d40d69f5d 100644 --- a/src/chat/chat-room-p.h +++ b/src/chat/chat-room-p.h @@ -19,15 +19,15 @@ #ifndef _CHAT_ROOM_P_H_ #define _CHAT_ROOM_P_H_ -// From coreapi. -#include "private.h" - #include "linphone/enums/chat-room-enums.h" #include "linphone/utils/enum-generator.h" +// From coreapi. +#include "private.h" + #include "chat-room.h" -#include "is-composing.h" #include "is-composing-listener.h" +#include "is-composing.h" #include "object/object-p.h" // ============================================================================= @@ -86,9 +86,9 @@ private: private: /* IsComposingListener */ - void onIsComposingStateChanged (bool isComposing); - void onIsRemoteComposingStateChanged (bool isComposing); - void onIsComposingRefreshNeeded (); + void onIsComposingStateChanged (bool isComposing) override; + void onIsRemoteComposingStateChanged (bool isComposing) override; + void onIsComposingRefreshNeeded () override; public: LinphoneCore *core = nullptr; diff --git a/src/chat/chat-room.cpp b/src/chat/chat-room.cpp index 776c9bd86..b3aecbf5d 100644 --- a/src/chat/chat-room.cpp +++ b/src/chat/chat-room.cpp @@ -120,7 +120,7 @@ void ChatRoomPrivate::sendImdn (const string &content, LinphoneReason reason) { /* Sending out of call */ SalOp *op = sal_op_new(core->sal); - linphone_configure_op(core, op, peer, nullptr, lp_config_get_int(core->config, "sip", "chat_msg_with_contact", 0)); + linphone_configure_op(core, op, peer, nullptr, !!lp_config_get_int(core->config, "sip", "chat_msg_with_contact", 0)); LinphoneChatMessage *msg = q->createMessage(content); LinphoneAddress *fromAddr = linphone_address_new(identity); linphone_chat_message_set_from_address(msg, fromAddr); @@ -206,7 +206,7 @@ void ChatRoomPrivate::sendIsComposingNotification () { /* Sending out of call */ SalOp *op = sal_op_new(core->sal); - linphone_configure_op(core, op, peer, nullptr, lp_config_get_int(core->config, "sip", "chat_msg_with_contact", 0)); + linphone_configure_op(core, op, peer, nullptr, !!lp_config_get_int(core->config, "sip", "chat_msg_with_contact", 0)); string content = isComposingHandler.marshal(isComposing); if (!content.empty()) { int retval = -1; @@ -284,7 +284,7 @@ int ChatRoomPrivate::createChatMessageFromDb (int argc, char **argv, char **colN linphone_address_unref(peer); newMessage->time = (time_t)atol(argv[9]); - newMessage->is_read = atoi(argv[6]); + newMessage->is_read = !!atoi(argv[6]); newMessage->state = static_cast(atoi(argv[7])); newMessage->storage_id = storageId; newMessage->external_body_url = ms_strdup(argv[8]); @@ -859,8 +859,10 @@ void ChatRoom::sendMessage (LinphoneChatMessage *msg) { if (!op) { /* Sending out of call */ msg->op = op = sal_op_new(d->core->sal); - linphone_configure_op(d->core, op, peer, msg->custom_headers, - lp_config_get_int(d->core->config, "sip", "chat_msg_with_contact", 0)); + linphone_configure_op( + d->core, op, peer, msg->custom_headers, + !!lp_config_get_int(d->core->config, "sip", "chat_msg_with_contact", 0) + ); sal_op_set_user_pointer(op, msg); /* If out of call, directly store msg */ } diff --git a/src/chat/client-group-chat-room.h b/src/chat/client-group-chat-room.h index 0101437cf..1dcc1cc47 100644 --- a/src/chat/client-group-chat-room.h +++ b/src/chat/client-group-chat-room.h @@ -40,14 +40,14 @@ public: public: /* ConferenceInterface */ - std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia); - void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia); - bool canHandleParticipants () const; - const std::string& getId () const; - int getNbParticipants () const; - std::list> getParticipants () const; - void removeParticipant (const std::shared_ptr &participant); - void removeParticipants (const std::list> &participants); + std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override; + void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia) override; + bool canHandleParticipants () const override; + const std::string& getId () const override; + int getNbParticipants () const override; + std::list> getParticipants () const override; + void removeParticipant (const std::shared_ptr &participant) override; + void removeParticipants (const std::list> &participants) override; private: /* ConferenceListener */ diff --git a/src/chat/modifier/chat-message-modifier.h b/src/chat/modifier/chat-message-modifier.h index 97e8724f7..1bd6d5a88 100644 --- a/src/chat/modifier/chat-message-modifier.h +++ b/src/chat/modifier/chat-message-modifier.h @@ -16,23 +16,25 @@ * along with this program. If not, see . */ - #ifndef _CHAT_MESSAGE_MODIFIER_H_ - #define _CHAT_MESSAGE_MODIFIER_H_ - - #include "chat/chat-message.h" - - // ============================================================================= - - LINPHONE_BEGIN_NAMESPACE - - class ChatMessageModifier { - public: - virtual void encode(LinphonePrivate::ChatMessagePrivate* msg) = 0; - virtual void decode(LinphonePrivate::ChatMessagePrivate* msg) = 0; - virtual ~ChatMessageModifier () = default; - }; - - LINPHONE_END_NAMESPACE - - #endif // ifndef _CHAT_MESSAGE_MODIFIER_H_ - \ No newline at end of file +#ifndef _CHAT_MESSAGE_MODIFIER_H_ +#define _CHAT_MESSAGE_MODIFIER_H_ + +#include "linphone/utils/general.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class ChatMessagePrivate; + +class ChatMessageModifier { +public: + virtual ~ChatMessageModifier () = default; + + virtual void encode (ChatMessagePrivate *messagePrivate) = 0; + virtual void decode (ChatMessagePrivate *messagePrivate) = 0; +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _CPIM_CHAT_MESSAGE_MODIFIER_H_ diff --git a/src/chat/modifier/cpim-chat-message-modifier.cpp b/src/chat/modifier/cpim-chat-message-modifier.cpp index e36095c71..dec8d2046 100644 --- a/src/chat/modifier/cpim-chat-message-modifier.cpp +++ b/src/chat/modifier/cpim-chat-message-modifier.cpp @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -#include - #include "chat/chat-message-p.h" #include "chat/cpim/cpim.h" #include "content/content-type.h" @@ -31,7 +29,7 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE -void CpimChatMessageModifier::encode(LinphonePrivate::ChatMessagePrivate* msg) { +void CpimChatMessageModifier::encode (ChatMessagePrivate *messagePrivate) { Cpim::Message message; Cpim::GenericHeader cpimContentTypeHeader; cpimContentTypeHeader.setName("Content-Type"); @@ -39,14 +37,14 @@ void CpimChatMessageModifier::encode(LinphonePrivate::ChatMessagePrivate* msg) { message.addCpimHeader(cpimContentTypeHeader); shared_ptr content; - if (msg->internalContent) { + if (messagePrivate->internalContent) { // Another ChatMessageModifier was called before this one, we apply our changes on the private content - content = msg->internalContent; + content = messagePrivate->internalContent; } else { // We're the first ChatMessageModifier to be called, we'll create the private content from the public one // We take the first one because if there is more of them, the multipart modifier should have been called first // So we should not be in this block - content = msg->contents.front(); + content = messagePrivate->contents.front(); } string contentType = content->getContentType().asString(); @@ -67,16 +65,16 @@ void CpimChatMessageModifier::encode(LinphonePrivate::ChatMessagePrivate* msg) { ContentType newContentType("Message/CPIM"); newContent->setContentType(newContentType); newContent->setBody(message.asString()); - msg->internalContent = newContent; + messagePrivate->internalContent = newContent; } } -void CpimChatMessageModifier::decode(LinphonePrivate::ChatMessagePrivate* msg) { +void CpimChatMessageModifier::decode (ChatMessagePrivate *messagePrivate) { shared_ptr content; - if (msg->internalContent) { - content = msg->internalContent; + if (messagePrivate->internalContent) { + content = messagePrivate->internalContent; } else { - content = msg->contents.front(); + content = messagePrivate->contents.front(); } ContentType contentType = content->getContentType(); diff --git a/src/chat/modifier/cpim-chat-message-modifier.h b/src/chat/modifier/cpim-chat-message-modifier.h index f31f1cb12..9d5696bb0 100644 --- a/src/chat/modifier/cpim-chat-message-modifier.h +++ b/src/chat/modifier/cpim-chat-message-modifier.h @@ -16,24 +16,23 @@ * along with this program. If not, see . */ - #ifndef _CPIM_CHAT_MESSAGE_MODIFIER_H_ - #define _CPIM_CHAT_MESSAGE_MODIFIER_H_ - - #include "chat-message-modifier.h" - - // ============================================================================= - - LINPHONE_BEGIN_NAMESPACE - - class CpimChatMessageModifier : ChatMessageModifier { - public: - CpimChatMessageModifier() {}; - virtual void encode(LinphonePrivate::ChatMessagePrivate* msg); - virtual void decode(LinphonePrivate::ChatMessagePrivate* msg); - virtual ~CpimChatMessageModifier () = default; - }; - - LINPHONE_END_NAMESPACE - - #endif // ifndef _CPIM_CHAT_MESSAGE_MODIFIER_H_ - \ No newline at end of file +#ifndef _CPIM_CHAT_MESSAGE_MODIFIER_H_ +#define _CPIM_CHAT_MESSAGE_MODIFIER_H_ + +#include "chat-message-modifier.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class CpimChatMessageModifier : public ChatMessageModifier { +public: + CpimChatMessageModifier () = default; + + void encode (ChatMessagePrivate *messagePrivate) override; + void decode (ChatMessagePrivate *messagePrivate) override; +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _CPIM_CHAT_MESSAGE_MODIFIER_H_ diff --git a/src/chat/modifier/multipart-chat-message-modifier.cpp b/src/chat/modifier/multipart-chat-message-modifier.cpp index 352de4e2a..f0e073cbb 100644 --- a/src/chat/modifier/multipart-chat-message-modifier.cpp +++ b/src/chat/modifier/multipart-chat-message-modifier.cpp @@ -16,21 +16,23 @@ * along with this program. If not, see . */ - #include "chat/chat-message-p.h" - #include "multipart-chat-message-modifier.h" +#include "chat/chat-message-p.h" +#include "multipart-chat-message-modifier.h" - LINPHONE_BEGIN_NAMESPACE - - using namespace std; +// ============================================================================= - void MultipartChatMessageModifier::encode(LinphonePrivate::ChatMessagePrivate* msg) { - if (msg->contents.size() > 1) { - //TODO - } - } +using namespace std; - void MultipartChatMessageModifier::decode(LinphonePrivate::ChatMessagePrivate* msg) { - //TODO - } - -LINPHONE_END_NAMESPACE \ No newline at end of file +LINPHONE_BEGIN_NAMESPACE + +void MultipartChatMessageModifier::encode (ChatMessagePrivate *messagePrivate) { + if (messagePrivate->contents.size() > 1) { + //TODO + } +} + +void MultipartChatMessageModifier::decode (ChatMessagePrivate *messagePrivate) { + //TODO +} + +LINPHONE_END_NAMESPACE diff --git a/src/chat/modifier/multipart-chat-message-modifier.h b/src/chat/modifier/multipart-chat-message-modifier.h index b66f618f0..17361d3d6 100644 --- a/src/chat/modifier/multipart-chat-message-modifier.h +++ b/src/chat/modifier/multipart-chat-message-modifier.h @@ -16,24 +16,23 @@ * along with this program. If not, see . */ - #ifndef _MULTIPART_CHAT_MESSAGE_MODIFIER_H_ - #define _MULTIPART_CHAT_MESSAGE_MODIFIER_H_ - - #include "chat-message-modifier.h" - - // ============================================================================= - - LINPHONE_BEGIN_NAMESPACE - - class MultipartChatMessageModifier : ChatMessageModifier { - public: - MultipartChatMessageModifier() {}; - virtual void encode(LinphonePrivate::ChatMessagePrivate* msg); - virtual void decode(LinphonePrivate::ChatMessagePrivate* msg); - virtual ~MultipartChatMessageModifier () = default; - }; - - LINPHONE_END_NAMESPACE - - #endif // ifndef _MULTIPART_CHAT_MESSAGE_MODIFIER_H_ - \ No newline at end of file +#ifndef _MULTIPART_CHAT_MESSAGE_MODIFIER_H_ +#define _MULTIPART_CHAT_MESSAGE_MODIFIER_H_ + +#include "chat-message-modifier.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class MultipartChatMessageModifier : public ChatMessageModifier { +public: + MultipartChatMessageModifier () = default; + + void encode (ChatMessagePrivate *message) override; + void decode (ChatMessagePrivate *message) override; +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _MULTIPART_CHAT_MESSAGE_MODIFIER_H_ diff --git a/src/chat/real-time-text-chat-room.h b/src/chat/real-time-text-chat-room.h index 4c26673d8..1be0f549b 100644 --- a/src/chat/real-time-text-chat-room.h +++ b/src/chat/real-time-text-chat-room.h @@ -37,20 +37,20 @@ public: RealTimeTextChatRoom (LinphoneCore *core, const Address &peerAddress); virtual ~RealTimeTextChatRoom () = default; - void sendMessage (LinphoneChatMessage *msg); + void sendMessage (LinphoneChatMessage *msg) override; uint32_t getChar () const; LinphoneCall *getCall () const; /* ConferenceInterface */ - std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia); - void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia); - bool canHandleParticipants () const; - const std::string& getId () const; - int getNbParticipants () const; - std::list> getParticipants () const; - void removeParticipant (const std::shared_ptr &participant); - void removeParticipants (const std::list> &participants); + std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override; + void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia) override; + bool canHandleParticipants () const override; + const std::string& getId () const override; + int getNbParticipants () const override; + std::list> getParticipants () const override; + void removeParticipant (const std::shared_ptr &participant) override; + void removeParticipants (const std::list> &participants) override; private: L_DECLARE_PRIVATE(RealTimeTextChatRoom); diff --git a/src/conference/conference.h b/src/conference/conference.h index f5746b556..7d5a0af36 100644 --- a/src/conference/conference.h +++ b/src/conference/conference.h @@ -19,9 +19,8 @@ #ifndef _CONFERENCE_H_ #define _CONFERENCE_H_ -#include +#include "linphone/types.h" -#include "object/object.h" #include "address/address.h" #include "call/call-listener.h" #include "conference/conference-interface.h" @@ -29,8 +28,6 @@ #include "conference/participant.h" #include "conference/session/call-session-listener.h" -#include "linphone/types.h" - // ============================================================================= LINPHONE_BEGIN_NAMESPACE @@ -50,30 +47,30 @@ public: public: /* ConferenceInterface */ - virtual std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia); - virtual void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia); - virtual bool canHandleParticipants () const; - virtual const std::string& getId () const; - virtual int getNbParticipants () const; - virtual std::list> getParticipants () const; - virtual void removeParticipant (const std::shared_ptr &participant); - virtual void removeParticipants (const std::list> &participants); + virtual std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override; + virtual void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia) override; + virtual bool canHandleParticipants () const override; + virtual const std::string& getId () const override; + virtual int getNbParticipants () const override; + virtual std::list> getParticipants () const override; + virtual void removeParticipant (const std::shared_ptr &participant) override; + virtual void removeParticipants (const std::list> &participants) override; private: /* CallSessionListener */ - virtual void onAckBeingSent (const CallSession &session, LinphoneHeaders *headers); - virtual void onAckReceived (const CallSession &session, LinphoneHeaders *headers); - virtual void onCallSessionAccepted (const CallSession &session); - virtual void onCallSessionSetReleased (const CallSession &session); - virtual void onCallSessionSetTerminated (const CallSession &session); - virtual void onCallSessionStateChanged (const CallSession &session, LinphoneCallState state, const std::string &message); - virtual void onIncomingCallSessionStarted (const CallSession &session); - virtual void onEncryptionChanged (const CallSession &session, bool activated, const std::string &authToken); - virtual void onStatsUpdated (const LinphoneCallStats *stats); - virtual void onResetCurrentSession (const CallSession &session); - virtual void onSetCurrentSession (const CallSession &session); - virtual void onFirstVideoFrameDecoded (const CallSession &session); - virtual void onResetFirstVideoFrameDecoded (const CallSession &session); + virtual void onAckBeingSent (const CallSession &session, LinphoneHeaders *headers) override; + virtual void onAckReceived (const CallSession &session, LinphoneHeaders *headers) override; + virtual void onCallSessionAccepted (const CallSession &session) override; + virtual void onCallSessionSetReleased (const CallSession &session) override; + virtual void onCallSessionSetTerminated (const CallSession &session) override; + virtual void onCallSessionStateChanged (const CallSession &session, LinphoneCallState state, const std::string &message) override; + virtual void onIncomingCallSessionStarted (const CallSession &session) override; + virtual void onEncryptionChanged (const CallSession &session, bool activated, const std::string &authToken) override; + virtual void onStatsUpdated (const LinphoneCallStats *stats) override; + virtual void onResetCurrentSession (const CallSession &session) override; + virtual void onSetCurrentSession (const CallSession &session) override; + virtual void onFirstVideoFrameDecoded (const CallSession &session) override; + virtual void onResetFirstVideoFrameDecoded (const CallSession &session) override; protected: explicit Conference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr); diff --git a/src/conference/local-conference-event-handler.cpp b/src/conference/local-conference-event-handler.cpp index e5cae32ee..bc84868a2 100644 --- a/src/conference/local-conference-event-handler.cpp +++ b/src/conference/local-conference-event-handler.cpp @@ -20,10 +20,20 @@ #include "conference/participant.h" #include "local-conference-event-handler.h" #include "object/object-p.h" -#include "xml/conference-info.h" #include "private.h" +#if __clang__ || __GNUC__ >= 4 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-override" +#endif + +#include "xml/conference-info.h" + +#if __clang__ || __GNUC__ >= 4 + #pragma GCC diagnostic pop +#endif + // ============================================================================= using namespace std; diff --git a/src/conference/local-conference.h b/src/conference/local-conference.h index 55e3f761c..660081516 100644 --- a/src/conference/local-conference.h +++ b/src/conference/local-conference.h @@ -35,8 +35,14 @@ public: public: /* ConferenceInterface */ - virtual std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia); - virtual void removeParticipant (const std::shared_ptr &participant); + virtual std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override; + virtual void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia) override; + virtual bool canHandleParticipants () const override; + virtual const std::string& getId () const override; + virtual int getNbParticipants () const override; + virtual std::list> getParticipants () const override; + virtual void removeParticipant (const std::shared_ptr &participant) override; + virtual void removeParticipants (const std::list> &participants) override; private: L_DISABLE_COPY(LocalConference); diff --git a/src/conference/params/media-session-params.cpp b/src/conference/params/media-session-params.cpp index 79216feb6..fe65b7be3 100644 --- a/src/conference/params/media-session-params.cpp +++ b/src/conference/params/media-session-params.cpp @@ -218,7 +218,7 @@ void MediaSessionParams::initDefault (LinphoneCore *core) { d->encryption = linphone_core_get_media_encryption(core); d->avpfEnabled = (linphone_core_get_avpf_mode(core) == LinphoneAVPFEnabled); d->_implicitRtcpFbEnabled = lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_fb_implicit_rtcp_fb", true); - d->avpfRrInterval = linphone_core_get_avpf_rr_interval(core); + d->avpfRrInterval = static_cast(linphone_core_get_avpf_rr_interval(core)); d->audioDirection = LinphoneMediaDirectionSendRecv; d->videoDirection = LinphoneMediaDirectionSendRecv; d->earlyMediaSendingEnabled = lp_config_get_int(linphone_core_get_config(core), "misc", "real_early_media", false); diff --git a/src/conference/params/media-session-params.h b/src/conference/params/media-session-params.h index a5f09fdcc..a8fdb1d7a 100644 --- a/src/conference/params/media-session-params.h +++ b/src/conference/params/media-session-params.h @@ -19,10 +19,10 @@ #ifndef _MEDIA_SESSION_PARAMS_H_ #define _MEDIA_SESSION_PARAMS_H_ -#include "call-session-params.h" - #include +#include "call-session-params.h" + // ============================================================================= LINPHONE_BEGIN_NAMESPACE @@ -40,7 +40,7 @@ public: MediaSessionParams (const MediaSessionParams &src); virtual ~MediaSessionParams () = default; - void initDefault (LinphoneCore *core); + void initDefault (LinphoneCore *core) override; bool audioEnabled () const; bool audioMulticastEnabled () const; diff --git a/src/conference/remote-conference-event-handler.cpp b/src/conference/remote-conference-event-handler.cpp index 388a43a55..433465bda 100644 --- a/src/conference/remote-conference-event-handler.cpp +++ b/src/conference/remote-conference-event-handler.cpp @@ -17,10 +17,20 @@ */ #include "remote-conference-event-handler.h" -#include "xml/conference-info.h" #include "private.h" #include "object/object-p.h" +#if __clang__ || __GNUC__ >= 4 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-override" +#endif + +#include "xml/conference-info.h" + +#if __clang__ || __GNUC__ >= 4 + #pragma GCC diagnostic pop +#endif + // ============================================================================= using namespace std; @@ -37,7 +47,7 @@ public: LinphoneEvent *lev = nullptr; }; -// ============================================================================= +// ----------------------------------------------------------------------------- RemoteConferenceEventHandler::RemoteConferenceEventHandler(LinphoneCore *core, ConferenceListener *listener) : Object(*new RemoteConferenceEventHandlerPrivate) { diff --git a/src/conference/session/media-session-p.h b/src/conference/session/media-session-p.h index 79286f99e..210f2df2a 100644 --- a/src/conference/session/media-session-p.h +++ b/src/conference/session/media-session-p.h @@ -45,15 +45,15 @@ public: public: static void stunAuthRequestedCb (void *userData, const char *realm, const char *nonce, const char **username, const char **password, const char **ha1); - void accepted (); - void ackReceived (LinphoneHeaders *headers); - bool failure (); + void accepted () override; + void ackReceived (LinphoneHeaders *headers) override; + bool failure () override; void pausedByRemote (); - void remoteRinging (); + void remoteRinging () override; void resumed (); - void terminated (); + void terminated () override; void updated (bool isUpdate); - void updating (bool isUpdate); + void updating (bool isUpdate) override; void enableSymmetricRtp (bool value); void sendVfu (); @@ -91,11 +91,11 @@ private: static float aggregateQualityRatings (float audioRating, float videoRating); - void setState (LinphoneCallState newState, const std::string &message); + void setState (LinphoneCallState newState, const std::string &message) override; void computeStreamsIndexes (const SalMediaDescription *md); void fixCallParams (SalMediaDescription *rmd); - void initializeParamsAccordingToIncomingCallParams (); + void initializeParamsAccordingToIncomingCallParams () override; void setCompatibleIncomingCallParams (SalMediaDescription *md); void updateBiggestDesc (SalMediaDescription *md); void updateRemoteSessionIdAndVer (); @@ -211,18 +211,18 @@ private: void reportBandwidth (); void reportBandwidthForStream (MediaStream *ms, LinphoneStreamType type); - void abort (const std::string &errorMsg); - void handleIncomingReceivedStateInIncomingNotification (); - bool isReadyForInvite () const; + void abort (const std::string &errorMsg) override; + void handleIncomingReceivedStateInIncomingNotification () override; + bool isReadyForInvite () const override; LinphoneStatus pause (); - void setTerminated (); - LinphoneStatus startAcceptUpdate (LinphoneCallState nextState, const std::string &stateInfo); - LinphoneStatus startUpdate (); - void terminate (); - void updateCurrentParams (); + void setTerminated () override; + LinphoneStatus startAcceptUpdate (LinphoneCallState nextState, const std::string &stateInfo) override; + LinphoneStatus startUpdate () override; + void terminate () override; + void updateCurrentParams () override; void accept (const MediaSessionParams *params); - LinphoneStatus acceptUpdate (const CallSessionParams *csp, LinphoneCallState nextState, const std::string &stateInfo); + LinphoneStatus acceptUpdate (const CallSessionParams *csp, LinphoneCallState nextState, const std::string &stateInfo) override; #ifdef VIDEO_ENABLED void videoStreamEventCb (const MSFilter *f, const unsigned int eventId, const void *args); diff --git a/src/conference/session/media-session.h b/src/conference/session/media-session.h index 589bf1e30..3403746ea 100644 --- a/src/conference/session/media-session.h +++ b/src/conference/session/media-session.h @@ -40,15 +40,15 @@ public: LinphoneStatus accept (const MediaSessionParams *msp = nullptr); LinphoneStatus acceptEarlyMedia (const MediaSessionParams *msp = nullptr); LinphoneStatus acceptUpdate (const MediaSessionParams *msp); - void configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg, SalOp *op, const Address &from, const Address &to); - void initiateIncoming (); - bool initiateOutgoing (); - void iterate (time_t currentRealTime, bool oneSecondElapsed); + void configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg, SalOp *op, const Address &from, const Address &to) override; + void initiateIncoming () override; + bool initiateOutgoing () override; + void iterate (time_t currentRealTime, bool oneSecondElapsed) override; LinphoneStatus pause (); LinphoneStatus resume (); void sendVfuRequest (); - void startIncomingNotification (); - int startInvite (const Address *destination); + void startIncomingNotification () override; + int startInvite (const Address *destination) override; void startRecording (); void stopRecording (); LinphoneStatus update (const MediaSessionParams *msp); @@ -76,7 +76,7 @@ public: RtpTransport * getMetaRtpTransport (int streamIndex); float getMicrophoneVolumeGain () const; void * getNativeVideoWindowId () const; - const CallSessionParams *getParams () const; + const CallSessionParams *getParams () const override; float getPlayVolume () const; float getRecordVolume () const; const MediaSessionParams *getRemoteParams ();