Commit b2a0cd77 authored by Ronan's avatar Ronan

fix(core): deal with new cpp flags

parent 8ae87e2f
......@@ -348,7 +348,7 @@ void linphone_account_creator_set_user_data(LinphoneAccountCreator *creator, voi
LinphoneAccountCreatorUsernameStatus linphone_account_creator_set_username(LinphoneAccountCreator *creator, const char *username) {
int min_length = lp_config_get_int(creator->core->config, "assistant", "username_min_length", -1);
int max_length = lp_config_get_int(creator->core->config, "assistant", "username_max_length", -1);
bool_t use_phone_number = lp_config_get_int(creator->core->config, "assistant", "use_phone_number", 0);
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);
if (!username) {
creator->username = NULL;
......
......@@ -219,7 +219,7 @@ void linphone_auth_info_destroy(LinphoneAuthInfo *obj){
void linphone_auth_info_write_config(LpConfig *config, LinphoneAuthInfo *obj, int pos) {
char key[50];
bool_t store_ha1_passwd = lp_config_get_int(config, "sip", "store_ha1_passwd", 1);
bool_t store_ha1_passwd = !!lp_config_get_int(config, "sip", "store_ha1_passwd", 1);
sprintf(key, "auth_info_%i", pos);
lp_config_clean_section(config, key);
......
......@@ -58,7 +58,7 @@ void sal_address_set_secure(SalAddress *addr, bool_t enabled){
bool_t sal_address_is_secure(const SalAddress *addr){
belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);
belle_sip_uri_t* uri = belle_sip_header_address_get_uri(header_addr);
if (uri) return belle_sip_uri_is_secure(uri);
if (uri) return !!belle_sip_uri_is_secure(uri);
return FALSE;
}
......@@ -199,7 +199,7 @@ void sal_address_set_param(SalAddress *addr,const char* name,const char* value){
bool_t sal_address_has_param(const SalAddress *addr, const char *name){
belle_sip_parameters_t* parameters = BELLE_SIP_PARAMETERS(addr);
return belle_sip_parameters_has_parameter(parameters, name);
return !!belle_sip_parameters_has_parameter(parameters, name);
}
const char * sal_address_get_param(const SalAddress *addr, const char *name) {
......@@ -224,7 +224,7 @@ void sal_address_set_uri_params(SalAddress *addr, const char *params){
bool_t sal_address_has_uri_param(const SalAddress *addr, const char *name){
belle_sip_parameters_t* parameters = BELLE_SIP_PARAMETERS(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(addr)));
return belle_sip_parameters_has_parameter(parameters, name);
return !!belle_sip_parameters_has_parameter(parameters, name);
}
const char * sal_address_get_uri_param(const SalAddress *addr, const char *name) {
......
......@@ -658,7 +658,7 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i
sal_address_set_domain(sal_addr,addr);
sal_address_set_port(sal_addr,port);
sal_address_set_transport(sal_addr,tr);
result = sal_add_listen_port(ctx, sal_addr, is_tunneled);
result = sal_add_listen_port(ctx, sal_addr, !!is_tunneled);
sal_address_destroy(sal_addr);
return result;
}
......@@ -1066,9 +1066,9 @@ int sal_generate_uuid(char *uuid, size_t len) {
if (len==0) return -1;
/*create an UUID as described in RFC4122, 4.4 */
belle_sip_random_bytes((unsigned char*)&uuid_struct, sizeof(sal_uuid_t));
uuid_struct.clock_seq_hi_and_reserved&=~(1<<6);
uuid_struct.clock_seq_hi_and_reserved&=(unsigned char)~(1<<6);
uuid_struct.clock_seq_hi_and_reserved|=1<<7;
uuid_struct.time_hi_and_version&=~(0xf<<12);
uuid_struct.time_hi_and_version&=(short unsigned int)~(0xf<<12);
uuid_struct.time_hi_and_version|=4<<12;
written=snprintf(uuid,len,"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", uuid_struct.time_low, uuid_struct.time_mid,
......
......@@ -327,7 +327,7 @@ static void call_process_response(void *op_base, const belle_sip_response_event_
&& (header_content_type = belle_sip_message_get_header_by_type(req,belle_sip_header_content_type_t))
&& strcmp("application",belle_sip_header_content_type_get_type(header_content_type))==0
&& strcmp("media_control+xml",belle_sip_header_content_type_get_subtype(header_content_type))==0) {
unsigned int retry_in = (unsigned int)(1000*((float)rand()/RAND_MAX));
unsigned int retry_in = (unsigned int)(1000*((float)rand()/(float)RAND_MAX));
belle_sip_source_t *s=sal_create_timer(op->base.root,vfu_retry,sal_op_ref(op), retry_in, "vfu request retry");
ms_message("Rejected vfu request on op [%p], just retry in [%ui] ms",op,retry_in);
belle_sip_object_unref(s);
......
......@@ -150,25 +150,25 @@ static void add_rtcp_fb_attributes(belle_sdp_media_description_t *media_desc, co
/* Add trr-int if not set generally. */
if (general_trr_int != TRUE && trr_int != 0) {
add_rtcp_fb_trr_int_attribute(media_desc, payload_type_get_number(pt), avpf_params.trr_interval);
add_rtcp_fb_trr_int_attribute(media_desc, (int8_t)payload_type_get_number(pt), avpf_params.trr_interval);
}
/* Add rtcp-fb attributes according to the AVPF features of the payload types. */
if (avpf_params.features & PAYLOAD_TYPE_AVPF_PLI) {
add_rtcp_fb_nack_attribute(media_desc, payload_type_get_number(pt), BELLE_SDP_RTCP_FB_PLI);
add_rtcp_fb_nack_attribute(media_desc, (int8_t)payload_type_get_number(pt), BELLE_SDP_RTCP_FB_PLI);
}
if (avpf_params.features & PAYLOAD_TYPE_AVPF_SLI) {
add_rtcp_fb_nack_attribute(media_desc, payload_type_get_number(pt), BELLE_SDP_RTCP_FB_SLI);
add_rtcp_fb_nack_attribute(media_desc, (int8_t)payload_type_get_number(pt), BELLE_SDP_RTCP_FB_SLI);
}
if (avpf_params.features & PAYLOAD_TYPE_AVPF_RPSI) {
if (avpf_params.rpsi_compatibility == TRUE) {
add_rtcp_fb_nack_attribute(media_desc, payload_type_get_number(pt), BELLE_SDP_RTCP_FB_RPSI);
add_rtcp_fb_nack_attribute(media_desc, (int8_t)payload_type_get_number(pt), BELLE_SDP_RTCP_FB_RPSI);
} else {
add_rtcp_fb_ack_attribute(media_desc, payload_type_get_number(pt), BELLE_SDP_RTCP_FB_RPSI);
add_rtcp_fb_ack_attribute(media_desc, (int8_t)payload_type_get_number(pt), BELLE_SDP_RTCP_FB_RPSI);
}
}
if (avpf_params.features & PAYLOAD_TYPE_AVPF_FIR) {
add_rtcp_fb_ccm_attribute(media_desc, payload_type_get_number(pt), BELLE_SDP_RTCP_FB_FIR);
add_rtcp_fb_ccm_attribute(media_desc, (int8_t)payload_type_get_number(pt), BELLE_SDP_RTCP_FB_FIR);
}
}
}
......
......@@ -153,7 +153,7 @@ bctbx_list_t * call_logs_read_from_config_file(LinphoneCore *lc){
tmp=lp_config_get_string(cfg,logsection,"refkey",NULL);
if (tmp) cl->refkey=ms_strdup(tmp);
cl->quality=lp_config_get_float(cfg,logsection,"quality",-1);
cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0);
cl->video_enabled=!!lp_config_get_int(cfg,logsection,"video_enabled",0);
tmp=lp_config_get_string(cfg,logsection,"call_id",NULL);
if (tmp) cl->call_id=ms_strdup(tmp);
call_logs=bctbx_list_append(call_logs,cl);
......
......@@ -169,23 +169,25 @@ public:
LocalConference(LinphoneCore *core, LinphoneConference *conf, const Params *params = NULL);
virtual ~LocalConference();
virtual int inviteAddresses(const list<const LinphoneAddress*> &addresses, const LinphoneCallParams *params);
virtual int addParticipant(LinphoneCall *call);
virtual int removeParticipant(LinphoneCall *call);
virtual int removeParticipant(const LinphoneAddress *uri);
virtual int terminate();
virtual int inviteAddresses(const list<const LinphoneAddress*> &addresses, const LinphoneCallParams *params) override;
virtual int addParticipant(LinphoneCall *call) override;
virtual int removeParticipant(LinphoneCall *call) override;
virtual int removeParticipant(const LinphoneAddress *uri) override;
virtual int terminate() override;
virtual int enter();
virtual int leave();
virtual bool isIn() const {return m_localParticipantStream!=NULL;}
virtual int getSize() const;
virtual int enter() override;
virtual int leave() override;
virtual bool isIn() const override {
return m_localParticipantStream!=NULL;
}
virtual int getSize() const override;
virtual int startRecording(const char *path);
virtual int stopRecording();
virtual int startRecording(const char *path) override;
virtual int stopRecording() override;
virtual void onCallStreamStarting(LinphoneCall *call, bool isPausedByRemote);
virtual void onCallStreamStopping(LinphoneCall *call);
virtual void onCallTerminating(LinphoneCall *call);
virtual void onCallStreamStarting(LinphoneCall *call, bool isPausedByRemote) override;
virtual void onCallStreamStopping(LinphoneCall *call) override;
virtual void onCallTerminating(LinphoneCall *call) override;
private:
void addLocalEndpoint();
......@@ -207,18 +209,24 @@ public:
RemoteConference(LinphoneCore *core, LinphoneConference *conf, const Params *params = NULL);
virtual ~RemoteConference();
virtual int inviteAddresses(const list<const LinphoneAddress*> &addresses, const LinphoneCallParams *params);
virtual int addParticipant(LinphoneCall *call);
virtual int removeParticipant(LinphoneCall *call) {return -1;}
virtual int removeParticipant(const LinphoneAddress *uri);
virtual int terminate();
virtual int inviteAddresses(const list<const LinphoneAddress*> &addresses, const LinphoneCallParams *params) override;
virtual int addParticipant(LinphoneCall *call) override;
virtual int removeParticipant(LinphoneCall *call) override {
return -1;
}
virtual int removeParticipant(const LinphoneAddress *uri) override;
virtual int terminate() override;
virtual int enter();
virtual int leave();
virtual bool isIn() const;
virtual int enter() override;
virtual int leave() override;
virtual bool isIn() const override;
virtual int startRecording(const char *path) {return 0;}
virtual int stopRecording() {return 0;}
virtual int startRecording (const char *path) override {
return 0;
}
virtual int stopRecording() override {
return 0;
}
private:
bool focusIsReady() const;
......
......@@ -320,8 +320,7 @@ int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibration
}
rate = lp_config_get_int(lc->config,"sound","echo_cancellation_rate",8000);
lc->ecc=ec_calibrator_new(lc->factory, lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard,rate,cb,audio_init_cb,audio_uninit_cb,cb_data);
lc->ecc->play_cool_tones = lp_config_get_int(lc->config, "sound", "ec_calibrator_cool_tones", 0);
lc->ecc->play_cool_tones = !!lp_config_get_int(lc->config, "sound", "ec_calibrator_cool_tones", 0);
ec_calibrator_start(lc->ecc);
return 0;
}
......@@ -291,7 +291,7 @@ static LinphoneEvent *_linphone_core_create_publish(LinphoneCore *core, Linphone
resource = linphone_proxy_config_get_identity_address(cfg);
lev = linphone_event_new(lc,LinphoneSubscriptionInvalidDir, event,expires);
linphone_configure_op_with_proxy(lc,lev->op,resource,NULL,lp_config_get_int(lc->config,"sip","publish_msg_with_contact",0),cfg);
linphone_configure_op_with_proxy(lc,lev->op,resource,NULL, !!lp_config_get_int(lc->config,"sip","publish_msg_with_contact",0),cfg);
sal_op_set_manual_refresher_mode(lev->op,!lp_config_get_int(lc->config,"sip","refresh_generic_publish",1));
return lev;
}
......
......@@ -889,7 +889,7 @@ void linphone_core_update_friends_subscriptions(LinphoneCore *lc) {
}
bool_t linphone_core_should_subscribe_friends_only_when_registered(const LinphoneCore *lc){
return lp_config_get_int(lc->config,"sip","subscribe_presence_only_when_registered",1);
return !!lp_config_get_int(lc->config,"sip","subscribe_presence_only_when_registered",1);
}
void linphone_core_send_initial_subscribes(LinphoneCore *lc) {
......@@ -1030,7 +1030,7 @@ LinphoneFriend * linphone_friend_new_from_config_file(LinphoneCore *lc, int inde
linphone_friend_set_inc_subscribe_policy(lf,__policy_str_to_enum(tmp));
}
a=lp_config_get_int(config,item,"subscribe",0);
linphone_friend_send_subscribe(lf,a);
linphone_friend_send_subscribe(lf,!!a);
a = lp_config_get_int(config, item, "presence_received", 0);
lf->presence_received = (bool_t)a;
......@@ -1156,7 +1156,7 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) {
lc = fr->friend_list->lc;
}
if (lc) {
skip = 1 - lp_config_get_int(fr->lc->config, "misc", "store_friends", 1);
skip = !lp_config_get_int(fr->lc->config, "misc", "store_friends", 1);
linphone_vcard_set_skip_validation(vcard, skip);
}
linphone_vcard_set_full_name(vcard, name);
......@@ -1410,9 +1410,9 @@ static int create_friend(void *data, int argc, char **argv, char **colName) {
}
}
linphone_friend_set_inc_subscribe_policy(lf, static_cast<LinphoneSubscribePolicy>(atoi(argv[3])));
linphone_friend_send_subscribe(lf, atoi(argv[4]));
linphone_friend_send_subscribe(lf, !!atoi(argv[4]));
linphone_friend_set_ref_key(lf, ms_strdup(argv[5]));
lf->presence_received = atoi(argv[9]);
lf->presence_received = !!atoi(argv[9]);
lf->storage_id = storage_id;
*list = bctbx_list_append(*list, linphone_friend_ref(lf));
......
......@@ -144,7 +144,7 @@ int lime_getCachedSndKeysByURI(void *cachedb, limeURIKeys_t *associatedKeys) {
/* check validity */
bctbx_get_utc_cur_time(&currentTimeSpec);
if (validityTimeSpec.tv_sec == 0 || bctbx_timespec_compare(&currentTimeSpec, &validityTimeSpec)<0) {
associatedKeys->associatedZIDNumber +=1;
associatedKeys->associatedZIDNumber++;
/* extend array of pointer to limeKey_t structures to add the one we found */
associatedKeys->peerKeys = (limeKey_t **)bctbx_realloc(associatedKeys->peerKeys, (associatedKeys->associatedZIDNumber)*sizeof(limeKey_t *));
......@@ -257,14 +257,14 @@ int lime_setCachedKey(void *cachedb, limeKey_t *associatedKey, uint8_t role, uin
uint8_t *colValues[4];
uint8_t sessionIndex[4]; /* buffer to hold the uint32_t buffer index in big endian */
size_t colLength[] = {32, 32, 4, 8}; /* data length: keys and session ID : 32 bytes, Index: 4 bytes(uint32_t), validity : 8 bytes(UTC time as int64_t) */
int colNums;
uint8_t colNums;
if (cachedb == NULL || associatedKey == NULL) { /* there is no cache return error */
return LIME_INVALID_CACHE;
}
/* wrap values to be written */
sessionIndex[0] = (associatedKey->sessionIndex>>24)&0xFF;
sessionIndex[0] = (uint8_t)((associatedKey->sessionIndex>>24)&0xFF);
sessionIndex[1] = (associatedKey->sessionIndex>>16)&0xFF;
sessionIndex[2] = (associatedKey->sessionIndex>>8)&0xFF;
sessionIndex[3] = (associatedKey->sessionIndex)&0xFF;
......@@ -277,14 +277,14 @@ int lime_setCachedKey(void *cachedb, limeKey_t *associatedKey, uint8_t role, uin
bctbx_get_utc_cur_time(&currentTime);
bctbx_timespec_add(&currentTime, validityTimeSpan);
/* store the int64_t in big endian in the cache(cache is not typed, all data seen as blob) */
colValues[3][0] = (currentTime.tv_sec>>56)&0xFF;
colValues[3][1] = (currentTime.tv_sec>>48)&0xFF;
colValues[3][2] = (currentTime.tv_sec>>40)&0xFF;
colValues[3][3] = (currentTime.tv_sec>>32)&0xFF;
colValues[3][4] = (currentTime.tv_sec>>24)&0xFF;
colValues[3][5] = (currentTime.tv_sec>>16)&0xFF;
colValues[3][6] = (currentTime.tv_sec>>8)&0xFF;
colValues[3][7] = (currentTime.tv_sec)&0xFF;
colValues[3][0] = (uint8_t)((currentTime.tv_sec>>56)&0xFF);
colValues[3][1] = (uint8_t)((currentTime.tv_sec>>48)&0xFF);
colValues[3][2] = (uint8_t)((currentTime.tv_sec>>40)&0xFF);
colValues[3][3] = (uint8_t)((currentTime.tv_sec>>32)&0xFF);
colValues[3][4] = (uint8_t)((currentTime.tv_sec>>24)&0xFF);
colValues[3][5] = (uint8_t)((currentTime.tv_sec>>16)&0xFF);
colValues[3][6] = (uint8_t)((currentTime.tv_sec>>8)&0xFF);
colValues[3][7] = (uint8_t)((currentTime.tv_sec)&0xFF);
colNums = 4;
} else {
......@@ -292,7 +292,11 @@ int lime_setCachedKey(void *cachedb, limeKey_t *associatedKey, uint8_t role, uin
}
/* update cache */
return bzrtp_cache_write(cachedb, associatedKey->zuid, "lime", role==LIME_SENDER?colNamesSender:colNamesReceiver, colValues, colLength, colNums);
return bzrtp_cache_write(
cachedb, associatedKey->zuid, "lime",
role == LIME_SENDER ? colNamesSender : colNamesReceiver,
colValues, colLength, colNums
);
}
/**
......
......@@ -837,7 +837,7 @@ float linphone_call_stats_get_sender_loss_rate(const LinphoneCallStats *stats) {
rtcp_rewind(stats->sent_rtcp);
if (!srb)
return 0.0;
return 100.0f * report_block_get_fraction_lost(srb) / 256.0f;
return 100.0f * (float)report_block_get_fraction_lost(srb) / 256.0f;
}
float linphone_call_stats_get_receiver_loss_rate(const LinphoneCallStats *stats) {
......@@ -859,7 +859,7 @@ float linphone_call_stats_get_receiver_loss_rate(const LinphoneCallStats *stats)
rtcp_rewind(stats->received_rtcp);
if (!rrb)
return 0.0;
return 100.0f * report_block_get_fraction_lost(rrb) / 256.0f;
return 100.0f * (float)report_block_get_fraction_lost(rrb) / 256.0f;
}
float linphone_call_stats_get_local_loss_rate(const LinphoneCallStats *stats) {
......
This diff is collapsed.
......@@ -299,7 +299,7 @@ int lpc2xml_convert_file(lpc2xml_context* context, const char *filename) {
if(save_ctx != NULL) {
ret = internal_convert_lpc2xml(context);
if(ret == 0) {
ret = xmlSaveDoc(save_ctx, context->doc);
ret = (int)xmlSaveDoc(save_ctx, context->doc);
if(ret != 0) {
lpc2xml_log(context, LPC2XML_ERROR, "Can't save document");
lpc2xml_log(context, LPC2XML_ERROR, "%s", context->errorBuffer);
......@@ -322,7 +322,7 @@ int lpc2xml_convert_fd(lpc2xml_context* context, int fd) {
if(save_ctx != NULL) {
ret = internal_convert_lpc2xml(context);
if(ret == 0) {
ret = xmlSaveDoc(save_ctx, context->doc);
ret = (int)xmlSaveDoc(save_ctx, context->doc);
if(ret != 0) {
lpc2xml_log(context, LPC2XML_ERROR, "Can't save document");
lpc2xml_log(context, LPC2XML_ERROR, "%s", context->errorBuffer);
......@@ -346,7 +346,7 @@ int lpc2xml_convert_string(lpc2xml_context* context, char **content) {
if(save_ctx != NULL) {
ret = internal_convert_lpc2xml(context);
if(ret == 0) {
ret = xmlSaveDoc(save_ctx, context->doc);
ret = (int)xmlSaveDoc(save_ctx, context->doc);
if(ret != 0) {
lpc2xml_log(context, LPC2XML_ERROR, "Can't save document");
lpc2xml_log(context, LPC2XML_ERROR, "%s", context->errorBuffer);
......
......@@ -832,11 +832,11 @@ void linphone_config_set_skip_flag_for_section(LpConfig *lpconfig, const char *s
void lp_item_write(LpItem *item, LpConfig *lpconfig){
int ret =-1 ;
if (item->is_comment){
ret =bctbx_file_fprintf(lpconfig->pFile, 0, "%s\n",item->value);
ret = (int)bctbx_file_fprintf(lpconfig->pFile, 0, "%s\n",item->value);
}
else if (item->value && item->value[0] != '\0' ){
ret =bctbx_file_fprintf(lpconfig->pFile, 0, "%s=%s\n",item->key,item->value);
ret = (int)bctbx_file_fprintf(lpconfig->pFile, 0, "%s=%s\n",item->key,item->value);
}
else {
......
......@@ -64,7 +64,7 @@ static char *utf8_convert(const char *filename){
cb = iconv_open("UTF-8", nl_langinfo(CODESET));
if (cb != (iconv_t)-1) {
int ret;
ret = iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
ret = (int)iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
if(ret == -1) db_file_utf8[0] = '\0';
iconv_close(cb);
}
......
......@@ -326,7 +326,7 @@ unsigned int linphone_core_get_audio_features(LinphoneCore *lc){
}
bool_t linphone_core_tone_indications_enabled(LinphoneCore*lc){
return lp_config_get_int(lc->config,"sound","tone_indications",1);
return !!lp_config_get_int(lc->config,"sound","tone_indications",1);
}
int linphone_core_get_local_ip_for(int type, const char *dest, char *result){
......@@ -835,7 +835,7 @@ bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc){
/* Clients don't really need rtp symmetric, unless they have a public IP address and want
* to interoperate with natted client. This case is not frequent with client apps.
*/
return lp_config_get_int(lc->config,"rtp","symmetric",0);
return !!lp_config_get_int(lc->config,"rtp","symmetric",0);
}
LinphoneStatus linphone_core_set_network_simulator_params(LinphoneCore *lc, const OrtpNetworkSimulatorParams *params){
......
......@@ -116,24 +116,24 @@ static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *cf
const char *nat_policy_ref = lc ? lp_config_get_default_string(lc->config, "proxy", "nat_policy_ref", NULL):NULL;
cfg->lc = lc;
cfg->expires = lc ? lp_config_get_default_int(lc->config, "proxy", "reg_expires", 3600) : 3600;
cfg->reg_sendregister = lc ? lp_config_get_default_int(lc->config, "proxy", "reg_sendregister", 1) : 1;
cfg->reg_sendregister = lc ? !!lp_config_get_default_int(lc->config, "proxy", "reg_sendregister", 1) : 1;
cfg->dial_prefix = dial_prefix ? ms_strdup(dial_prefix) : NULL;
cfg->dial_escape_plus = lc ? lp_config_get_default_int(lc->config, "proxy", "dial_escape_plus", 0) : 0;
cfg->dial_escape_plus = lc ? !!lp_config_get_default_int(lc->config, "proxy", "dial_escape_plus", 0) : 0;
cfg->privacy = lc ? lp_config_get_default_int(lc->config, "proxy", "privacy", LinphonePrivacyDefault) : LinphonePrivacyDefault;
cfg->identity_address = identity ? linphone_address_new(identity) : NULL;
cfg->reg_identity = cfg->identity_address ? linphone_address_as_string(cfg->identity_address) : NULL;
cfg->reg_proxy = proxy ? ms_strdup(proxy) : NULL;
cfg->reg_route = route ? ms_strdup(route) : NULL;
cfg->realm = realm ? ms_strdup(realm) : NULL;
cfg->quality_reporting_enabled = lc ? lp_config_get_default_int(lc->config, "proxy", "quality_reporting_enabled", 0) : 0;
cfg->quality_reporting_enabled = lc ? !!lp_config_get_default_int(lc->config, "proxy", "quality_reporting_enabled", 0) : 0;
cfg->quality_reporting_collector = quality_reporting_collector ? ms_strdup(quality_reporting_collector) : NULL;
cfg->quality_reporting_interval = lc ? lp_config_get_default_int(lc->config, "proxy", "quality_reporting_interval", 0) : 0;
cfg->quality_reporting_interval = lc ? !!lp_config_get_default_int(lc->config, "proxy", "quality_reporting_interval", 0) : 0;
cfg->contact_params = contact_params ? ms_strdup(contact_params) : NULL;
cfg->contact_uri_params = contact_uri_params ? ms_strdup(contact_uri_params) : NULL;
cfg->avpf_mode = lc ? static_cast<LinphoneAVPFMode>(lp_config_get_default_int(lc->config, "proxy", "avpf", LinphoneAVPFDefault)) : LinphoneAVPFDefault;
cfg->avpf_rr_interval = lc ? lp_config_get_default_int(lc->config, "proxy", "avpf_rr_interval", 5) : 5;
cfg->avpf_rr_interval = lc ? !!lp_config_get_default_int(lc->config, "proxy", "avpf_rr_interval", 5) : 5;
cfg->publish_expires= lc ? lp_config_get_default_int(lc->config, "proxy", "publish_expires", -1) : -1;
cfg->publish = lc ? lp_config_get_default_int(lc->config, "proxy", "publish", FALSE) : FALSE;
cfg->publish = lc ? !!lp_config_get_default_int(lc->config, "proxy", "publish", FALSE) : FALSE;
cfg->refkey = refkey ? ms_strdup(refkey) : NULL;
if (nat_policy_ref) {
LinphoneNatPolicy *policy = linphone_config_create_nat_policy_from_section(lc->config,nat_policy_ref);
......@@ -570,7 +570,7 @@ bool_t linphone_proxy_config_quality_reporting_enabled(LinphoneProxyConfig *cfg)
}
void linphone_proxy_config_set_quality_reporting_interval(LinphoneProxyConfig *cfg, int interval) {
cfg->quality_reporting_interval = interval;
cfg->quality_reporting_interval = !!interval;
}
int linphone_proxy_config_get_quality_reporting_interval(LinphoneProxyConfig *cfg) {
......@@ -1165,10 +1165,10 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC
}
#define CONFIGURE_BOOL_VALUE(cfg,config,key,param,param_name) \
linphone_proxy_config_enable_##param(cfg,lp_config_get_int(config,key,param_name,linphone_proxy_config_##param##_enabled(cfg)));
linphone_proxy_config_enable_##param(cfg, !!lp_config_get_int(config,key,param_name,linphone_proxy_config_##param##_enabled(cfg)));
#define CONFIGURE_INT_VALUE(cfg,config,key,param,param_name) \
linphone_proxy_config_set_##param(cfg,lp_config_get_int(config,key,param_name,linphone_proxy_config_get_##param(cfg)));
linphone_proxy_config_set_##param(cfg, !!lp_config_get_int(config,key,param_name,linphone_proxy_config_get_##param(cfg)));
LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc, int index)
{
......
......@@ -35,7 +35,7 @@ static void guess_display_name(LinphoneAddress *from){
bool_t surname=0;
for(it=linphone_address_get_username(from);*it!='\0';++it){
if (begin){
*wptr=toupper(*it);
*wptr = (char)toupper(*it);
begin=FALSE;
}else if (*it=='.'){
if (surname) break;
......
......@@ -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, (off_t)offset);
ret = (int)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, (off_t)offset);
ret = (int)bctbx_file_write(pFile->pbctbx_file, buf, count, (off_t)offset);
if(ret > 0 ) return SQLITE_OK;
else {
return SQLITE_IOERR_WRITE;
......@@ -297,8 +297,7 @@ static char* ConvertFromUtf8Filename(const char* fName){
strncpy(db_file_utf8, fName, MAX_PATH_SIZE-1);
cb = iconv_open(nl_langinfo(CODESET), "UTF-8");
if (cb != (iconv_t)-1) {
int ret;
ret = iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
int ret = (int)iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
if(ret == -1) db_file_locale[0] = '\0';
iconv_close(cb);
}
......
......@@ -432,7 +432,7 @@ bool_t linphone_vcard_compare_md5_hash(LinphoneVcard *vCard) {
unsigned char previous_md5[VCARD_MD5_HASH_SIZE];
memcpy(previous_md5, vCard->md5, VCARD_MD5_HASH_SIZE);
linphone_vcard_compute_md5_hash(vCard);
return memcmp(vCard->md5, previous_md5, VCARD_MD5_HASH_SIZE);
return !!memcmp(vCard->md5, previous_md5, VCARD_MD5_HASH_SIZE);
}
bool_t linphone_core_vcard_supported(void) {
......
......@@ -788,7 +788,7 @@ void CallSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg
/* We already have an op for incoming calls */
d->op = op;
sal_op_set_user_pointer(d->op, this);
sal_op_cnx_ip_to_0000_if_sendonly_enable(op, lp_config_get_default_int(linphone_core_get_config(d->core),
sal_op_cnx_ip_to_0000_if_sendonly_enable(op, !!lp_config_get_default_int(linphone_core_get_config(d->core),
"sip", "cnx_ip_to_0000_if_sendonly_enabled", 0));
d->log->call_id = ms_strdup(sal_op_get_call_id(op)); /* Must be known at that time */
}
......
This diff is collapsed.
......@@ -16,18 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ice-agent.h"
#include "conference/session/media-session-p.h"
#include "linphone/core.h"
#include "conference/session/media-session-p.h"
#include "logger/logger.h"
#include "linphone/core.h"
#include "ice-agent.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
// =============================================================================
bool IceAgent::candidatesGathered () const {
if (!iceSession)
......@@ -43,7 +43,7 @@ void IceAgent::checkSession (IceRole role, bool isReinvite) {
return;
iceSession = ice_session_new();
/* For backward compatibility purposes, shall be enabled by default in the future */
ice_session_enable_message_integrity_check(iceSession, lp_config_get_int(config, "net", "ice_session_enable_message_integrity_check", 1));
ice_session_enable_message_integrity_check(iceSession, !!lp_config_get_int(config, "net", "ice_session_enable_message_integrity_check", 1));
if (lp_config_get_int(config, "net", "dont_default_to_stun_candidates", 0)) {
IceCandidateType types[ICT_CandidateTypeMax];
types[0] = ICT_HostCandidate;
......@@ -494,14 +494,17 @@ void IceAgent::createIceCheckListsAndParseIceAttributes (const SalMediaDescripti
continue;
const char *addr = nullptr;
int port = 0;
getIceDefaultAddrAndPort(candidate->componentID, md, stream, &addr, &port);
getIceDefaultAddrAndPort(static_cast<uint16_t>(candidate->componentID), md, stream, &addr, &port);
if (addr && (candidate->port == port) && (strlen(candidate->addr) == strlen(addr)) && (strcmp(candidate->addr, addr) == 0))
defaultCandidate = true;
int family = AF_INET;
if (strchr(candidate->addr, ':'))
family = AF_INET6;
ice_add_remote_candidate(cl, candidate->type, family, candidate->addr, candidate->port, candidate->componentID,
candidate->priority, candidate->foundation, defaultCandidate);
ice_add_remote_candidate(
cl, candidate->type, family, candidate->addr, candidate->port,
static_cast<uint16_t>(candidate->componentID),
candidate->priority, candidate->foundation, defaultCandidate
);
}
if (!iceRestarted) {
bool_t losingPairsAdded = false;
......@@ -511,7 +514,7 @@ void IceAgent::createIceCheckListsAndParseIceAttributes (const SalMediaDescripti
int port = 0;
int componentID = j + 1;
if (remoteCandidate->addr[0] == '\0') break;
getIceDefaultAddrAndPort(componentID, md, stream, &addr, &port);
getIceDefaultAddrAndPort(static_cast<uint16_t>(componentID), md, stream, &addr, &port);
if (j == 0) /* If we receive a re-invite and we finished ICE processing on our side, use the candidates given by the remote. */
ice_check_list_unselect_valid_pairs(cl);
int remoteFamily = AF_INET;
......@@ -520,7 +523,7 @@ void IceAgent::createIceCheckListsAndParseIceAttributes (const SalMediaDescripti
int family = AF_INET;
if (strchr(addr, ':'))
family = AF_INET6;
ice_add_losing_pair(cl, j + 1, remoteFamily, remoteCandidate->addr, remoteCandidate->port, family, addr, port);
ice_add_losing_pair(cl, static_cast<uint16_t>(j + 1), remoteFamily, remoteCandidate->addr, remoteCandidate->port, family, addr, port);
losingPairsAdded = true;
}
if (losingPairsAdded)
......
......@@ -16,20 +16,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stun-client.h"
#include "linphone/core.h"
#include "private.h"
#include "logger/logger.h"
#include "linphone/core.h"
#include "stun-client.h"
#include "private.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
// =============================================================================
int StunClient::run (int audioPort, int videoPort, int textPort) {
if (linphone_core_ipv6_enabled(core)) {
lWarning() << "STUN support is not implemented for ipv6";
......@@ -107,7 +107,7 @@ int StunClient::run (int audioPort, int videoPort, int textPort) {
}
struct timeval cur;
ortp_gettimeofday(&cur, nullptr);
elapsed = ((cur.tv_sec - init.tv_sec) * 1000.) + ((cur.tv_usec - init.tv_usec) / 1000.);
elapsed = static_cast<double>(cur.tv_sec - init.tv_sec) * 1000 + static_cast<double>(cur.tv_usec - init.tv_usec) / 1000;
if (elapsed > 2000.) {
lInfo() << "STUN responses timeout, going ahead";
ret = -1;
......@@ -181,7 +181,7 @@ ortp_socket_t StunClient::createStunSocket (int localPort) {
memset(&laddr, 0, sizeof(laddr));
laddr.sin_family = AF_INET;
laddr.sin_addr.s_addr = INADDR_ANY;
laddr.sin_port = htons(localPort);
laddr.sin_port = htons(static_cast<uint16_t>(localPort));
if (bind(sock, (struct sockaddr *)&laddr, sizeof(laddr)) < 0) {
lError() << "Bind socket to 0.0.0.0:" << localPort << " failed: " << getSocketError();
close_socket(sock);
......@@ -198,7 +198,7 @@ int StunClient::recvStunResponse(ortp_socket_t sock, Candidate &candidate, int &
char buf[MS_STUN_MAX_MESSAGE_SIZE];
int len = MS_STUN_MAX_MESSAGE_SIZE;
len = recv(sock, buf, len, 0);
len = static_cast<int>(recv(sock, buf, len, 0));
if (len > 0) {
struct in_addr ia;
MSStunMessage *resp = ms_stun_message_create_from_buffer_parsing((uint8_t *)buf, (ssize_t)len);
......@@ -227,7 +227,7 @@ int StunClient::recvStunResponse(ortp_socket_t sock, Candidate &candidate, int &
int StunClient::sendStunRequest(ortp_socket_t sock, const struct sockaddr *server, socklen_t addrlen, int id, bool changeAddr) {
MSStunMessage *req = ms_stun_binding_request_create();
UInt96 trId = ms_stun_message_get_tr_id(req);
trId.octet[0] = id;
trId.octet[0] = static_cast<unsigned char>(id);
ms_stun_message_set_tr_id(req, trId);
ms_stun_message_enable_change_ip(req, changeAddr);
ms_stun_message_enable_change_port(req, changeAddr);
......@@ -238,7 +238,7 @@ int StunClient::sendStunRequest(ortp_socket_t sock, const struct sockaddr *serve
lError() << "Failed to encode STUN message";
err = -1;
} else {
err = bctbx_sendto(sock, buf, len, 0, server, addrlen);
err = static_cast<int>(bctbx_sendto(sock, buf, len, 0, server, addrlen));
if (err < 0) {
lError() << "sendto failed: " << strerror(errno);
err = -1;
......
......@@ -86,7 +86,7 @@ string Utils::toString (const void *val) {
int Utils::stoi (const string &str, size_t *idx, int base) {
char *p;
int v = strtol(str.c_str(), &p, base);
int v = static_cast<int>(strtol(str.c_str(), &p, base));
if (idx)
*idx = p - str.c_str();
......@@ -129,22 +129,22 @@ char *Utils::utf8ToChar (uint32_t ic) {
char *result = new char[5];
int size = 0;
if (ic < 0x80) {
result[0] = ic;
result[0] = static_cast<char>(ic);
size = 1;
} else if (ic < 0x800) {
result[1] = 0x80 + ((ic & 0x3F));
result[0] = 0xC0 + ((ic >> 6) & 0x1F);
result[1] = static_cast<char>(0x80 + ((ic & 0x3F)));
result[0] = static_cast<char>(0xC0 + ((ic >> 6) & 0x1F));
size = 2;