From 3115d8173fcaa11d7fd9177b0fbbf1a88239f858 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 4 Aug 2017 16:24:06 +0200 Subject: [PATCH 01/10] Separate build of objects in the src directory from ones in the coreapi directory. --- CMakeLists.txt | 1 + coreapi/CMakeLists.txt | 31 ++++++------------- src/CMakeLists.txt | 70 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 22 deletions(-) create mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d0ff54e5..17b86bbaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,6 +330,7 @@ endif() add_subdirectory(include) add_subdirectory(java) +add_subdirectory(src) add_subdirectory(coreapi) add_subdirectory(share) if(ENABLE_CONSOLE_UI) diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index 03cf08acb..64284cfb7 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -34,19 +34,7 @@ if(ANDROID) endif() -set(LINPHONE_PRIVATE_HEADER_FILES - ../src/cpim/cpim.h - ../src/cpim/header/cpim-core-headers.h - ../src/cpim/header/cpim-generic-header.h - ../src/cpim/header/cpim-header-p.h - ../src/cpim/header/cpim-header.h - ../src/cpim/message/cpim-message.h - ../src/cpim/parser/cpim-grammar.h - ../src/cpim/parser/cpim-parser.h - ../src/object/object.h - ../src/object/singleton.h - ../src/utils/general.h - ../src/utils/utils.h +list(APPEND LINPHONE_PRIVATE_HEADER_FILES bellesip_sal/sal_impl.h carddav.h conference_private.h @@ -132,13 +120,6 @@ set(LINPHONE_SOURCE_FILES_C vtables.c ) set(LINPHONE_SOURCE_FILES_CXX - ../src/cpim/header/cpim-core-headers.cpp - ../src/cpim/header/cpim-generic-header.cpp - ../src/cpim/header/cpim-header.cpp - ../src/cpim/message/cpim-message.cpp - ../src/cpim/parser/cpim-grammar.cpp - ../src/cpim/parser/cpim-parser.cpp - ../src/utils/utils.cpp conference.cc ) if(ANDROID) @@ -224,7 +205,10 @@ bc_apply_compile_flags(LINPHONE_SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIO bc_apply_compile_flags(LINPHONE_SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC) if(ENABLE_STATIC) - add_library(linphone-static STATIC ${LINPHONE_HEADER_FILES} ${LINPHONE_PRIVATE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC}) + add_library(linphone-static STATIC ${LINPHONE_HEADER_FILES} ${LINPHONE_PRIVATE_HEADER_FILES} + ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC} + $ + ) set_target_properties(linphone-static PROPERTIES OUTPUT_NAME linphone) add_dependencies(linphone-static liblinphone-git-version) target_include_directories(linphone-static PUBLIC ${LINPHONE_INCLUDE_DIRS}) @@ -241,7 +225,10 @@ if(ENABLE_STATIC) ) endif() if(ENABLE_SHARED) - add_library(linphone SHARED ${LINPHONE_HEADER_FILES} ${LINPHONE_PRIVATE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC}) + add_library(linphone SHARED ${LINPHONE_HEADER_FILES} ${LINPHONE_PRIVATE_HEADER_FILES} + ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC} + $ + ) if(IOS) if(IOS) set(MIN_OS ${LINPHONE_IOS_DEPLOYMENT_TARGET}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..d886ea863 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,70 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2017 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ + +set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES + cpim/cpim.h + cpim/header/cpim-core-headers.h + cpim/header/cpim-generic-header.h + cpim/header/cpim-header-p.h + cpim/header/cpim-header.h + cpim/message/cpim-message.h + cpim/parser/cpim-grammar.h + cpim/parser/cpim-parser.h + object/object.h + object/singleton.h + utils/general.h + utils/utils.h +) + +set(LINPHONE_CXX_OBJECTS_SOURCE_FILES + cpim/header/cpim-core-headers.cpp + cpim/header/cpim-generic-header.cpp + cpim/header/cpim-header.cpp + cpim/message/cpim-message.cpp + cpim/parser/cpim-grammar.cpp + cpim/parser/cpim-parser.cpp + utils/utils.cpp +) + +set(LINPHONE_CXX_OBJECTS_DEFINITIONS "-DLIBLINPHONE_EXPORTS") +set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${BELR_INCLUDE_DIRS}) + +set(LINPHONE_PRIVATE_HEADER_FILES) +foreach(header ${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES}) + list(APPEND LINPHONE_PRIVATE_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${header}") +endforeach() +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}) + target_compile_definitions(linphone-cxx-objects-static PRIVATE ${LINPHONE_CXX_OBJECTS_DEFINITIONS}) + target_include_directories(linphone-cxx-objects-static PRIVATE ${LINPHONE_CXX_OBJECTS_INCLUDE_DIRS}) +endif() + +if(ENABLE_SHARED) + 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 PRIVATE ${LINPHONE_CXX_OBJECTS_INCLUDE_DIRS}) + target_compile_options(linphone-cxx-objects PRIVATE "-fPIC") +endif() From bcb6128c457a50d8f1157c17dee378efa68553d6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 7 Aug 2017 11:34:15 +0200 Subject: [PATCH 02/10] Fix stun server selection based on looking for AI_V4MAPPED flag --- coreapi/misc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/misc.c b/coreapi/misc.c index 6d0f4819f..fe10698aa 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -579,6 +579,7 @@ static const struct addrinfo * find_nat64_addrinfo(const struct addrinfo *ai) { static const struct addrinfo * find_ipv4_addrinfo(const struct addrinfo *ai) { while (ai != NULL) { if (ai->ai_family == AF_INET) break; + if (ai->ai_family == AF_INET6 && ai->ai_flags & AI_V4MAPPED) break; ai = ai->ai_next; } return ai; From 354cd06933ab778dabc8a175b55fec9901475b81 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 7 Aug 2017 11:58:00 +0200 Subject: [PATCH 03/10] fix compilation issue with g++ 5 --- src/cpim/header/cpim-generic-header.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cpim/header/cpim-generic-header.cpp b/src/cpim/header/cpim-generic-header.cpp index 178cfbb27..178063797 100644 --- a/src/cpim/header/cpim-generic-header.cpp +++ b/src/cpim/header/cpim-generic-header.cpp @@ -32,8 +32,10 @@ using namespace LinphonePrivate; class Cpim::GenericHeaderPrivate : public HeaderPrivate { public: + GenericHeaderPrivate() : parameters(make_shared< list< pair > >()){ + } string name; - shared_ptr > > parameters = make_shared > >(); + shared_ptr > > parameters; }; Cpim::GenericHeader::GenericHeader () : Header(*new GenericHeaderPrivate) {} From 3c446b7695e44c4519a4f5216105188779907333 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 8 Aug 2017 11:25:58 +0200 Subject: [PATCH 04/10] disable keep-uuid because the bug was actually in Flexisip --- tester/message_tester.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tester/message_tester.c b/tester/message_tester.c index c7a7156cb..cff9645fc 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -2492,12 +2492,12 @@ test_t message_tests[] = { }; static int message_tester_before_suite(void) { - liblinphone_tester_keep_uuid = TRUE; + //liblinphone_tester_keep_uuid = TRUE; return 0; } static int message_tester_after_suite(void) { - liblinphone_tester_keep_uuid = FALSE; + //liblinphone_tester_keep_uuid = FALSE; return 0; } From a396e8919a556e6c23ef59113a7159f9ccb449ab Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Wed, 9 Aug 2017 09:25:52 +0200 Subject: [PATCH 05/10] fix(Singleton): delete properly instance at program termination --- src/cpim/header/cpim-generic-header.cpp | 4 ++-- src/object/singleton.h | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/cpim/header/cpim-generic-header.cpp b/src/cpim/header/cpim-generic-header.cpp index 178063797..6c043c55d 100644 --- a/src/cpim/header/cpim-generic-header.cpp +++ b/src/cpim/header/cpim-generic-header.cpp @@ -32,8 +32,8 @@ using namespace LinphonePrivate; class Cpim::GenericHeaderPrivate : public HeaderPrivate { public: - GenericHeaderPrivate() : parameters(make_shared< list< pair > >()){ - } + GenericHeaderPrivate () : parameters(make_shared > >()) {} + string name; shared_ptr > > parameters; }; diff --git a/src/object/singleton.h b/src/object/singleton.h index 6acad3c6d..16e16d471 100644 --- a/src/object/singleton.h +++ b/src/object/singleton.h @@ -30,8 +30,10 @@ namespace LinphonePrivate { virtual ~Singleton () = default; static T *getInstance () { - if (!mInstance) + if (!mInstance) { mInstance = new T(); + static SingletonDeleter deleter; + } return mInstance; } @@ -39,6 +41,12 @@ namespace LinphonePrivate { explicit Singleton (ObjectPrivate &p) : Object(p) {} private: + struct SingletonDeleter { + ~SingletonDeleter () { + delete mInstance; + } + }; + static T *mInstance; L_DISABLE_COPY(Singleton); From 8c97e0c5e7096e69cf5d904ef240342678ad2b95 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 9 Aug 2017 10:27:24 +0200 Subject: [PATCH 06/10] Moved key related methods on LinphoneContent from private to public header --- coreapi/private.h | 21 --------------------- include/linphone/content.h | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/coreapi/private.h b/coreapi/private.h index a43cb2713..83d1d14c2 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -1946,27 +1946,6 @@ SalStreamDir sal_dir_from_call_params_dir(LinphoneMediaDirection cpdir); /***************************************************************************** * LINPHONE CONTENT PRIVATE ACCESSORS * ****************************************************************************/ -/** - * Get the key associated with a RCS file transfer message if encrypted - * @param[in] content LinphoneContent object. - * @return The key to encrypt/decrypt the file associated to this content. - */ -LINPHONE_PUBLIC const char *linphone_content_get_key(const LinphoneContent *content); - -/** - * Get the size of key associated with a RCS file transfer message if encrypted - * @param[in] content LinphoneContent object. - * @return The key size in bytes - */ -size_t linphone_content_get_key_size(const LinphoneContent *content); - -/** - * Set the key associated with a RCS file transfer message if encrypted - * @param[in] content LinphoneContent object. - * @param[in] key The key to be used to encrypt/decrypt file associated to this content. - * @param[in] keyLength The lengh of the key. - */ -void linphone_content_set_key(LinphoneContent *content, const char *key, const size_t keyLength); /** * Get the address of the crypto context associated with a RCS file transfer message if encrypted diff --git a/include/linphone/content.h b/include/linphone/content.h index c91a15559..653d4344a 100644 --- a/include/linphone/content.h +++ b/include/linphone/content.h @@ -192,6 +192,28 @@ LINPHONE_PUBLIC LinphoneContent * linphone_content_find_part_by_header(const Lin */ LINPHONE_PUBLIC const char * linphone_content_get_custom_header(const LinphoneContent *content, const char *header_name); +/** + * Get the key associated with a RCS file transfer message if encrypted + * @param[in] content LinphoneContent object. + * @return The key to encrypt/decrypt the file associated to this content. + */ +LINPHONE_PUBLIC const char *linphone_content_get_key(const LinphoneContent *content); + +/** + * Get the size of key associated with a RCS file transfer message if encrypted + * @param[in] content LinphoneContent object. + * @return The key size in bytes + */ +LINPHONE_PUBLIC size_t linphone_content_get_key_size(const LinphoneContent *content); + +/** + * Set the key associated with a RCS file transfer message if encrypted + * @param[in] content LinphoneContent object. + * @param[in] key The key to be used to encrypt/decrypt file associated to this content. + * @param[in] keyLength The lengh of the key. + */ +LINPHONE_PUBLIC void linphone_content_set_key(LinphoneContent *content, const char *key, const size_t keyLength); + /** * @} */ From 00d1d98378003cb5d9dbff2f617f926da2ffa795 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 10 Aug 2017 10:25:36 +0200 Subject: [PATCH 07/10] fix(cpim): export symbols on Windows --- src/cpim/header/cpim-core-headers.h | 6 +++--- src/cpim/header/cpim-generic-header.h | 2 +- src/cpim/header/cpim-header.h | 2 +- src/cpim/message/cpim-message.h | 2 +- src/object/object.h | 2 +- src/utils/general.h | 18 ++++++++++++++++++ 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/cpim/header/cpim-core-headers.h b/src/cpim/header/cpim-core-headers.h index 965904908..3ff1deecd 100644 --- a/src/cpim/header/cpim-core-headers.h +++ b/src/cpim/header/cpim-core-headers.h @@ -24,7 +24,7 @@ // ============================================================================= #define MAKE_CORE_HEADER(CLASS_PREFIX, NAME) \ - class CLASS_PREFIX ## Header : public CoreHeader { \ + class LINPHONE_PUBLIC CLASS_PREFIX ## Header : public CoreHeader { \ public: \ CLASS_PREFIX ## Header() = default; \ inline std::string getName() const override { \ @@ -43,7 +43,7 @@ namespace LinphonePrivate { // Generic core header. // ------------------------------------------------------------------------- - class CoreHeader : public Header { + class LINPHONE_PUBLIC CoreHeader : public Header { friend class HeaderNode; public: @@ -79,7 +79,7 @@ namespace LinphonePrivate { class SubjectHeaderPrivate; - class SubjectHeader : public CoreHeader { + class LINPHONE_PUBLIC SubjectHeader : public CoreHeader { friend class HeaderNode; public: diff --git a/src/cpim/header/cpim-generic-header.h b/src/cpim/header/cpim-generic-header.h index fb1a198cf..94ced0e44 100644 --- a/src/cpim/header/cpim-generic-header.h +++ b/src/cpim/header/cpim-generic-header.h @@ -31,7 +31,7 @@ namespace LinphonePrivate { class GenericHeaderPrivate; class HeaderNode; - class GenericHeader : public Header { + class LINPHONE_PUBLIC GenericHeader : public Header { friend class HeaderNode; public: diff --git a/src/cpim/header/cpim-header.h b/src/cpim/header/cpim-header.h index 3dbcb2fbe..1839d3afa 100644 --- a/src/cpim/header/cpim-header.h +++ b/src/cpim/header/cpim-header.h @@ -29,7 +29,7 @@ namespace LinphonePrivate { namespace Cpim { class HeaderPrivate; - class Header : public Object { + class LINPHONE_PUBLIC Header : public Object { public: virtual ~Header () = default; diff --git a/src/cpim/message/cpim-message.h b/src/cpim/message/cpim-message.h index 2620fe336..fe8d0d03f 100644 --- a/src/cpim/message/cpim-message.h +++ b/src/cpim/message/cpim-message.h @@ -28,7 +28,7 @@ namespace LinphonePrivate { namespace Cpim { class MessagePrivate; - class Message : public Object { + class LINPHONE_PUBLIC Message : public Object { public: Message (); diff --git a/src/object/object.h b/src/object/object.h index 76ae2d67f..18c39489d 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -37,7 +37,7 @@ namespace LinphonePrivate { L_DECLARE_PUBLIC(Object); }; - class Object { + class LINPHONE_PUBLIC Object { public: virtual ~Object () { delete mPrivate; diff --git a/src/utils/general.h b/src/utils/general.h index 0fc5afe6f..e0a8ed7f6 100644 --- a/src/utils/general.h +++ b/src/utils/general.h @@ -21,6 +21,24 @@ #ifndef _GENERAL_H_ #define _GENERAL_H_ +#ifndef LINPHONE_PUBLIC + #if defined(_MSC_VER) + #ifdef LINPHONE_STATIC + #define LINPHONE_PUBLIC + #else + #ifdef LINPHONE_EXPORTS + #define LINPHONE_PUBLIC __declspec(dllexport) + #else + #define LINPHONE_PUBLIC __declspec(dllimport) + #endif + #endif + #else + #define LINPHONE_PUBLIC + #endif +#endif + +// ----------------------------------------------------------------------------- + #define L_DECLARE_PRIVATE(CLASS) \ inline CLASS ## Private * getPrivate() { \ return reinterpret_cast(mPrivate); \ From bdd7869387fb3885098bb8efc14e292d8b006981 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 10 Aug 2017 10:36:22 +0200 Subject: [PATCH 08/10] fix(sal): export `sal_create_uuid` on Windows --- include/sal/sal.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/sal/sal.h b/include/sal/sal.h index 4a566e157..f41c09336 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -346,7 +346,7 @@ int sal_media_description_get_nb_active_streams(const SalMediaDescription *md); struct SalOpBase; typedef void (*SalOpReleaseCb)(struct SalOpBase *op); - + /*this structure must be at the first byte of the SalOp structure defined by implementors*/ typedef struct SalOpBase{ Sal *root; @@ -658,7 +658,7 @@ void sal_verify_server_certificates(Sal *ctx, bool_t verify); void sal_verify_server_cn(Sal *ctx, bool_t verify); void sal_set_ssl_config(Sal *ctx, void *ssl_config); LINPHONE_PUBLIC void sal_set_uuid(Sal*ctx, const char *uuid); -int sal_create_uuid(Sal*ctx, char *uuid, size_t len); +LINPHONE_PUBLIC int sal_create_uuid(Sal*ctx, char *uuid, size_t len); int sal_generate_uuid(char *uuid, size_t len); LINPHONE_PUBLIC void sal_enable_test_features(Sal*ctx, bool_t enabled); void sal_use_no_initial_route(Sal *ctx, bool_t enabled); @@ -963,5 +963,3 @@ int sal_get_http_proxy_port(const Sal *sal); #endif #endif - - From f5c98467bad8bda8e28f4326bf357395c8d490f5 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 10 Aug 2017 11:34:08 +0200 Subject: [PATCH 09/10] feat(object): ObjectPrivate is now in object-p.h --- src/CMakeLists.txt | 2 ++ src/cpim/header/cpim-header-p.h | 1 + src/cpim/message/cpim-message.cpp | 1 + src/cpim/parser/cpim-parser.cpp | 1 + src/object/object-p.h | 41 +++++++++++++++++++++++++++++++ src/object/object.cpp | 33 +++++++++++++++++++++++++ src/object/object.h | 21 +++------------- 7 files changed, 82 insertions(+), 18 deletions(-) create mode 100644 src/object/object-p.h create mode 100644 src/object/object.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d886ea863..bf1e95202 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,6 +30,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES cpim/parser/cpim-grammar.h cpim/parser/cpim-parser.h object/object.h + object/object-p.h object/singleton.h utils/general.h utils/utils.h @@ -42,6 +43,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES cpim/message/cpim-message.cpp cpim/parser/cpim-grammar.cpp cpim/parser/cpim-parser.cpp + object/object.cpp utils/utils.cpp ) diff --git a/src/cpim/header/cpim-header-p.h b/src/cpim/header/cpim-header-p.h index 2e3208dd4..446e98647 100644 --- a/src/cpim/header/cpim-header-p.h +++ b/src/cpim/header/cpim-header-p.h @@ -20,6 +20,7 @@ #define _CPIM_HEADER_P_H_ #include "cpim-header.h" +#include "object/object-p.h" // ============================================================================= diff --git a/src/cpim/message/cpim-message.cpp b/src/cpim/message/cpim-message.cpp index af1e06209..7eab6fea0 100644 --- a/src/cpim/message/cpim-message.cpp +++ b/src/cpim/message/cpim-message.cpp @@ -19,6 +19,7 @@ #include #include "cpim/parser/cpim-parser.h" +#include "object/object-p.h" #include "utils/utils.h" #include "cpim-message.h" diff --git a/src/cpim/parser/cpim-parser.cpp b/src/cpim/parser/cpim-parser.cpp index 8d2a88e97..8c637fcb4 100644 --- a/src/cpim/parser/cpim-parser.cpp +++ b/src/cpim/parser/cpim-parser.cpp @@ -24,6 +24,7 @@ #include "linphone/core.h" #include "cpim-grammar.h" +#include "object/object-p.h" #include "utils/utils.h" #include "cpim-parser.h" diff --git a/src/object/object-p.h b/src/object/object-p.h new file mode 100644 index 000000000..f08a6b968 --- /dev/null +++ b/src/object/object-p.h @@ -0,0 +1,41 @@ +/* + * object-p.h + * Copyright (C) 2017 Belledonne Communications SARL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _OBJECT_P_H_ +#define _OBJECT_P_H_ + +#include "utils/general.h" + +// ============================================================================= + +namespace LinphonePrivate { + class Object; + + class ObjectPrivate { + public: + virtual ~ObjectPrivate () = default; + + protected: + Object *mPublic = nullptr; + + private: + L_DECLARE_PUBLIC(Object); + }; +} + +#endif // ifndef _OBJECT_P_H_ diff --git a/src/object/object.cpp b/src/object/object.cpp new file mode 100644 index 000000000..a4c0a5a34 --- /dev/null +++ b/src/object/object.cpp @@ -0,0 +1,33 @@ +/* + * object.cpp + * Copyright (C) 2017 Belledonne Communications SARL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "object-p.h" + +#include "object.h" + +using namespace LinphonePrivate; + +// ============================================================================= + +Object::~Object () { + delete mPrivate; +} + +Object::Object (ObjectPrivate &p) : mPrivate(&p) { + mPrivate->mPublic = this; +} diff --git a/src/object/object.h b/src/object/object.h index 18c39489d..5756bcc8e 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -24,29 +24,14 @@ // ============================================================================= namespace LinphonePrivate { - class Object; - - class ObjectPrivate { - public: - virtual ~ObjectPrivate () = default; - - protected: - Object *mPublic = nullptr; - - private: - L_DECLARE_PUBLIC(Object); - }; + class ObjectPrivate; class LINPHONE_PUBLIC Object { public: - virtual ~Object () { - delete mPrivate; - } + virtual ~Object (); protected: - explicit Object (ObjectPrivate &p) : mPrivate(&p) { - mPrivate->mPublic = this; - } + explicit Object (ObjectPrivate &p); ObjectPrivate *mPrivate = nullptr; From c94f5a11a3d6f9680b39ecdbcc284b016966bc1c Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 10 Aug 2017 12:30:01 +0200 Subject: [PATCH 10/10] Add missing include directies for src. --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf1e95202..f02e12816 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -61,12 +61,12 @@ bc_apply_compile_flags(LINPHONE_CXX_OBJECTS_SOURCE_FILES STRICT_OPTIONS_CPP STRI if(ENABLE_STATIC) 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 PRIVATE ${LINPHONE_CXX_OBJECTS_INCLUDE_DIRS}) + target_include_directories(linphone-cxx-objects-static 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}) target_compile_definitions(linphone-cxx-objects PRIVATE ${LINPHONE_CXX_OBJECTS_DEFINITIONS}) - target_include_directories(linphone-cxx-objects PRIVATE ${LINPHONE_CXX_OBJECTS_INCLUDE_DIRS}) + target_include_directories(linphone-cxx-objects PRIVATE ${LINPHONE_CXX_OBJECTS_INCLUDE_DIRS} ${LINPHONE_INCLUDE_DIRS}) target_compile_options(linphone-cxx-objects PRIVATE "-fPIC") endif()