Commit 81688335 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Merge branch 'dev_refactor_cpp'

parents bb8c1866 47b12a26
......@@ -35,24 +35,23 @@ string(REGEX REPLACE "([a-zA-Z_]+)\\.po" "\\1" LINPHONE_ALL_LANGS_LIST "${LINPHO
string(REPLACE ";" " " LINPHONE_ALL_LANGS "${LINPHONE_ALL_LANGS_LIST}")
include(CMakeDependentOption)
include(cmake/Tools.cmake)
option(ENABLE_SHARED "Build shared library." YES)
option(ENABLE_STATIC "Build static library." YES)
option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." YES)
option(ENABLE_CSHARP_WRAPPER "Build the C# wrapper for Liblinphone." OFF)
option(ENABLE_JAVA_WRAPPER "Build the Java wrapper for Liblinphone." OFF)
option(ENABLE_CXX_WRAPPER "Build the C++ wrapper for Liblinphone." YES)
option(ENABLE_DAEMON "Enable the linphone daemon interface." YES)
option(ENABLE_DATE "Use build date in internal version number." NO)
option(ENABLE_DEBUG_LOGS "Turn on or off debug level logs." NO)
option(ENABLE_DOC "Enable documentation generation with Doxygen." YES)
option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." NO)
option(ENABLE_DOC "Enable API documentation generation." NO)
option(ENABLE_JAVADOC "Add a target to generate documentation for Java API" NO)
option(ENABLE_LDAP "Enable LDAP support." NO)
option(ENABLE_NLS "Build with internationalisation support" YES)
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
option(ENABLE_ROOTCA_DOWNLOAD "Download rootca.pem at build time." YES)
option(ENABLE_SOCI_STORAGE "Turn on compilation soci storage, for messages, contacts, history" YES)
option(ENABLE_SQLITE_STORAGE "Turn on compilation sqlite storage, for messages, contacts, history" YES)
option(ENABLE_STRICT "Build with strict compile options." YES)
option(ENABLE_TOOLS "Turn on or off compilation of tools." YES)
......@@ -66,14 +65,16 @@ option(ENABLE_VIDEO "Build with video support." YES)
cmake_dependent_option(ENABLE_LIME "Enable Instant Messaging Encryption." YES "ENABLE_SQLITE_STORAGE" NO)
cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI;NOT APPLE" NO)
cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
cmake_dependent_option(ENABLE_SPHINX_DOC "Turn on the generation of the multi-language API documentation based on Sphinx." NO "ENABLE_DOC" NO)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS NO)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions("-DDEBUG")
endif()
if(ENABLE_STATIC)
set(LINPHONE_LIBS_FOR_TOOLS linphone-static)
......@@ -89,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})
......@@ -132,6 +134,7 @@ else()
find_package(Belr REQUIRED)
endif()
find_package(XML2 REQUIRED)
find_package(LibXsd REQUIRED)
find_package(Soci)
find_package(ZLIB)
if(ENABLE_TUNNEL)
......@@ -157,32 +160,9 @@ if(ENABLE_NOTIFY)
set(ENABLE_NOTIFY OFF CACHE BOOL "Enable libnotify support." FORCE)
endif()
endif()
if(ENABLE_GTK_UI)
if(WIN32)
set(GTK2_ADDITIONAL_SUFFIXES "../lib/glib-2.0/include" "../lib/gtk-2.0/include")
endif()
find_package(GTK2 2.18 REQUIRED gtk)
if(ENABLE_ASSISTANT AND GTK2_VERSION VERSION_LESS 2.22)
message(WARNING "You need at least GTK 2.22 to enable the assistant")
set(ENABLE_ASSISTANT OFF CACHE BOOL "Turn on assistant compiling." FORCE)
endif()
if(APPLE)
find_package(GtkMacIntegration)
if(GTKMACINTEGRATION_FOUND)
set(HAVE_GTK_OSX 1)
add_definitions("${GTKMACINTEGRATION_CPPFLAGS}")
else()
message(WARNING "gtk-mac-integration not found. Please install gtk-osx-application package.")
endif()
endif()
endif()
if(ENABLE_ASSISTANT)
set(BUILD_WIZARD 1)
endif()
if(ENABLE_NLS)
find_package(Gettext REQUIRED)
find_package(Intl REQUIRED)
endif()
if(ENABLE_LIME)
#bzrtp is only required for LIME
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
......@@ -192,8 +172,15 @@ if(ENABLE_LIME)
endif()
set(HAVE_LIME 1)
endif()
if(ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_SPHINX_DOC)
if(ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_JAVA_WRAPPER OR ENABLE_DOC)
find_package(PythonInterp REQUIRED)
check_python_module(pystache)
check_python_module(six)
if(ENABLE_DOC)
check_python_module(sphinx)
check_python_module(javasphinx)
check_python_module(sphinx_csharp)
endif()
endif()
if(UNIX AND NOT APPLE)
......@@ -201,9 +188,22 @@ if(UNIX AND NOT APPLE)
check_include_files(libudev.h HAVE_LIBUDEV_H)
endif()
if(MSVC AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
find_library(LIBGCC NAMES gcc)
find_library(LIBMINGWEX NAMES mingwex)
endif()
if(NOT WIN32)
find_package(Iconv QUIET)
endif()
if(ANDROID)
find_package(CpuFeatures REQUIRED)
find_package(Support REQUIRED)
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
......@@ -254,7 +254,6 @@ if(MSVC)
include_directories(${MSVC_INCLUDE_DIR})
endif()
add_definitions("-DLINPHONE_EXPORTS")
set(LINPHONE_CPPFLAGS ${BELCARD_CPPFLAGS} ${BELLESIP_CPPFLAGS} ${MEDIASTREAMER2_CPPFLAGS} ${BCTOOLBOX_CPPFLAGS} ${BELR_CPPFLAGS})
if(ENABLE_STATIC)
list(APPEND LINPHONE_CPPFLAGS "-DLINPHONE_STATIC")
......@@ -268,6 +267,11 @@ if(ENABLE_DEBUG_LOGS)
add_definitions("-DDEBUG_LOGS")
endif()
# Enable stdint.h limit macros on C++ files. (Windows only.)
if(MSVC)
add_definitions("-D__STDC_LIMIT_MACROS")
endif()
set(STRICT_OPTIONS_CPP )
set(STRICT_OPTIONS_C )
set(STRICT_OPTIONS_CXX )
......@@ -279,7 +283,26 @@ 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"
"-Wpointer-arith"
"-Wuninitialized"
"-Wunused"
)
list(APPEND STRICT_OPTIONS_CXX
"-Wnon-virtual-dtor"
"-Woverloaded-virtual"
)
CHECK_CXX_COMPILER_FLAG("-Wsuggest-override" SUGGEST_OVERRIDE)
if (SUGGEST_OVERRIDE)
list(APPEND STRICT_OPTIONS_CXX "-Wsuggest-override" "-Wno-error=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")
......@@ -305,7 +328,6 @@ if(STRICT_OPTIONS_C)
list(REMOVE_DUPLICATES STRICT_OPTIONS_C)
endif()
set(GETTEXT_PACKAGE "linphone")
if(ENABLE_RELATIVE_PREFIX)
set(LINPHONE_DATA_DIR ".")
......@@ -318,6 +340,7 @@ if(WIN32)
endif()
set(PACKAGE_LOCALE_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}/locale")
set(PACKAGE_DATA_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}")
set(PACKAGE_GRAMMAR_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}/belr/grammars")
set(PACKAGE_SOUND_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}/sounds/linphone")
set(PACKAGE_RING_DIR "${PACKAGE_SOUND_DIR}/rings")
set(PACKAGE_FREEDESKTOP_DIR "${PACKAGE_DATA_DIR}/applications")
......@@ -339,8 +362,11 @@ endif()
add_subdirectory(include)
add_subdirectory(java)
add_subdirectory(src)
if(ENABLE_JAVA_WRAPPER)
add_subdirectory(wrappers/java)
endif()
add_subdirectory(coreapi)
add_subdirectory(src)
add_subdirectory(share)
if(ENABLE_CONSOLE_UI)
add_subdirectory(console)
......@@ -348,11 +374,6 @@ endif()
if(ENABLE_DAEMON)
add_subdirectory(daemon)
endif()
if(ENABLE_GTK_UI)
add_subdirectory(gtk)
add_subdirectory(pixmaps)
add_subdirectory(po)
endif()
if(ENABLE_TOOLS)
add_subdirectory(tools)
endif()
......
......@@ -13,19 +13,22 @@ Building liblinphone
### Required dependencies
* *BcToolbox[2]*: portability layer
* *BelleSIP[3]*: SIP stack
* *Mediastreamer2[4]*: multimedia engine
* *Belcard[5]*: VCard support
* libxml2
* zlib
* libsqlite3: user data storage (disablable)
* gettext and libintl: internationalization support (disablable)
* **BcToolbox[2]:** portability layer
* **BelleSIP[3]:** SIP stack
* **Mediastreamer2[4]:** multimedia engine
* **Belcard[5]:** VCard support
* **libxml2**
* **zlib**
* **libsqlite3:** user data storage (disablable)
* **gettext** and **libintl**: internationalization support (disablable)
* **python interpreter** and **pystache**, **six** python module (needed for C++ wrapper and API documentaiton)
* **doxygen** and **dot** (needed for C++ wrapper and API documentation)
### Opitonal dependencies
* *Bzrtp[6]*: zrtp stack used for Linphone Instant Messaging Encryption
* **Bzrtp[6]**: zrtp stack used for Linphone Instant Messaging Encryption.
* For API documentatino generation: **sphinx**, **javasphinx**, **sphinx_csharp** python modules are needed.
### Build instructions
......@@ -38,18 +41,17 @@ Building liblinphone
### Supported build opitons
* `CMAKE_INSTALL_PREFIX=<string>` : install prefix
* `CMAKE_PREFIX_PATH=<string>` : column-separated list of prefixes where to search for dependencies
* `ENABLE_SHARED=NO` : do not build the shared library
* `ENABLE_STATIC=NO` : do not build the static library
* `ENABLE_STRICT=NO` : build without strict compilation flags (-Wall -Werror)
* `ENABLE_DOC=NO` : do not generate the reference documentation of liblinphone
* `ENABLE_UNIT_TESTS=NO` : do not build testing binaries
* `ENABLE_VCARD=NO` : disable VCard support
* `ENABLE_SQLITE_STORAGE=NO` : disable SQlite user data storage (message, history, contacts list)
* `ENABLE_TOOLS=NO` : do not build tool binaries
* `ENABLE_NLS=NO` : disable internationalization
* `ENABLE_LIME=YES` : disable Linphone Instant Messaging Encryption
* **`CMAKE_INSTALL_PREFIX=<string>`** : install prefix
* **`CMAKE_PREFIX_PATH=<string>`** : column-separated list of prefixes where to search for dependencies
* **`ENABLE_SHARED=NO`** : do not build the shared library
* **`ENABLE_STATIC=NO`** : do not build the static library
* **`ENABLE_STRICT=NO`** : build without strict compilation flags (-Wall -Werror)
* **`ENABLE_DOC=YES`** : Make the reference documentation of liblinphone to generated
* **`ENABLE_UNIT_TESTS=NO`** : do not build testing binaries
* **`ENABLE_VCARD=NO`** : disable VCard support
* **`ENABLE_SQLITE_STORAGE=NO`** : disable SQlite user data storage (message, history, contacts list)
* **`ENABLE_TOOLS=NO`** : do not build tool binaries
* **`ENABLE_LIME=YES`** : disable Linphone Instant Messaging Encryption
### Note for packagers
......@@ -92,4 +94,4 @@ Here is a short description of the content of the source tree.
- [3] belle-sip: git://git.linphone.org/belle-sip.git *or* <https://www.linphone.org/releases/sources/belle-sip>
- [4] mediastreamer2: git://git.linphone.org/mediastreamer2.git *or* <https://www.linphone.org/releases/sources/mediastreamer>
- [5] belcard: git://git.linphone.org/belcard.git *or* <https://www.linphone.org/releases/sources/belcard>
- [5] bzrtp: git://git.linphone.org/bzrtp.git *or* <https://www.linphone.org/releases/sources/bzrtp>
- [6] bzrtp: git://git.linphone.org/bzrtp.git *or* <https://www.linphone.org/releases/sources/bzrtp>
......@@ -30,9 +30,13 @@ Requires: %{pkg_prefix}bctoolbox
Requires: %{pkg_prefix}ortp
Requires: %{pkg_prefix}mediastreamer
Requires: %{pkg_prefix}belle-sip
Requires: %{pkg_prefix}belr
%if @ENABLE_VCARD@
Requires: %{pkg_prefix}belcard
%endif
%if @ENABLE_SOCI_STORAGE@
Requires: %{pkg_prefix}soci
%endif
%description
liblinphone is the voip sdk used by Linphone
......@@ -116,6 +120,7 @@ rm -rf $RPM_BUILD_ROOT
%endif
%{_datadir}/Linphone/cmake/*.cmake
%{_datadir}/LinphoneCxx/cmake/*.cmake
%{_datadir}/belr/grammars/cpim_grammar
%changelog
......
############################################################################
# FindIntl.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
# FindLibXsd.cmake
# Copyright (C) 2017 Belledonne Communications, Grenoble France
#
############################################################################
#
......@@ -20,37 +20,29 @@
#
############################################################################
#
# - Find the libintl include file and library
# - Find the libxsd library
#
# INTL_FOUND - system has libintl
# INTL_INCLUDE_DIRS - the libintl include directory
# INTL_LIBRARIES - The libraries needed to use libintl
# LIBXSD_FOUND - system has libxsd
# LIBXSD_INCLUDE_DIRS - the libxsd include directory
# LIBXSD_LIBRARIES - The libraries needed to use libxsd
set(_INTL_ROOT_PATHS
${CMAKE_INSTALL_PREFIX}
)
find_path(INTL_INCLUDE_DIRS
NAMES libintl.h
HINTS _INTL_ROOT_PATHS
find_package(XercesC)
find_path(LIBXSD_INCLUDE_DIRS
NAMES xsd/cxx/config.hxx
PATH_SUFFIXES include
)
if(INTL_INCLUDE_DIRS)
set(HAVE_LIBINTL_H 1)
endif()
set(INTL_ARGS INTL_INCLUDE_DIRS HAVE_LIBINTL_H)
if(NOT UNIX OR APPLE)
find_library(INTL_LIBRARIES
NAMES intl
HINTS ${_INTL_ROOT_PATHS}
PATH_SUFFIXES bin lib
)
list(APPEND INTL_ARGS INTL_LIBRARIES)
if(LIBXSD_INCLUDE_DIRS)
list(APPEND LIBXSD_INCLUDE_DIRS ${XercesC_INCLUDE_DIRS})
endif()
set(LIBXSD_LIBRARIES ${XercesC_LIBRARIES})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Intl DEFAULT_MSG ${INTL_ARGS})
find_package_handle_standard_args(LibXsd
DEFAULT_MSG
LIBXSD_INCLUDE_DIRS LIBXSD_LIBRARIES
)
mark_as_advanced(${INTL_ARGS})
mark_as_advanced(LIBXSD_INCLUDE_DIRS LIBXSD_LIBRARIES)
......@@ -25,6 +25,7 @@
#
SET(_SOCI_ALL_PLUGINS mysql sqlite3)
SET(_SOCI_REQUIRED_VARS SOCI_INCLUDE_DIRS SOCI_LIBRARIES)
SET(_SOCI_VERSION "_4_0")
#
### FIRST STEP: Find the soci headers.
......@@ -37,7 +38,7 @@ MARK_AS_ADVANCED(SOCI_INCLUDE_DIRS)
### SECOND STEP: Find the soci core library. Respect LIB_SUFFIX
#
FIND_LIBRARY(SOCI_LIBRARIES
NAMES soci_core
NAMES soci_core soci_core${_SOCI_VERSION}
PATH_SUFFIXES lib lib64)
MARK_AS_ADVANCED(SOCI_LIBRARIES)
......@@ -54,13 +55,17 @@ IF(SOCI_INCLUDE_DIRS AND SOCI_LIBRARIES)
FIND_LIBRARY(
SOCI_${plugin}_PLUGIN
NAMES soci_${plugin}
NAMES soci_${plugin} soci_${plugin}${_SOCI_VERSION}
PATH_SUFFIXES lib lib64)
MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN)
IF(SOCI_${plugin}_PLUGIN)
MESSAGE(STATUS " * Plugin ${plugin} found ${SOCI_${plugin}_PLUGIN}.")
SET(SOCI_${plugin}_FOUND True)
if(IOS OR ANDROID)
list(APPEND SOCI_LIBRARIES ${SOCI_${plugin}_PLUGIN})
endif()
ELSE()
MESSAGE(STATUS " * Plugin ${plugin} not found.")
SET(SOCI_${plugin}_FOUND False)
......@@ -84,4 +89,3 @@ ENDIF()
#
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Soci DEFAULT_MSG ${_SOCI_REQUIRED_VARS})
############################################################################
# CMakeLists.txt
# Copyright (C) 2014 Belledonne Communications, Grenoble France
# LinphoneUtils.cmake
# Copyright (C) 2018 Belledonne Communications, Grenoble France
#
############################################################################
#
......@@ -20,13 +20,14 @@
#
############################################################################
if(GETTEXT_FOUND)
foreach(language ${LINPHONE_ALL_LANGS_LIST})
GETTEXT_PROCESS_PO_FILES(${language} ALL PO_FILES ${language}.po)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${language}.gmo
DESTINATION ${PACKAGE_LOCALE_DIR}/${language}/LC_MESSAGES
RENAME linphone.mo
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endforeach()
endif()
function(check_python_module module_name)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import ${module_name}"
RESULT_VARIABLE result
OUTPUT_QUIET
ERROR_QUIET)
if(result EQUAL 0)
message(STATUS "'${module_name}' python module found")
else()
message(FATAL_ERROR "'${module_name}' python module not found")
endif()
endfunction()
......@@ -35,16 +35,15 @@
#define PACKAGE_LOCALE_DIR "${PACKAGE_LOCALE_DIR}"
#define PACKAGE_DATA_DIR "${PACKAGE_DATA_DIR}"
#define PACKAGE_GRAMMAR_DIR "${PACKAGE_GRAMMAR_DIR}"
#define PACKAGE_SOUND_DIR "${PACKAGE_SOUND_DIR}"
#define PACKAGE_RING_DIR "${PACKAGE_RING_DIR}"
#cmakedefine BUILD_WIZARD
#cmakedefine HAVE_GTK_OSX 1
#cmakedefine HAVE_NOTIFY4
#cmakedefine HAVE_ZLIB 1
#cmakedefine HAVE_CU_GET_SUITE 1
#cmakedefine HAVE_CU_CURSES 1
#cmakedefine HAVE_LIBUDEV_H 0
#cmakedefine HAVE_LIME
#cmakedefine ENABLE_NLS 1
#cmakedefine ENABLE_UPDATE_CHECK 1
......@@ -37,7 +37,7 @@ if(MSVC)
endif()
add_executable(linphonec ${LINPHONEC_SOURCE_FILES})
target_link_libraries(linphonec ${LINPHONE_LIBS_FOR_TOOLS} ${BCTOOLBOX_CORE_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
target_link_libraries(linphonec ${LINPHONE_LIBS_FOR_TOOLS} ${BCTOOLBOX_CORE_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${XSD_LIBRARIES})
set_target_properties(linphonec PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
if(INTL_FOUND)
......@@ -46,7 +46,7 @@ endif()
if(WIN32)
add_executable(linphoned WIN32 ${LINPHONEC_SOURCE_FILES})
target_link_libraries(linphoned ${LINPHONE_LIBS_FOR_TOOLS} ${BCTOOLBOX_CORE_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
target_link_libraries(linphoned ${LINPHONE_LIBS_FOR_TOOLS} ${BCTOOLBOX_CORE_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${XSD_LIBRARIES})
if(INTL_FOUND)
target_link_libraries(linphoned ${INTL_LIBRARIES})
endif()
......
......@@ -456,14 +456,15 @@ linphonec_parse_command_line(LinphoneCore *lc, char *cl)
char *
linphonec_command_generator(const char *text, int state)
{
static int index, len, adv;
static size_t len;
static int index, adv;
char *name;
if ( ! state )
{
index=0;
adv=0;
len=(int)strlen(text);
len=strlen(text);
}
/*
* Return the next name which partially matches
......@@ -665,8 +666,8 @@ lpc_cmd_transfer(LinphoneCore *lc, char *args)
const char *refer_to=NULL;
char arg1[256]={0};
char arg2[266]={0};
long id2=0;
int n=sscanf(args,"%255s %265s %li",arg1,arg2,&id2);
int id2=0;
int n=sscanf(args,"%255s %265s %d",arg1,arg2,&id2);
if (n==1 || isalpha(*arg1)){
call=linphone_core_get_current_call(lc);
if (call==NULL && bctbx_list_size(linphone_core_get_calls(lc))==1){
......@@ -679,13 +680,13 @@ lpc_cmd_transfer(LinphoneCore *lc, char *args)
}
linphone_call_transfer(call, refer_to);
}else if (n==2){
long id=atoi(arg1);
int id=atoi(arg1);
refer_to=args+strlen(arg1)+1;
call=linphonec_get_call(id);
if (call==NULL) return 0;
linphone_call_transfer(call, refer_to);
}else if (n==3){
long id=atoi(arg1);
int id=atoi(arg1);
call=linphonec_get_call(id);
call2=linphonec_get_call(id2);
if (call==NULL || call2==NULL) return 0;
......@@ -723,7 +724,7 @@ lpc_cmd_terminate(LinphoneCore *lc, char *args)
return 1;
}else{
/*the argument is a linphonec call id */
long id=atoi(args);
int id=atoi(args);
LinphoneCall *call=linphonec_get_call(id);
if (call){
if (linphone_call_terminate(call)==-1){
......@@ -764,9 +765,9 @@ lpc_cmd_redirect(LinphoneCore *lc, char *args){
}
} else {
char space;
long id;
int id;
int charRead;
if ( sscanf(args, "%li%c%n", &id, &space, &charRead) == 2 && space == ' ') {
if ( sscanf(args, "%d%c%n", &id, &space, &charRead) == 2 && space == ' ') {
LinphoneCall * call = linphonec_get_call(id);
if ( call != NULL ) {
if (linphone_call_get_state(call)!=LinphoneCallIncomingReceived) {
......@@ -799,8 +800,8 @@ lpc_cmd_answer(LinphoneCore *lc, char *args){
}
return 1;
}else{
long id;
if (sscanf(args,"%li",&id)==1){
int id;
if (sscanf(args,"%d",&id)==1){
LinphoneCall *call=linphonec_get_call (id);
if (linphone_call_accept(call)==-1){
linphonec_out("Fail to accept call %i\n",id);
......@@ -929,6 +930,7 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
return 1;
}
linphone_core_set_firewall_policy(lc,LinphonePolicyUseNatAddress);
setting = linphone_core_get_nat_address(lc);
}
}
......@@ -1003,14 +1005,14 @@ lpc_cmd_friend(LinphoneCore *lc, char *args)
{
args+=4;
if ( ! *args ) return 0;
friend_num = strtol(args, NULL, 10);
friend_num = (int)strtol(args, NULL, 10);
#ifndef _WIN32_WCE
if ( errno == ERANGE ) {
linphonec_out("Invalid friend number\n");
return 0;
}
#endif /*_WIN32_WCE*/
linphonec_friend_call(lc, friend_num);
linphonec_friend_call(lc, (unsigned int)friend_num);
return 1;
}
else if ( !strncmp(args, "delete", 6) )
......@@ -1025,7 +1027,7 @@ lpc_cmd_friend(LinphoneCore *lc, char *args)
}
else
{
friend_num = strtol(args, NULL, 10);
friend_num = (int)strtol(args, NULL, 10);
#ifndef _WIN32_WCE
if ( errno == ERANGE ) {
linphonec_out("Invalid friend number\n");
......@@ -1470,10 +1472,10 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
}
if (args)
{
long id;
int n = sscanf(args, "%li", &id);
int id;
int n = sscanf(args, "%d", &id);
if (n == 1){
LinphoneCall *call=linphonec_get_call (id);
LinphoneCall *call=linphonec_get_call(id);
if (call){
if(linphone_call_resume(call)==-1){
linphonec_out("There was a problem to resume the call check the remote address you gave %s\n",args);
......@@ -1505,11 +1507,11 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
}
static int lpc_cmd_conference(LinphoneCore *lc, char *args){