diff --git a/CMakeLists.txt b/CMakeLists.txt index b6144be09..bc9ae5917 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,7 +228,12 @@ set(STRICT_OPTIONS_CPP ) set(STRICT_OPTIONS_C ) set(STRICT_OPTIONS_CXX ) set(STRICT_OPTIONS_OBJC ) -if(NOT MSVC) +if(MSVC) + list(APPEND STRICT_OPTIONS_CPP "/wd4995") # Disable "name was marked as #pragma deprecated" warnings + if(ENABLE_STRICT) + list(APPEND STRICT_OPTIONS_CPP "/WX") + endif() +else() list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized" "-Wno-error=deprecated-declarations") list(APPEND STRICT_OPTIONS_C "-Wdeclaration-after-statement" "-Wstrict-prototypes" "-Wno-error=strict-prototypes") if(CMAKE_C_COMPILER_ID STREQUAL "Clang") diff --git a/console/CMakeLists.txt b/console/CMakeLists.txt index 3ec2b9e44..078b4ee40 100644 --- a/console/CMakeLists.txt +++ b/console/CMakeLists.txt @@ -30,6 +30,12 @@ set(LINPHONECSH_SOURCE_FILES ) apply_compile_flags(LINPHONEC_SOURCE_FILES "CPP" "C") +if(MSVC) + get_source_file_property(COMMANDS_C_COMPILE_FLAGS commands.c COMPILE_FLAGS) + set(COMMANDS_C_COMPILE_FLAGS "${COMMANDS_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings + set_source_files_properties(commands.c PROPERTY COMPILE_FLAGS "${COMMANDS_C_COMPILE_FLAGS}") +endif() + add_executable(linphonec ${LINPHONEC_SOURCE_FILES}) target_link_libraries(linphonec linphone) diff --git a/console/commands.c b/console/commands.c index 095ab3f18..c3324d3df 100644 --- a/console/commands.c +++ b/console/commands.c @@ -1432,7 +1432,7 @@ lpc_cmd_staticpic(LinphoneCore *lc, char *args) if (strcmp(arg1, "fps")==0) { if (arg2) { - float fps = atof(arg2); /* FIXME: Handle not-a-float */ + float fps = (float)atof(arg2); /* FIXME: Handle not-a-float */ linphone_core_set_static_picture_fps(lc, fps); return 1; } else { @@ -2375,7 +2375,7 @@ static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args){ static int lpc_cmd_playback_gain(LinphoneCore *lc, char *args) { if (args){ - linphone_core_set_playback_gain_db(lc, atof(args)); + linphone_core_set_playback_gain_db(lc, (float)atof(args)); return 1; } return 0; diff --git a/console/linphonec.c b/console/linphonec.c index 07ac95729..899ffe61c 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -37,6 +37,7 @@ #include #include "linphonec.h" +#include #ifdef _WIN32 #include @@ -1206,7 +1207,7 @@ linphonec_parse_cmdline(int argc, char **argv) if (strcmp(argv[arg_num], "NUL") != 0) { #endif #if !defined(_WIN32_WCE) - if (access(argv[arg_num], F_OK) != 0) + if (bctbx_file_exist(argv[arg_num]) != 0) { fprintf(stderr, "Cannot open config file %s.\n", @@ -1223,7 +1224,7 @@ linphonec_parse_cmdline(int argc, char **argv) { if ( ++arg_num >= argc ) print_usage(EXIT_FAILURE); #if !defined(_WIN32_WCE) - if (access(argv[arg_num],F_OK)!=0 ) + if (bctbx_file_exist(argv[arg_num])!=0 ) { fprintf (stderr, "Cannot open config file %s.\n", @@ -1331,7 +1332,7 @@ handle_configfile_migration() * If the *NEW* configuration already exists * do nothing. */ - if (access(new_cfg,F_OK)==0) + if (bctbx_file_exist(new_cfg)==0) { free(new_cfg); return 0; @@ -1343,7 +1344,7 @@ handle_configfile_migration() * If the *OLD* CLI configurations exist copy it to * the new file and make it a symlink. */ - if (access(old_cfg_cli, F_OK)==0) + if (bctbx_file_exist(old_cfg_cli)==0) { if ( ! copy_file(old_cfg_cli, new_cfg) ) { @@ -1364,7 +1365,7 @@ handle_configfile_migration() * If the *OLD* GUI configurations exist copy it to * the new file and make it a symlink. */ - if (access(old_cfg_gui, F_OK)==0) + if (bctbx_file_exist(old_cfg_gui)==0) { if ( ! copy_file(old_cfg_gui, new_cfg) ) { diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index 1ea4aabb5..4469bc7d1 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -210,11 +210,11 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_username(LinphoneAccou bool_t use_phone_number = lp_config_get_int(creator->core->config, "assistant", "use_phone_number", 0); const char* regex = lp_config_get_string(creator->core->config, "assistant", "username_regex", 0); LinphoneAccountCreatorStatus status; - if (min_length > 0 && strlen(username) < min_length) { + if (min_length > 0 && strlen(username) < (size_t)min_length) { return LinphoneAccountCreatorUsernameTooShort; - } else if (max_length > 0 && strlen(username) > max_length) { + } else if (max_length > 0 && strlen(username) > (size_t)max_length) { return LinphoneAccountCreatorUsernameTooLong; - } else if (fixed_length > 0 && strlen(username) != fixed_length) { + } else if (fixed_length > 0 && strlen(username) != (size_t)fixed_length) { return LinphoneAccountCreatorUsernameInvalidSize; } else if (use_phone_number && !linphone_proxy_config_is_phone_number(NULL, username)) { return LinphoneAccountCreatorUsernameInvalid; @@ -236,9 +236,9 @@ const char * linphone_account_creator_get_username(const LinphoneAccountCreator LinphoneAccountCreatorStatus linphone_account_creator_set_password(LinphoneAccountCreator *creator, const char *password){ int min_length = lp_config_get_int(creator->core->config, "assistant", "password_min_length", -1); int max_length = lp_config_get_int(creator->core->config, "assistant", "password_max_length", -1); - if (min_length > 0 && strlen(password) < min_length) { + if (min_length > 0 && strlen(password) < (size_t)min_length) { return LinphoneAccountCreatorPasswordTooShort; - } else if (max_length > 0 && strlen(password) > max_length) { + } else if (max_length > 0 && strlen(password) > (size_t)max_length) { return LinphoneAccountCreatorPasswordTooLong; } set_string(&creator->password, password, FALSE); diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index acaaf6c0a..2c256d29d 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -1036,7 +1036,7 @@ int sal_generate_uuid(char *uuid, size_t len) { written=snprintf(uuid,len,"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", uuid_struct.time_low, uuid_struct.time_mid, uuid_struct.time_hi_and_version, uuid_struct.clock_seq_hi_and_reserved, uuid_struct.clock_seq_low); - if (written>len+13){ + if ((written < 0) || ((size_t)written > (len +13))) { ms_error("sal_create_uuid(): buffer is too short !"); return -1; } diff --git a/coreapi/call_log.c b/coreapi/call_log.c index 1e8a3786c..91e7eb5dd 100644 --- a/coreapi/call_log.c +++ b/coreapi/call_log.c @@ -76,7 +76,7 @@ static void set_call_log_date(LinphoneCallLog *cl, time_t start_time){ void call_logs_write_to_config_file(LinphoneCore *lc){ MSList *elem; char logsection[32]; - int i; + unsigned int i; char *tmp; LpConfig *cfg=lc->config; @@ -420,7 +420,7 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) { LinphoneCallDir dir; LinphoneCallLog *log; - unsigned int storage_id = atoi(argv[0]); + unsigned int storage_id = (unsigned int)atoi(argv[0]); from = linphone_address_new(argv[1]); to = linphone_address_new(argv[2]); @@ -436,7 +436,7 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) { log->connected_date_time = (time_t)atol(argv[6]); log->status = (LinphoneCallStatus) atoi(argv[7]); log->video_enabled = atoi(argv[8]) == 1; - log->quality = atof(argv[9]); + log->quality = (float)atof(argv[9]); if (argc > 10) { if (argv[10] != NULL) { @@ -507,7 +507,7 @@ void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log) { ms_free(from); ms_free(to); - log->storage_id = sqlite3_last_insert_rowid(lc->logs_db); + log->storage_id = (unsigned int)sqlite3_last_insert_rowid(lc->logs_db); } if (lc) { @@ -541,7 +541,7 @@ const MSList *linphone_core_get_call_history(LinphoneCore *lc) { if (!lc || lc->logs_db == NULL) return NULL; - buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC LIMIT %i", lc->max_call_logs); + buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC LIMIT %u", lc->max_call_logs); begin = ortp_get_cur_time_ms(); linphone_sql_request_call_log(lc->logs_db, buf, &result); @@ -574,7 +574,7 @@ void linphone_core_delete_call_log(LinphoneCore *lc, LinphoneCallLog *log) { if (!lc || lc->logs_db == NULL) return ; - buf = sqlite3_mprintf("DELETE FROM call_history WHERE id = %i", log->storage_id); + buf = sqlite3_mprintf("DELETE FROM call_history WHERE id = %u", log->storage_id); linphone_sql_request_generic(lc->logs_db, buf); sqlite3_free(buf); } diff --git a/coreapi/friend.c b/coreapi/friend.c index 2251b370c..32e840579 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -133,6 +133,14 @@ LinphoneFriend * linphone_friend_new(void){ return obj; } +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic push +#endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif LinphoneFriend *linphone_friend_new_with_address(const char *addr){ LinphoneAddress* linphone_address = linphone_address_new(addr); LinphoneFriend *fr; @@ -146,6 +154,9 @@ LinphoneFriend *linphone_friend_new_with_address(const char *addr){ linphone_address_unref(linphone_address); return fr; } +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic pop +#endif void linphone_friend_set_user_data(LinphoneFriend *lf, void *data){ lf->user_data=data; @@ -674,7 +685,11 @@ void linphone_friend_done(LinphoneFriend *fr) { #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif LinphoneFriend * linphone_core_create_friend(LinphoneCore *lc) { LinphoneFriend * lf = linphone_friend_new(); lf->lc = lc; @@ -1033,7 +1048,11 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) { #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) { LinphoneAddress* linphone_address = NULL; LinphoneFriend *fr; @@ -1183,7 +1202,7 @@ void linphone_core_friends_storage_close(LinphoneCore *lc) { */ static int create_friend_list(void *data, int argc, char **argv, char **colName) { MSList **list = (MSList **)data; - unsigned int storage_id = atoi(argv[0]); + unsigned int storage_id = (unsigned int)atoi(argv[0]); LinphoneFriendList *lfl = linphone_core_create_friend_list(NULL); lfl->storage_id = storage_id; @@ -1200,7 +1219,11 @@ static int create_friend_list(void *data, int argc, char **argv, char **colName) #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif /* DB layout: * | 0 | storage_id * | 1 | friend_list_id @@ -1217,7 +1240,7 @@ static int create_friend(void *data, int argc, char **argv, char **colName) { MSList **list = (MSList **)data; LinphoneFriend *lf = NULL; LinphoneVcard *vcard = NULL; - unsigned int storage_id = atoi(argv[0]); + unsigned int storage_id = (unsigned int)atoi(argv[0]); vcard = linphone_vcard_new_from_vcard4_buffer(argv[6]); if (vcard) { @@ -1299,7 +1322,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) { } if (lf->storage_id > 0) { - buf = sqlite3_mprintf("UPDATE friends SET friend_list_id=%i,sip_uri=%Q,subscribe_policy=%i,send_subscribe=%i,ref_key=%Q,vCard=%Q,vCard_etag=%Q,vCard_url=%Q,presence_received=%i WHERE (id = %i);", + buf = sqlite3_mprintf("UPDATE friends SET friend_list_id=%u,sip_uri=%Q,subscribe_policy=%i,send_subscribe=%i,ref_key=%Q,vCard=%Q,vCard_etag=%Q,vCard_url=%Q,presence_received=%i WHERE (id = %u);", lf->friend_list->storage_id, linphone_address_as_string(linphone_friend_get_address(lf)), lf->pol, @@ -1312,7 +1335,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) { lf->storage_id ); } else { - buf = sqlite3_mprintf("INSERT INTO friends VALUES(NULL,%i,%Q,%i,%i,%Q,%Q,%Q,%Q,%i);", + buf = sqlite3_mprintf("INSERT INTO friends VALUES(NULL,%u,%Q,%i,%i,%Q,%Q,%Q,%Q,%i);", lf->friend_list->storage_id, linphone_address_as_string(linphone_friend_get_address(lf)), lf->pol, @@ -1328,7 +1351,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) { sqlite3_free(buf); if (lf->storage_id == 0) { - lf->storage_id = sqlite3_last_insert_rowid(lc->friends_db); + lf->storage_id = (unsigned int)sqlite3_last_insert_rowid(lc->friends_db); } } } @@ -1343,7 +1366,7 @@ void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList } if (list->storage_id > 0) { - buf = sqlite3_mprintf("UPDATE friends_lists SET display_name=%Q,rls_uri=%Q,uri=%Q,revision=%i WHERE (id = %i);", + buf = sqlite3_mprintf("UPDATE friends_lists SET display_name=%Q,rls_uri=%Q,uri=%Q,revision=%i WHERE (id = %u);", list->display_name, list->rls_uri, list->uri, @@ -1362,7 +1385,7 @@ void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList sqlite3_free(buf); if (list->storage_id == 0) { - list->storage_id = sqlite3_last_insert_rowid(lc->friends_db); + list->storage_id = (unsigned int)sqlite3_last_insert_rowid(lc->friends_db); } } } @@ -1375,7 +1398,7 @@ void linphone_core_remove_friend_from_db(LinphoneCore *lc, LinphoneFriend *lf) { return; } - buf = sqlite3_mprintf("DELETE FROM friends WHERE id = %i", lf->storage_id); + buf = sqlite3_mprintf("DELETE FROM friends WHERE id = %u", lf->storage_id); linphone_sql_request_generic(lc->friends_db, buf); sqlite3_free(buf); @@ -1391,7 +1414,7 @@ void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendL return; } - buf = sqlite3_mprintf("DELETE FROM friends_lists WHERE id = %i", list->storage_id); + buf = sqlite3_mprintf("DELETE FROM friends_lists WHERE id = %u", list->storage_id); linphone_sql_request_generic(lc->friends_db, buf); sqlite3_free(buf); @@ -1410,7 +1433,7 @@ MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList return NULL; } - buf = sqlite3_mprintf("SELECT * FROM friends WHERE friend_list_id = %i ORDER BY id", list->storage_id); + buf = sqlite3_mprintf("SELECT * FROM friends WHERE friend_list_id = %u ORDER BY id", list->storage_id); begin = ortp_get_cur_time_ms(); linphone_sql_request_friend(lc->friends_db, buf, &result); diff --git a/coreapi/lime.c b/coreapi/lime.c index 0ce71921d..e182d7f40 100644 --- a/coreapi/lime.c +++ b/coreapi/lime.c @@ -713,7 +713,7 @@ int lime_decryptMultipartMessage(xmlDocPtr cacheBuffer, uint8_t *message, uint8_ if ((!xmlStrcmp(cur->name, (const xmlChar *)"ZID"))){ /* sender ZID found, extract it */ peerZidHex = xmlNodeListGetString(xmlEncryptedMessage, cur->xmlChildrenNode, 1); /* convert it from hexa string to bytes string and set the result in the associatedKey structure */ - lime_strToUint8(associatedKey.peerZID, peerZidHex, strlen((char *)peerZidHex)); + lime_strToUint8(associatedKey.peerZID, peerZidHex, (uint16_t)strlen((char *)peerZidHex)); cur = cur->next; } } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index f6da6e656..376c9a1d0 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -4641,7 +4641,7 @@ void linphone_call_log_completed(LinphoneCall *call){ #endif if (!call_logs_sqlite_db_found) { lc->call_logs=ms_list_prepend(lc->call_logs,linphone_call_log_ref(call->log)); - if (ms_list_size(lc->call_logs)>lc->max_call_logs){ + if (ms_list_size(lc->call_logs)>(size_t)lc->max_call_logs){ MSList *elem,*prevelem=NULL; /*find the last element*/ for(elem=lc->call_logs;elem!=NULL;elem=elem->next){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e7a7274f3..40ade3d72 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -102,7 +102,7 @@ static OrtpLogFunc liblinphone_log_func = NULL; static LinphoneLogCollectionState liblinphone_log_collection_state = LinphoneLogCollectionDisabled; static char * liblinphone_log_collection_path = NULL; static char * liblinphone_log_collection_prefix = NULL; -static int liblinphone_log_collection_max_file_size = LOG_COLLECTION_DEFAULT_MAX_FILE_SIZE; +static size_t liblinphone_log_collection_max_file_size = LOG_COLLECTION_DEFAULT_MAX_FILE_SIZE; static ortp_mutex_t liblinphone_log_collection_mutex; static FILE * liblinphone_log_collection_file = NULL; static size_t liblinphone_log_collection_file_size = 0; @@ -230,7 +230,7 @@ static int _open_log_collection_file_with_idx(int idx) { if (liblinphone_log_collection_file == NULL) return -1; fstat(fileno(liblinphone_log_collection_file), &statbuf); - if (statbuf.st_size > liblinphone_log_collection_max_file_size) { + if ((size_t)statbuf.st_size > liblinphone_log_collection_max_file_size) { fclose(liblinphone_log_collection_file); return -1; } @@ -369,11 +369,11 @@ void linphone_core_set_log_collection_prefix(const char *prefix) { } } -int linphone_core_get_log_collection_max_file_size(void) { +size_t linphone_core_get_log_collection_max_file_size(void) { return liblinphone_log_collection_max_file_size; } -void linphone_core_set_log_collection_max_file_size(int size) { +void linphone_core_set_log_collection_max_file_size(size_t size) { liblinphone_log_collection_max_file_size = size; } @@ -810,7 +810,7 @@ static void build_sound_devices_table(LinphoneCore *lc){ devices[ndev]=NULL; old=lc->sound_conf.cards; lc->sound_conf.cards=devices; - if (old!=NULL) ms_free(old); + if (old!=NULL) ms_free((void *)old); } static const char *get_default_local_ring(LinphoneCore * lc){ @@ -1373,7 +1373,7 @@ static void build_video_devices_table(LinphoneCore *lc){ int ndev; const char **devices; if (lc->video_conf.cams) - ms_free(lc->video_conf.cams); + ms_free((void *)lc->video_conf.cams); /* retrieve all video devices */ elem=ms_web_cam_manager_get_list(ms_factory_get_web_cam_manager(lc->factory)); ndev=ms_list_size(elem); @@ -1604,7 +1604,7 @@ static void misc_config_read(LinphoneCore *lc) { LpConfig *config=lc->config; const char *uuid; - lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",30); + lc->max_call_logs=(unsigned int)lp_config_get_int(config,"misc","history_max_size",30); lc->max_calls=lp_config_get_int(config,"misc","max_calls",NB_MAX_CALLS); uuid=lp_config_get_string(config,"misc","uuid",NULL); @@ -6545,7 +6545,7 @@ void rtp_config_uninit(LinphoneCore *lc) static void sound_config_uninit(LinphoneCore *lc) { sound_config_t *config=&lc->sound_conf; - ms_free(config->cards); + ms_free((void *)config->cards); lp_config_set_string(lc->config,"sound","remote_ring",config->remote_ring); lp_config_set_float(lc->config,"sound","playback_gain_db",config->soft_play_lev); @@ -6562,7 +6562,7 @@ static void video_config_uninit(LinphoneCore *lc) lp_config_set_int(lc->config,"video","display",lc->video_conf.display); lp_config_set_int(lc->config,"video","capture",lc->video_conf.capture); if (lc->video_conf.cams) - ms_free(lc->video_conf.cams); + ms_free((void *)lc->video_conf.cams); } void _linphone_core_codec_config_write(LinphoneCore *lc){ @@ -6731,7 +6731,7 @@ static void linphone_core_uninit(LinphoneCore *lc) } linphone_core_free_payload_types(lc); - if (lc->supported_formats) ms_free(lc->supported_formats); + if (lc->supported_formats) ms_free((void *)lc->supported_formats); linphone_core_message_storage_close(lc); linphone_core_call_log_storage_close(lc); linphone_core_friends_storage_close(lc); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index e43c25c9f..15af0ccdf 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -2261,7 +2261,7 @@ LINPHONE_PUBLIC void linphone_core_set_log_collection_prefix(const char *prefix) * Get the max file size in bytes of the files used for log collection. * @return The max file size in bytes of the files used for log collection. */ -LINPHONE_PUBLIC int linphone_core_get_log_collection_max_file_size(void); +LINPHONE_PUBLIC size_t linphone_core_get_log_collection_max_file_size(void); /** * Set the max file size in bytes of the files used for log collection. @@ -2271,7 +2271,7 @@ LINPHONE_PUBLIC int linphone_core_get_log_collection_max_file_size(void); * on runtime, logs chronological order COULD be broken. * @param[in] size The max file size in bytes of the files used for log collection. */ -LINPHONE_PUBLIC void linphone_core_set_log_collection_max_file_size(int size); +LINPHONE_PUBLIC void linphone_core_set_log_collection_max_file_size(size_t size); /** * Set the url of the server where to upload the collected log files. diff --git a/coreapi/message_storage.c b/coreapi/message_storage.c index 18867674d..126b265ab 100644 --- a/coreapi/message_storage.c +++ b/coreapi/message_storage.c @@ -198,7 +198,7 @@ static int callback_all(void *data, int argc, char **argv, char **colName){ */ static int create_chat_message(void *data, int argc, char **argv, char **colName){ LinphoneChatRoom *cr = (LinphoneChatRoom *)data; - unsigned int storage_id = atoi(argv[0]); + unsigned int storage_id = (unsigned int)atoi(argv[0]); // check if the message exists in the transient list, in which case we should return that one. LinphoneChatMessage* new_message = get_transient_message(cr, storage_id); @@ -329,7 +329,7 @@ unsigned int linphone_chat_message_store(LinphoneChatMessage *msg){ void linphone_chat_message_store_state(LinphoneChatMessage *msg){ LinphoneCore *lc=msg->chat_room->lc; if (lc->db){ - char *buf=sqlite3_mprintf("UPDATE history SET status=%i WHERE (id = %i);", + char *buf=sqlite3_mprintf("UPDATE history SET status=%i WHERE (id = %u);", msg->state,msg->storage_id); linphone_sql_request(lc->db,buf); sqlite3_free(buf); @@ -339,7 +339,7 @@ void linphone_chat_message_store_state(LinphoneChatMessage *msg){ void linphone_chat_message_store_appdata(LinphoneChatMessage* msg){ LinphoneCore *lc=msg->chat_room->lc; if (lc->db){ - char *buf=sqlite3_mprintf("UPDATE history SET appdata=%Q WHERE id=%i;", + char *buf=sqlite3_mprintf("UPDATE history SET appdata=%Q WHERE id=%u;", msg->appdata,msg->storage_id); linphone_sql_request(lc->db,buf); sqlite3_free(buf); @@ -373,7 +373,7 @@ void linphone_chat_room_update_url(LinphoneChatRoom *cr, LinphoneChatMessage *ms if (lc->db==NULL) return ; - buf=sqlite3_mprintf("UPDATE history SET url=%Q WHERE id=%i;",msg->external_body_url,msg->storage_id); + buf=sqlite3_mprintf("UPDATE history SET url=%Q WHERE id=%u;",msg->external_body_url,msg->storage_id); linphone_sql_request(lc->db,buf); sqlite3_free(buf); } @@ -424,7 +424,7 @@ void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage if (lc->db==NULL) return ; - buf=sqlite3_mprintf("DELETE FROM history WHERE id = %i;", msg->storage_id); + buf=sqlite3_mprintf("DELETE FROM history WHERE id = %u;", msg->storage_id); linphone_sql_request(lc->db,buf); sqlite3_free(buf); diff --git a/coreapi/misc.c b/coreapi/misc.c index d7233c977..cb373eb56 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -903,7 +903,8 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess IceCandidate *rtcp_candidate = NULL; IceSessionState session_state = ice_session_state(session); int nb_candidates; - int i, j; + int i; + size_t j; bool_t result; if (session_state == IS_Completed) { diff --git a/coreapi/private.h b/coreapi/private.h index 7351cfbc5..67fa3ea4f 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -940,7 +940,7 @@ struct _LinphoneCore MSList *queued_calls; /* used by the autoreplier */ MSList *call_logs; MSList *chatrooms; - int max_call_logs; + unsigned int max_call_logs; int missed_calls; VideoPreview *previewstream; struct _MSEventQueue *msevq; diff --git a/coreapi/sqlite3_bctbx_vfs.c b/coreapi/sqlite3_bctbx_vfs.c index 2796be7e9..316c1db8c 100755 --- a/coreapi/sqlite3_bctbx_vfs.c +++ b/coreapi/sqlite3_bctbx_vfs.c @@ -77,7 +77,7 @@ static int sqlite3bctbx_Read(sqlite3_file *p, void *buf, int count, sqlite_int64 int ret; sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*) p; if (pFile){ - ret = bctbx_file_read(pFile->pbctbx_file, buf, count, offset); + ret = bctbx_file_read(pFile->pbctbx_file, buf, count, (off_t)offset); if( ret==count ){ return SQLITE_OK; } @@ -106,7 +106,7 @@ static int sqlite3bctbx_Write(sqlite3_file *p, const void *buf, int count, sqlit sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*) p; int ret; if (pFile ){ - ret = bctbx_file_write(pFile->pbctbx_file, buf, count, offset); + ret = bctbx_file_write(pFile->pbctbx_file, buf, count, (off_t)offset); if(ret > 0 ) return SQLITE_OK; else { return SQLITE_IOERR_WRITE; @@ -239,31 +239,21 @@ static char* ConvertFromUtf8Filename(const char* fName){ LPWSTR wideFilename; nChar = MultiByteToWideChar(CP_UTF8, 0, fName, -1, NULL, 0); - if (nChar == 0){ - return BCTBX_VFS_ERROR; - } + if (nChar == 0) return NULL; wideFilename = bctbx_malloc(nChar*sizeof(wideFilename[0])); - if (wideFilename == 0){ - return 0; - } - nChar = MultiByteToWideChar(CP_UTF8, 0, fName, -1, wideFilename, - nChar); - if (nChar == 0){ + if (wideFilename == NULL) return NULL; + nChar = MultiByteToWideChar(CP_UTF8, 0, fName, -1, wideFilename, nChar); + if (nChar == 0) { bctbx_free(wideFilename); wideFilename = 0; } nb_byte = WideCharToMultiByte(CP_ACP, 0, wideFilename, -1, 0, 0, 0, 0); - if (nb_byte == 0){ - return 0; - } + if (nb_byte == 0) return NULL; convertedFilename = bctbx_malloc(nb_byte); - if (convertedFilename == 0){ - return 0; - } - nb_byte = WideCharToMultiByte(CP_ACP, 0, wideFilename, -1, convertedFilename, - nb_byte, 0, 0); - if (nb_byte == 0){ + if (convertedFilename == NULL) return NULL; + nb_byte = WideCharToMultiByte(CP_ACP, 0, wideFilename, -1, convertedFilename, nb_byte, 0, 0); + if (nb_byte == 0) { bctbx_free(convertedFilename); convertedFilename = 0; } @@ -286,7 +276,6 @@ static char* ConvertFromUtf8Filename(const char* fName){ iconv_close(cb); } return bctbx_strdup(db_file_locale); - #endif @@ -341,8 +330,12 @@ static int sqlite3bctbx_Open(sqlite3_vfs *pVfs, const char *fName, sqlite3_file openFlags |= O_BINARY; #endif wFname = ConvertFromUtf8Filename(fName); - pFile->pbctbx_file = bctbx_file_open2(bctbx_vfs_get_default(), wFname, openFlags); - bctbx_free(wFname); + if (wFname != NULL) { + pFile->pbctbx_file = bctbx_file_open2(bctbx_vfs_get_default(), wFname, openFlags); + bctbx_free(wFname); + } else { + pFile->pbctbx_file = NULL; + } if( pFile->pbctbx_file == NULL){ return SQLITE_CANTOPEN; diff --git a/coreapi/vtables.c b/coreapi/vtables.c index 292d698d9..50a850ee8 100644 --- a/coreapi/vtables.c +++ b/coreapi/vtables.c @@ -99,7 +99,11 @@ void linphone_core_notify_registration_state_changed(LinphoneCore *lc, LinphoneP #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif void linphone_core_notify_show_interface(LinphoneCore *lc){ NOTIFY_IF_EXIST(show, lc); cleanup_dead_vtable_refs(lc); @@ -149,7 +153,11 @@ void linphone_core_notify_call_log_updated(LinphoneCore *lc, LinphoneCallLog *ne #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif void linphone_core_notify_text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message){ NOTIFY_IF_EXIST(text_received, lc,room,from,message); @@ -166,7 +174,11 @@ void linphone_core_notify_message_received(LinphoneCore *lc, LinphoneChatRoom *r #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif void linphone_core_notify_file_transfer_recv(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size) { NOTIFY_IF_EXIST(file_transfer_recv, lc,message,content,buff,size); cleanup_dead_vtable_refs(lc); diff --git a/gtk/calllogs.c b/gtk/calllogs.c index bd87a61dc..6705b6cff 100644 --- a/gtk/calllogs.c +++ b/gtk/calllogs.c @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "linphone.h" +#include #define CONFIG_FILE ".linphone-call-history.db" @@ -28,7 +29,7 @@ char *linphone_gtk_call_logs_storage_get_db_file(const char *filename){ db_file=(char *)g_malloc(path_max*sizeof(char)); if (filename==NULL) filename=CONFIG_FILE; /*try accessing a local file first if exists*/ - if (access(CONFIG_FILE,F_OK)==0){ + if (bctbx_file_exist(CONFIG_FILE)==0){ snprintf(db_file,path_max,"%s",filename); }else{ #ifdef _WIN32 diff --git a/gtk/chat.c b/gtk/chat.c index 2a2287b2c..8cae184ed 100644 --- a/gtk/chat.c +++ b/gtk/chat.c @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "linphone.h" +#include #ifdef HAVE_GTK_OSX #include @@ -62,7 +63,7 @@ char *linphone_gtk_message_storage_get_db_file(const char *filename){ db_file=(char *)g_malloc(path_max*sizeof(char)); if (filename==NULL) filename=CONFIG_FILE; /*try accessing a local file first if exists*/ - if (access(CONFIG_FILE,F_OK)==0){ + if (bctbx_file_exist(CONFIG_FILE)==0){ snprintf(db_file,path_max,"%s",filename); }else{ #ifdef _WIN32 @@ -196,7 +197,7 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from, pos = end; g_match_info_next(match_info, NULL); } - if(pos < strlen(message)) write_body(buffer, &iter, &message[pos], -1, me, FALSE); + if((size_t)pos < strlen(message)) write_body(buffer, &iter, &message[pos], -1, me, FALSE); gtk_text_buffer_insert(buffer,&iter,"\n",-1); g_match_info_free(match_info); } @@ -441,8 +442,8 @@ static gboolean chatroom_event(GtkWidget *widget, GdkEvent *event, gpointer user GtkTextIter iter; if(event->type == GDK_MOTION_NOTIFY) { GdkEventMotion *motion_ev = (GdkEventMotion *)event; - wx = motion_ev->x; - wy = motion_ev->y; + wx = (gint)motion_ev->x; + wy = (gint)motion_ev->y; gtk_text_view_window_to_buffer_coords(chatroom, GTK_TEXT_WINDOW_TEXT, wx, wy, &bx, &by); gtk_text_view_get_iter_at_location(chatroom, &iter, bx, by); if(gtk_text_iter_has_tag(&iter, link_tag)) { diff --git a/gtk/friendlist.c b/gtk/friendlist.c index d722f8389..ec134f88f 100644 --- a/gtk/friendlist.c +++ b/gtk/friendlist.c @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "linphone.h" +#include static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list); @@ -919,7 +920,7 @@ gboolean linphone_gtk_contact_list_button_pressed(GtkTreeView *friendlist, GdkEv GtkTreeViewColumn *column; GtkTreeSelection *selection = gtk_tree_view_get_selection(friendlist); - gtk_tree_view_convert_widget_to_bin_window_coords(friendlist, event->x, event->y, &x_bin, &y_bin); + gtk_tree_view_convert_widget_to_bin_window_coords(friendlist, (gint)event->x, (gint)event->y, &x_bin, &y_bin); gtk_tree_view_get_path_at_pos(friendlist, x_bin, y_bin, &path, &column, NULL, NULL); if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { @@ -964,7 +965,7 @@ static gboolean update_hovered_row_path(GtkTreeView *friendlist, int x_window, i } gboolean linphone_gtk_friend_list_enter_event_handler(GtkTreeView *friendlist, GdkEventCrossing *event) { - gboolean path_has_changed = update_hovered_row_path(friendlist, event->x, event->y); + gboolean path_has_changed = update_hovered_row_path(friendlist, (int)event->x, (int)event->y); if(path_has_changed) linphone_gtk_friend_list_update_button_display(friendlist); return FALSE; } @@ -979,7 +980,7 @@ gboolean linphone_gtk_friend_list_leave_event_handler(GtkTreeView *friendlist, G } gboolean linphone_gtk_friend_list_motion_event_handler(GtkTreeView *friendlist, GdkEventMotion *event) { - gboolean path_has_changed = update_hovered_row_path(friendlist, event->x, event->y); + gboolean path_has_changed = update_hovered_row_path(friendlist, (int)event->x, (int)event->y); if(path_has_changed) linphone_gtk_friend_list_update_button_display(friendlist); return FALSE; } @@ -993,7 +994,7 @@ char *linphone_gtk_friends_storage_get_db_file(const char *filename){ db_file=(char *)g_malloc(path_max*sizeof(char)); if (filename==NULL) filename=CONFIG_FILE; /*try accessing a local file first if exists*/ - if (access(CONFIG_FILE,F_OK)==0){ + if (bctbx_file_exist(CONFIG_FILE)==0){ snprintf(db_file,path_max,"%s",filename); }else{ #ifdef _WIN32 diff --git a/gtk/incall_view.c b/gtk/incall_view.c index ba90f7560..b495308d1 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -359,9 +359,9 @@ static void volume_control_value_changed(GtkScaleButton *button, gdouble value, VolumeControlType type = (VolumeControlType)GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "type")); if(type == VOLUME_CTRL_PLAYBACK) { - linphone_call_set_speaker_volume_gain(call, value); + linphone_call_set_speaker_volume_gain(call, (float)value); } else if(type == VOLUME_CTRL_RECORD) { - linphone_call_set_microphone_volume_gain(call, value); + linphone_call_set_microphone_volume_gain(call, (float)value); } } @@ -641,7 +641,7 @@ static gboolean linphone_gtk_in_call_view_refresh(LinphoneCall *call){ } #define UNSIGNIFICANT_VOLUME (-23) -#define SMOOTH 0.15 +#define SMOOTH 0.15f static gboolean update_audio_meter(volume_ctx_t *ctx){ float volume_db=ctx->get_volume(ctx->data); diff --git a/gtk/linphone.h b/gtk/linphone.h index 8be2e47f3..9692af836 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -24,7 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifndef _MSC_VER #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#endif #include diff --git a/gtk/logging.c b/gtk/logging.c index e97ca75f8..c702e437d 100644 --- a/gtk/logging.c +++ b/gtk/logging.c @@ -19,11 +19,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphone.h" -#ifndef _WIN32 +#ifdef _WIN32 +#include +#define mkdir _mkdir +#else #include #include #endif + +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif extern gchar *linphone_logfile; diff --git a/gtk/main.c b/gtk/main.c index 1eba60ed3..4cb67d727 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphone.h" #include "lpconfig.h" #include "liblinphone_gitversion.h" - +#include #include #include @@ -36,8 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #ifdef _WIN32 -#define chdir _chdir #include "direct.h" +#define chdir _chdir #ifndef F_OK #define F_OK 00 /*visual studio does not define F_OK*/ #endif @@ -186,7 +186,7 @@ static char _factory_config_file[1024]; static const char *linphone_gtk_get_factory_config_file(void){ char* path = NULL; /*try accessing a local file first if exists*/ - if (access(FACTORY_CONFIG_FILE,F_OK)==0){ + if (bctbx_file_exist(FACTORY_CONFIG_FILE)==0){ path = ms_strdup(FACTORY_CONFIG_FILE); } else { char *progdir; @@ -216,7 +216,7 @@ static const char *linphone_gtk_get_factory_config_file(void){ } if (path) { //use factory file only if it exists - if (access(path,F_OK)==0){ + if (bctbx_file_exist(path)==0){ snprintf(_factory_config_file, sizeof(_factory_config_file), "%s", path); ms_free(path); return _factory_config_file; @@ -332,9 +332,9 @@ static void linphone_gtk_configure_window(GtkWidget *w, const char *window_name) static int get_ui_file(const char *name, char *path, int pathsize){ snprintf(path,pathsize,"%s/%s.ui",BUILD_TREE_XML_DIR,name); - if (access(path,F_OK)!=0){ + if (bctbx_file_exist(path)!=0){ snprintf(path,pathsize,"%s/%s.ui",INSTALLED_XML_DIR,name); - if (access(path,F_OK)!=0){ + if (bctbx_file_exist(path)!=0){ g_error("Could not locate neither %s/%s.ui nor %s/%s.ui",BUILD_TREE_XML_DIR,name, INSTALLED_XML_DIR,name); return -1; diff --git a/gtk/propertybox.c b/gtk/propertybox.c index e3271cf2a..9ae0864bd 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -228,10 +228,10 @@ void linphone_gtk_ldap_save(GtkWidget *button) linphone_dictionary_set_int(dict, "deref_aliases", gtk_toggle_button_get_active(toggle)); spin = GTK_SPIN_BUTTON(linphone_gtk_get_widget(ldap_widget,"ldap_max_results")); - linphone_dictionary_set_int(dict, "max_results", gtk_spin_button_get_value(spin) ); + linphone_dictionary_set_int(dict, "max_results", (int)gtk_spin_button_get_value(spin) ); spin = GTK_SPIN_BUTTON(linphone_gtk_get_widget(ldap_widget,"ldap_timeout")); - linphone_dictionary_set_int(dict, "timeout", gtk_spin_button_get_value(spin) ); + linphone_dictionary_set_int(dict, "timeout", (int)gtk_spin_button_get_value(spin) ); ms_message("Create LDAP from config"); // create new LDAP according to the validated config @@ -324,8 +324,8 @@ void linphone_gtk_min_audio_port_changed(GtkWidget *w){ linphone_core_set_audio_port(linphone_gtk_get_core(), (gint) gtk_spin_button_get_value(min_button)); gtk_spin_button_set_value(max_button, gtk_spin_button_get_value(min_button)); } else { - gint min_port = gtk_spin_button_get_value(min_button); - gint max_port = gtk_spin_button_get_value(max_button); + gint min_port = (gint)gtk_spin_button_get_value(min_button); + gint max_port = (gint)gtk_spin_button_get_value(max_button); if (min_port > max_port) { gtk_spin_button_set_value(max_button, min_port); max_port = min_port; @@ -339,8 +339,8 @@ void linphone_gtk_max_audio_port_changed(GtkWidget *w){ GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters"); GtkSpinButton *min_button = GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_min_rtp_port")); GtkSpinButton *max_button = GTK_SPIN_BUTTON(w); - gint min_port = gtk_spin_button_get_value(min_button); - gint max_port = gtk_spin_button_get_value(max_button); + gint min_port = (gint)gtk_spin_button_get_value(min_button); + gint max_port = (gint)gtk_spin_button_get_value(max_button); if (max_port < min_port) { gtk_spin_button_set_value(min_button, max_port); min_port = max_port; @@ -359,8 +359,8 @@ void linphone_gtk_min_video_port_changed(GtkWidget *w){ linphone_core_set_video_port(linphone_gtk_get_core(), (gint) gtk_spin_button_get_value(min_button)); gtk_spin_button_set_value(max_button, gtk_spin_button_get_value(min_button)); } else { - gint min_port = gtk_spin_button_get_value(min_button); - gint max_port = gtk_spin_button_get_value(max_button); + gint min_port = (gint)gtk_spin_button_get_value(min_button); + gint max_port = (gint)gtk_spin_button_get_value(max_button); if (min_port > max_port) { gtk_spin_button_set_value(max_button, min_port); max_port = min_port; @@ -374,8 +374,8 @@ void linphone_gtk_max_video_port_changed(GtkWidget *w){ GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters"); GtkSpinButton *min_button = GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_min_rtp_port")); GtkSpinButton *max_button = GTK_SPIN_BUTTON(w); - gint min_port = gtk_spin_button_get_value(min_button); - gint max_port = gtk_spin_button_get_value(max_button); + gint min_port = (gint)gtk_spin_button_get_value(min_button); + gint max_port = (gint)gtk_spin_button_get_value(max_button); if (max_port < min_port) { gtk_spin_button_set_value(min_button, max_port); min_port = max_port; @@ -420,7 +420,7 @@ void linphone_gtk_use_upnp_toggled(GtkWidget *w){ void linphone_gtk_mtu_changed(GtkWidget *w){ if (GTK_WIDGET_SENSITIVE(w)) - linphone_core_set_mtu(linphone_gtk_get_core(),gtk_spin_button_get_value(GTK_SPIN_BUTTON(w))); + linphone_core_set_mtu(linphone_gtk_get_core(),(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w))); } void linphone_gtk_use_sip_info_dtmf_toggled(GtkWidget *w){ @@ -673,7 +673,7 @@ static void linphone_gtk_show_codecs(GtkTreeView *listview, const MSList *codecl } /* get an iterator */ gtk_list_store_append(store,&iter); - bitrate=linphone_core_get_payload_type_bitrate(linphone_gtk_get_core(),pt); + bitrate=(gfloat)linphone_core_get_payload_type_bitrate(linphone_gtk_get_core(),pt); rate=payload_type_get_rate(pt); if (pt->recv_fmtp!=NULL) params=pt->recv_fmtp; gtk_list_store_set(store,&iter, CODEC_NAME,payload_type_get_mime(pt), @@ -709,7 +709,7 @@ static void linphone_gtk_check_codec_bandwidth(GtkTreeView *v){ gfloat bitrate; gtk_tree_model_get(model,&iter,CODEC_PRIVDATA,&pt,-1); - bitrate=linphone_core_get_payload_type_bitrate(linphone_gtk_get_core(),pt); + bitrate=(gfloat)linphone_core_get_payload_type_bitrate(linphone_gtk_get_core(),pt); gtk_list_store_set(GTK_LIST_STORE(model),&iter,CODEC_COLOR, (gpointer)get_codec_color(linphone_gtk_get_core(),pt), CODEC_BITRATE, bitrate,-1); }while(gtk_tree_model_iter_next(model,&iter)); @@ -759,7 +759,7 @@ void linphone_gtk_upload_bw_changed(GtkWidget *w){ void linphone_gtk_video_framerate_changed(GtkWidget *w) { linphone_core_set_preferred_framerate(linphone_gtk_get_core(), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w))); + (float)(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w))); } void linphone_gtk_adaptive_rate_control_toggled(GtkToggleButton *button){ @@ -1748,8 +1748,8 @@ void linphone_gtk_fixed_audio_port_toggle(void) { GtkWidget *mw = linphone_gtk_get_main_window(); GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters"); gboolean fixed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb, "fixed_audio_port"))); - gint min_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_min_rtp_port"))); - gint max_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_max_rtp_port"))); + gint min_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_min_rtp_port"))); + gint max_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_max_rtp_port"))); gtk_widget_set_sensitive(GTK_WIDGET(linphone_gtk_get_widget(pb, "audio_max_rtp_port")), !fixed); if (fixed) { linphone_core_set_audio_port(linphone_gtk_get_core(), min_port); @@ -1763,8 +1763,8 @@ void linphone_gtk_fixed_video_port_toggle(void) { GtkWidget *mw = linphone_gtk_get_main_window(); GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters"); gboolean fixed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb, "fixed_video_port"))); - gint min_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_min_rtp_port"))); - gint max_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_max_rtp_port"))); + gint min_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_min_rtp_port"))); + gint max_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_max_rtp_port"))); gtk_widget_set_sensitive(GTK_WIDGET(linphone_gtk_get_widget(pb, "video_max_rtp_port")), !fixed); if (fixed) { linphone_core_set_video_port(linphone_gtk_get_core(), min_port); @@ -1916,7 +1916,7 @@ gboolean linphone_gtk_auto_answer_enabled(void) { } void linphone_gtk_auto_answer_delay_changed(GtkSpinButton *spinbutton, gpointer user_data) { - int delay = gtk_spin_button_get_value(spinbutton); + int delay = (int)gtk_spin_button_get_value(spinbutton); linphone_gtk_set_ui_config_int("auto_answer_delay", delay); } diff --git a/gtk/status_icon.h b/gtk/status_icon.h index 2e4455659..edaa8794a 100644 --- a/gtk/status_icon.h +++ b/gtk/status_icon.h @@ -25,7 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifndef _MSC_VER #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#endif #include #include diff --git a/mediastreamer2 b/mediastreamer2 index 2b7e5dfa5..1df9f8504 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 2b7e5dfa522338d2280b0332fb34a955ee6684cc +Subproject commit 1df9f8504b6681979542702fed26874b66dddf53 diff --git a/oRTP b/oRTP index 95c23d211..084abf711 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 95c23d2115020786ed790d480d501b2ddffdc22d +Subproject commit 084abf711cd7105314f50440e0d96ccd756822de diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index 1483bc703..992ec309d 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -24,6 +24,14 @@ file(GLOB SOURCE_FILES "*_tester.c") list(APPEND SOURCE_FILES accountmanager.c tester.c) apply_compile_flags(SOURCE_FILES "CPP" "C") +if(MSVC) + get_source_file_property(MESSAGE_TESTER_C_COMPILE_FLAGS message_tester.c COMPILE_FLAGS) + set(MESSAGE_TESTER_C_COMPILE_FLAGS "${MESSAGE_TESTER_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings + set_source_files_properties(message_tester.c PROPERTY COMPILE_FLAGS "${MESSAGE_TESTER_C_COMPILE_FLAGS}") + get_source_file_property(VCARD_TESTER_C_COMPILE_FLAGS vcard_tester.c COMPILE_FLAGS) + set(VCARD_TESTER_C_COMPILE_FLAGS "${VCARD_TESTER_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings + set_source_files_properties(vcard_tester.c PROPERTY COMPILE_FLAGS "${VCARD_TESTER_C_COMPILE_FLAGS}") +endif() if(NOT IOS OR NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") # Executable must be available on root path, not host one diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index 3bc9596c5..7275078a6 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -201,23 +201,23 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana } } else { if (linphone_core_rtcp_enabled(caller->lc)) { - BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c1)->rtp_stats.sent_rtcp_packets, 0, int, "%i"); - BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c2)->rtp_stats.recv_rtcp_packets, 0, int, "%i"); + BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c1)->rtp_stats.sent_rtcp_packets, 0, unsigned long long, "%llu"); + BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c2)->rtp_stats.recv_rtcp_packets, 0, unsigned long long, "%llu"); if (linphone_call_log_video_enabled(linphone_call_get_call_log(c1))) { - BC_ASSERT_EQUAL(linphone_call_get_video_stats(c1)->rtp_stats.sent_rtcp_packets, 0, int, "%i"); + BC_ASSERT_EQUAL(linphone_call_get_video_stats(c1)->rtp_stats.sent_rtcp_packets, 0, unsigned long long, "%llu"); } if (linphone_call_log_video_enabled(linphone_call_get_call_log(c2))) { - BC_ASSERT_EQUAL(linphone_call_get_video_stats(c2)->rtp_stats.recv_rtcp_packets, 0, int, "%i"); + BC_ASSERT_EQUAL(linphone_call_get_video_stats(c2)->rtp_stats.recv_rtcp_packets, 0, unsigned long long, "%llu"); } } if (linphone_core_rtcp_enabled(callee->lc)) { - BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c2)->rtp_stats.sent_rtcp_packets, 0, int, "%i"); - BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c1)->rtp_stats.recv_rtcp_packets, 0, int, "%i"); + BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c2)->rtp_stats.sent_rtcp_packets, 0, unsigned long long, "%llu"); + BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c1)->rtp_stats.recv_rtcp_packets, 0, unsigned long long, "%llu"); if (linphone_call_log_video_enabled(linphone_call_get_call_log(c1))) { - BC_ASSERT_EQUAL(linphone_call_get_video_stats(c1)->rtp_stats.recv_rtcp_packets, 0, int, "%i"); + BC_ASSERT_EQUAL(linphone_call_get_video_stats(c1)->rtp_stats.recv_rtcp_packets, 0, unsigned long long, "%llu"); } if (linphone_call_log_video_enabled(linphone_call_get_call_log(c2))) { - BC_ASSERT_EQUAL(linphone_call_get_video_stats(c2)->rtp_stats.sent_rtcp_packets, 0, int, "%i"); + BC_ASSERT_EQUAL(linphone_call_get_video_stats(c2)->rtp_stats.sent_rtcp_packets, 0, unsigned long long, "%llu"); } } @@ -4076,8 +4076,8 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) { rtp_stats_t pauline_rtp_stats = linphone_call_stats_get_rtp_stats(pauline_stats); ms_message("Marie sent %i RTP packets and received %i (for real)", (int)marie_rtp_stats.packet_sent, (int)marie_rtp_stats.packet_recv); ms_message("Pauline sent %i RTP packets and received %i (for real)", (int)pauline_rtp_stats.packet_sent, (int)pauline_rtp_stats.packet_recv); - BC_ASSERT_EQUAL(data_marie->packetReceivedCount, marie_rtp_stats.packet_recv, int, "%i"); - BC_ASSERT_EQUAL(data_marie->packetSentCount, marie_rtp_stats.packet_sent, int, "%i"); + BC_ASSERT_EQUAL(data_marie->packetReceivedCount, marie_rtp_stats.packet_recv, unsigned long long, "%llu"); + BC_ASSERT_EQUAL(data_marie->packetSentCount, marie_rtp_stats.packet_sent, unsigned long long, "%llu"); // There can be a small difference between the number of packets received in the modifier and the number processed in reception because the processing is asynchronous BC_ASSERT_TRUE(data_pauline->packetReceivedCount - pauline_rtp_stats.packet_recv < 20); BC_ASSERT_TRUE(data_pauline->packetSentCount == pauline_rtp_stats.packet_sent); @@ -4345,7 +4345,7 @@ static void call_logs_if_no_db_set(void) { static void call_logs_migrate(void) { LinphoneCoreManager* laure = linphone_core_manager_new("laure_call_logs_rc"); char *logs_db = bc_tester_file("call_logs.db"); - int i = 0; + size_t i = 0; int incoming_count = 0, outgoing_count = 0, missed_count = 0, aborted_count = 0, decline_count = 0, video_enabled_count = 0; unlink(logs_db); @@ -4441,7 +4441,7 @@ static void call_logs_sqlite_storage(void) { const char *ref_key = linphone_call_log_get_ref_key(call_log); call_log = logs->data; BC_ASSERT_EQUAL(linphone_call_log_get_dir(call_log), LinphoneCallOutgoing, int, "%d"); - BC_ASSERT_LOWER(linphone_call_log_get_duration(call_log), 2, float, "%.1f"); + BC_ASSERT_LOWER(linphone_call_log_get_duration(call_log), 2, int, "%d"); BC_ASSERT_TRUE(linphone_address_equal( linphone_call_log_get_from_address(call_log), linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(marie->lc)))); @@ -4449,7 +4449,7 @@ static void call_logs_sqlite_storage(void) { linphone_call_log_get_to_address(call_log), linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc)))); BC_ASSERT_PTR_NOT_NULL(linphone_call_log_get_local_stats(call_log)); - BC_ASSERT_GREATER(linphone_call_log_get_quality(call_log), -1, int, "%d"); + BC_ASSERT_GREATER(linphone_call_log_get_quality(call_log), -1, float, "%.1f"); BC_ASSERT_PTR_NOT_NULL(ref_key); if (ref_key) { BC_ASSERT_STRING_EQUAL(ref_key, "ref_key"); @@ -4469,7 +4469,7 @@ static void call_logs_sqlite_storage(void) { linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc)))); BC_ASSERT_PTR_NOT_NULL(linphone_call_log_get_remote_stats(call_log)); - BC_ASSERT_EQUAL(linphone_call_log_get_start_date(call_log), start_time, int, "%d"); + BC_ASSERT_EQUAL(linphone_call_log_get_start_date(call_log), start_time, unsigned long long, "%llu"); BC_ASSERT_EQUAL(linphone_call_log_get_status(call_log), LinphoneCallSuccess, int, "%d"); } diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index e16c78301..d487a4fd5 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -24,7 +24,11 @@ #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif #ifdef HAVE_GTK #include diff --git a/tester/message_tester.c b/tester/message_tester.c index 84ba9750c..27ed406d3 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -30,8 +30,12 @@ #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else #pragma GCC diagnostic ignored "-Wstrict-prototypes" #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif static char* message_external_body_url=NULL; @@ -911,8 +915,8 @@ static void lime_transfer_message_without_encryption(void) { lime_transfer_message_base(FALSE); } -static void printHex(char *title, uint8_t *data, uint32_t length) { - int i; +static void printHex(char *title, uint8_t *data, size_t length) { + size_t i; char debug_string_buffer[2048]; char *debug_string = debug_string_buffer; sprintf (debug_string, "%s : ", title); @@ -1430,7 +1434,7 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo BC_ASSERT_PTR_NOT_NULL(pauline_chat_room); if (pauline_chat_room) { const char* message = "Be l3l"; - int i; + size_t i; LinphoneChatMessage* rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL); LinphoneChatRoom *marie_chat_room = linphone_call_get_chat_room(marie_call); @@ -1523,7 +1527,7 @@ static void real_time_text_conversation(void) { const char* message1_2 = "Ipsum"; const char* message2_1 = "Be lle Com"; const char* message2_2 = "eB ell moC"; - int i; + size_t i; LinphoneChatMessage* pauline_rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL); LinphoneChatMessage* marie_rtt_message = linphone_chat_room_create_message(marie_chat_room,NULL); @@ -1632,7 +1636,7 @@ static void real_time_text_message_compat(bool_t end_with_crlf, bool_t end_with_ BC_ASSERT_PTR_NOT_NULL(pauline_chat_room); if (pauline_chat_room) { const char* message = "Be l3l"; - int i; + size_t i; LinphoneChatMessage* rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL); LinphoneChatRoom *marie_chat_room = linphone_call_get_chat_room(marie_call); uint32_t crlf = 0x0D0A; @@ -1746,7 +1750,7 @@ static void real_time_text_copy_paste(void) { BC_ASSERT_PTR_NOT_NULL(pauline_chat_room); if (pauline_chat_room) { const char* message = "Be l3l"; - int i; + size_t i; LinphoneChatMessage* rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL); LinphoneChatRoom *marie_chat_room = linphone_call_get_chat_room(marie_call); diff --git a/tester/presence_tester.c b/tester/presence_tester.c index b14914800..6aca492ab 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -49,7 +49,7 @@ void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char void notify_presence_received(LinphoneCore *lc, LinphoneFriend * lf) { stats* counters; - int i; + unsigned int i; char* from=linphone_address_as_string(linphone_friend_get_address(lf)); ms_message("New Notify request from [%s] ",from); ms_free(from); diff --git a/tester/quality_reporting_tester.c b/tester/quality_reporting_tester.c index ec321b2dd..62f126f6f 100644 --- a/tester/quality_reporting_tester.c +++ b/tester/quality_reporting_tester.c @@ -400,7 +400,7 @@ static void quality_reporting_interval_report_video_and_rtt(void) { BC_ASSERT_PTR_NOT_NULL(pauline_chat_room); if (pauline_chat_room) { const char* message = "Lorem Ipsum Belledonnum Communicatum"; - int i; + size_t i; LinphoneChatMessage* rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL); LinphoneChatRoom *marie_chat_room = linphone_call_get_chat_room(call_marie); diff --git a/tester/tester.c b/tester/tester.c index cb00b9abe..c8a896ea6 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -25,7 +25,9 @@ #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifndef _MSC_VER #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#endif #ifdef HAVE_GTK #include @@ -263,7 +265,11 @@ bool_t transport_supported(LinphoneTransportType transport) { #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) { char *rc_path = NULL; char *hellopath = bc_tester_res("sounds/hello8000.wav"); diff --git a/tester/vcard_tester.c b/tester/vcard_tester.c index bbe135e77..e98730f6d 100644 --- a/tester/vcard_tester.c +++ b/tester/vcard_tester.c @@ -287,8 +287,8 @@ static void friends_sqlite_storage(void) { linphone_friend_list_set_display_name(lfl, "Test"); BC_ASSERT_EQUAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%i"); linphone_friend_unref(lf); - BC_ASSERT_EQUAL(lfl->storage_id, 1, int, "%d"); - BC_ASSERT_EQUAL(lf->storage_id, 1, int, "%d"); + BC_ASSERT_EQUAL(lfl->storage_id, 1, unsigned int, "%u"); + BC_ASSERT_EQUAL(lf->storage_id, 1, unsigned int, "%u"); friends = linphone_friend_list_get_friends(linphone_core_get_default_friend_list(lc)); BC_ASSERT_EQUAL(ms_list_size(friends), 0, int, "%d"); @@ -309,7 +309,7 @@ static void friends_sqlite_storage(void) { } lf2 = (LinphoneFriend *)friends_from_db->data; BC_ASSERT_STRING_EQUAL(linphone_friend_get_name(lf2), linphone_friend_get_name(lf)); - BC_ASSERT_EQUAL(lf2->storage_id, lf->storage_id, int, "%i"); + BC_ASSERT_EQUAL(lf2->storage_id, lf->storage_id, unsigned int, "%u"); BC_ASSERT_STRING_EQUAL(linphone_vcard_get_etag(linphone_friend_get_vcard(lf2)), linphone_vcard_get_etag(linphone_friend_get_vcard(lf))); BC_ASSERT_STRING_EQUAL(linphone_vcard_get_url(linphone_friend_get_vcard(lf2)), linphone_vcard_get_url(linphone_friend_get_vcard(lf))); BC_ASSERT_STRING_EQUAL(linphone_address_as_string(linphone_friend_get_address(lf2)), linphone_address_as_string(linphone_friend_get_address(lf))); @@ -611,7 +611,7 @@ static void carddav_integration(void) { BC_ASSERT_EQUAL(ms_list_size(lfl->friends), 1, int, "%i"); lf = (LinphoneFriend *)lfl->friends->data; BC_ASSERT_STRING_EQUAL(lf->refkey, refkey); - BC_ASSERT_EQUAL(lf->storage_id, lf2->storage_id, int, "%i"); + BC_ASSERT_EQUAL(lf->storage_id, lf2->storage_id, unsigned int, "%u"); linphone_friend_unref(lf2); BC_ASSERT_STRING_EQUAL(linphone_address_as_string_uri_only(lf->uri), "sip:sylvain@sip.linphone.org"); diff --git a/tester/video_tester.c b/tester/video_tester.c index d1be16593..2b4df2a28 100644 --- a/tester/video_tester.c +++ b/tester/video_tester.c @@ -27,7 +27,9 @@ #if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) #pragma GCC diagnostic push #endif +#ifndef _MSC_VER #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#endif #if HAVE_GTK #include