Commit c13647f8 authored by Ghislain MARY's avatar Ghislain MARY

Treat warnings as errors on Windows.

parent 0e082f1a
......@@ -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")
......
......@@ -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)
......
......@@ -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;
......
......@@ -37,6 +37,7 @@
#include <linphonecore.h>
#include "linphonec.h"
#include <bctoolbox/bc_vfs.h>
#ifdef _WIN32
#include <ws2tcpip.h>
......@@ -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) )
{
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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;
}
}
......
......@@ -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){
......
......@@ -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);
......
......@@ -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.
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
#include <bctoolbox/bc_vfs.h>
#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
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
#include <bctoolbox/bc_vfs.h>
#ifdef HAVE_GTK_OSX
#include <gtkosxapplication.h>
......@@ -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)) {
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
#include <bctoolbox/bc_vfs.h>
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){