fix(core): deal with new cpp flags

This commit is contained in:
Ronan Abhamon 2017-09-20 12:40:15 +02:00
parent 8ae87e2f3f
commit b2a0cd770e
30 changed files with 369 additions and 344 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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) {

View file

@ -84,7 +84,7 @@ void sal_set_log_level(OrtpLogLevel level) {
if (((level&ORTP_DEBUG) != 0) || ((level&ORTP_TRACE) != 0)) {
belle_sip_level = BELLE_SIP_LOG_DEBUG;
}
belle_sip_set_log_level(belle_sip_level);
}
static BctbxLogFunc _belle_sip_log_handler = bctbx_logv_out;
@ -215,7 +215,7 @@ static void process_request_event(void *ud, const belle_sip_request_event_t *eve
if (dialog) {
op=(SalOp*)belle_sip_dialog_get_application_data(dialog);
if (op == NULL && strcmp("NOTIFY",method) == 0) {
/*special case for Dialog created by notify mathing subscribe*/
belle_sip_transaction_t * sub_trans = belle_sip_dialog_get_last_transaction(dialog);
@ -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;
}
@ -986,7 +986,7 @@ const char *sal_custom_header_find(const SalCustomHeader *ch, const char *name){
SalCustomHeader *sal_custom_header_remove(SalCustomHeader *ch, const char *name) {
belle_sip_message_t *msg=(belle_sip_message_t*)ch;
if (msg==NULL) return NULL;
belle_sip_message_remove_header(msg, name);
return (SalCustomHeader*)msg;
}
@ -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,

View file

@ -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);

View file

@ -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);
}
}
}
@ -263,9 +263,9 @@ static void stream_description_to_sdp ( belle_sdp_session_description_t *session
if (ms_crypto_suite_to_name_params(stream->crypto[j].algo,&desc)==0){
if (desc.params)
snprintf ( buffer, sizeof ( buffer )-1, "%d %s inline:%s %s", stream->crypto[j].tag, desc.name, stream->crypto[j].master_key,desc.params);
else
else
snprintf ( buffer, sizeof ( buffer )-1, "%d %s inline:%s", stream->crypto[j].tag, desc.name, stream->crypto[j].master_key );
belle_sdp_media_description_add_attribute( media_desc,belle_sdp_attribute_create ("crypto", buffer));
}else break;
}
@ -314,11 +314,11 @@ static void stream_description_to_sdp ( belle_sdp_session_description_t *session
break;
}
if ( dir ) belle_sdp_media_description_add_attribute ( media_desc,belle_sdp_attribute_create ( dir,NULL ) );
if (stream->rtcp_mux){
belle_sdp_media_description_add_attribute(media_desc, belle_sdp_attribute_create ("rtcp-mux",NULL ) );
}
if (rtp_port != 0) {
different_rtp_and_rtcp_addr = (rtcp_addr[0] != '\0') && (strcmp(rtp_addr, rtcp_addr) != 0);
if ((rtcp_port != (rtp_port + 1)) || (different_rtp_and_rtcp_addr == TRUE)) {
@ -337,7 +337,7 @@ static void stream_description_to_sdp ( belle_sdp_session_description_t *session
belle_sdp_media_description_add_attribute(media_desc,belle_sdp_attribute_create ("ice-mismatch",NULL));
} else {
if (rtp_port != 0) {
if (stream->ice_pwd[0] != '\0')
if (stream->ice_pwd[0] != '\0')
belle_sdp_media_description_add_attribute(media_desc,belle_sdp_attribute_create ("ice-pwd",stream->ice_pwd));
if (stream->ice_ufrag[0] != '\0')
belle_sdp_media_description_add_attribute(media_desc,belle_sdp_attribute_create ("ice-ufrag",stream->ice_ufrag));
@ -432,7 +432,7 @@ belle_sdp_session_description_t * media_description_to_sdp ( const SalMediaDescr
if ( desc->bandwidth>0 ) {
belle_sdp_session_description_set_bandwidth ( session_desc,"AS",desc->bandwidth );
}
if (desc->set_nortpproxy == TRUE) belle_sdp_session_description_add_attribute(session_desc, belle_sdp_attribute_create("nortpproxy","yes"));
if (desc->ice_pwd[0] != '\0') belle_sdp_session_description_add_attribute(session_desc, belle_sdp_attribute_create("ice-pwd",desc->ice_pwd));
if (desc->ice_ufrag[0] != '\0') belle_sdp_session_description_add_attribute(session_desc, belle_sdp_attribute_create("ice-ufrag",desc->ice_ufrag));
@ -501,7 +501,7 @@ static void sdp_parse_media_crypto_parameters(belle_sdp_media_description_t *med
&stream->crypto[valid_count].tag,
tmp,
tmp2, parameters );
if ( nb >= 3 ) {
MSCryptoSuite cs;
MSCryptoSuiteNameParams np;
@ -651,7 +651,7 @@ static bool_t sdp_parse_rtcp_fb_parameters(belle_sdp_media_description_t *media_
PayloadType *pt;
int8_t pt_num;
bool_t retval = FALSE;
/* Handle rtcp-fb attributes that concern all payload types. */
for (it = belle_sdp_media_description_get_attributes(media_desc); it != NULL; it = it->next) {
attribute = BELLE_SDP_ATTRIBUTE(it->data);
@ -805,7 +805,7 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md,
}
stream->rtcp_mux = belle_sdp_media_description_get_attribute(media_desc, "rtcp-mux") != NULL;
/* Get media payload types */
sdp_parse_payload_types(media_desc, stream);
@ -857,7 +857,7 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md,
/* Get ICE candidate attributes if any */
sdp_parse_media_ice_parameters(media_desc, stream);
has_avpf_attributes = sdp_parse_rtcp_fb_parameters(media_desc, stream);
/* Get RTCP-FB attributes if any */
@ -892,7 +892,7 @@ int sdp_to_media_description ( belle_sdp_session_description_t *session_desc, S
const char* value;
SalDtlsRole session_role=SalDtlsRoleInvalid;
int i;
desc->nb_streams = 0;
desc->dir = SalStreamSendRecv;
@ -902,11 +902,11 @@ int sdp_to_media_description ( belle_sdp_session_description_t *session_desc, S
if ( (sname=belle_sdp_session_description_get_session_name(session_desc)) && belle_sdp_session_name_get_value(sname) ){
strncpy(desc->name,belle_sdp_session_name_get_value(sname),sizeof(desc->name) - 1);
}
if ( belle_sdp_session_description_get_bandwidth ( session_desc,"AS" ) >0 ) {
desc->bandwidth=belle_sdp_session_description_get_bandwidth ( session_desc,"AS" );
}
/*in some very rare case, session attribute may set stream dir*/
if ( belle_sdp_session_description_get_attribute ( session_desc,"sendrecv" ) ) {
desc->dir=SalStreamSendRecv;
@ -940,10 +940,10 @@ int sdp_to_media_description ( belle_sdp_session_description_t *session_desc, S
/* Get ICE remote ufrag and remote pwd, and ice_lite flag */
value=belle_sdp_session_description_get_attribute_value(session_desc,"ice-ufrag");
if (value) strncpy(desc->ice_ufrag, value, sizeof(desc->ice_ufrag) - 1);
value=belle_sdp_session_description_get_attribute_value(session_desc,"ice-pwd");
if (value) strncpy(desc->ice_pwd, value, sizeof(desc->ice_pwd)-1);
value=belle_sdp_session_description_get_attribute_value(session_desc,"ice-lite");
if (value) desc->ice_lite = TRUE;

View file

@ -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);

View file

@ -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;

View file

@ -47,8 +47,8 @@ static void ecc_init_filters(EcCalibrator *ecc){
ms_filter_call_method(ecc->read_resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&ecc->rate);
ms_filter_call_method(ecc->read_resampler,MS_FILTER_SET_NCHANNELS,&channels);
ms_filter_call_method(ecc->read_resampler,MS_FILTER_SET_OUTPUT_NCHANNELS,&ecc_channels);
ecc->det=ms_factory_create_filter(ecc->factory, MS_TONE_DETECTOR_ID);
ms_filter_call_method(ecc->det,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate);
ecc->rec=ms_factory_create_filter(ecc->factory, MS_VOID_SINK_ID);
@ -62,7 +62,7 @@ static void ecc_init_filters(EcCalibrator *ecc){
ms_filter_call_method(ecc->gen,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate);
ecc->write_resampler=ms_factory_create_filter(ecc->factory, MS_RESAMPLE_ID);
ecc->sndwrite=ms_snd_card_create_writer(ecc->play_card);
ms_filter_call_method(ecc->sndwrite,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate);
ms_filter_call_method(ecc->sndwrite,MS_FILTER_GET_SAMPLE_RATE,&rate);
ms_filter_call_method(ecc->sndwrite,MS_FILTER_SET_NCHANNELS,&ecc_channels);
@ -153,37 +153,37 @@ static void on_tone_received(void *data, MSFilter *f, unsigned int event_id, voi
static void ecc_play_tones(EcCalibrator *ecc){
MSDtmfGenCustomTone tone;
MSToneDetectorDef expected_tone;
memset(&tone,0,sizeof(tone));
memset(&expected_tone,0,sizeof(expected_tone));
ms_filter_add_notify_callback(ecc->det,on_tone_received,ecc,TRUE);
/* configure the tones to be scanned */
strncpy(expected_tone.tone_name,"freq1",sizeof(expected_tone.tone_name));
expected_tone.frequency=(int)2349.32;
expected_tone.min_duration=40;
expected_tone.min_amplitude=0.1f;
ms_filter_call_method (ecc->det,MS_TONE_DETECTOR_ADD_SCAN,&expected_tone);
strncpy(expected_tone.tone_name,"freq2",sizeof(expected_tone.tone_name));
expected_tone.frequency=(int)2637.02;
expected_tone.min_duration=40;
expected_tone.min_amplitude=0.1f;
ms_filter_call_method (ecc->det,MS_TONE_DETECTOR_ADD_SCAN,&expected_tone);
strncpy(expected_tone.tone_name,"freq3",sizeof(expected_tone.tone_name));
expected_tone.frequency=(int)2093;
expected_tone.min_duration=40;
expected_tone.min_amplitude=0.1f;
ms_filter_call_method (ecc->det,MS_TONE_DETECTOR_ADD_SCAN,&expected_tone);
/*play an initial tone to startup the audio playback/capture*/
tone.frequencies[0]=140;
tone.duration=1000;
tone.amplitude=0.5;
@ -192,23 +192,23 @@ static void ecc_play_tones(EcCalibrator *ecc){
ms_sleep(2);
ms_filter_add_notify_callback(ecc->gen,on_tone_sent,ecc,TRUE);
/* play the three tones*/
if (ecc->play_cool_tones){
strncpy(tone.tone_name, "D", sizeof(tone.tone_name));
tone.frequencies[0]=(int)2349.32;
tone.duration=100;
ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone);
ms_usleep(300000);
strncpy(tone.tone_name, "E", sizeof(tone.tone_name));
tone.frequencies[0]=(int)2637.02;
tone.duration=100;
ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone);
ms_usleep(300000);
strncpy(tone.tone_name, "C", sizeof(tone.tone_name));
tone.frequencies[0]=(int)2093;
tone.duration=100;
@ -220,20 +220,20 @@ static void ecc_play_tones(EcCalibrator *ecc){
tone.duration=100;
ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone);
ms_usleep(300000);
strncpy(tone.tone_name, "D", sizeof(tone.tone_name));
tone.frequencies[0]=(int)2349.32;
tone.duration=100;
ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone);
ms_usleep(300000);
strncpy(tone.tone_name, "E", sizeof(tone.tone_name));
tone.frequencies[0]=(int)2637.02;
tone.duration=100;
ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone);
ms_usleep(300000);
}
/*these two next ones are for lyrism*/
if (ecc->play_cool_tones){
tone.tone_name[0]='\0';
@ -241,15 +241,15 @@ static void ecc_play_tones(EcCalibrator *ecc){
tone.duration=400;
ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone);
ms_usleep(300000);
tone.tone_name[0]='\0';
tone.frequencies[0]=(int)1567.98;
tone.duration=400;
ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone);
}
ms_sleep(1);
if (ecc->freq1 && ecc->freq2 && ecc->freq3) {
int delay=(int)(ecc->acc/3);
if (delay<0){
@ -274,7 +274,7 @@ static void ecc_play_tones(EcCalibrator *ecc){
static void * ecc_thread(void *p){
EcCalibrator *ecc=(EcCalibrator*)p;
ecc_init_filters(ecc);
ecc_play_tones(ecc);
ecc_deinit_filters(ecc);
@ -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;
}

View file

@ -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;
}

View file

@ -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));

View file

@ -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
);
}
/**
@ -596,7 +600,7 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
/* retrieve selfZID from cache, and convert it to an Hexa buffer to easily match it against hex string containg in xml message as pzid */
if (bzrtp_getSelfZID(cachedb, selfURI, selfZid, NULL) != 0) {
ms_error("[LIME] Couldn't get self ZID");
ms_error("[LIME] Couldn't get self ZID");
return LIME_UNABLE_TO_DECRYPT_MESSAGE;
}
bctbx_int8_to_str(selfZidHex, selfZid, 12);
@ -606,13 +610,13 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
xmlSetGenericErrorFunc(xml_ctx, linphone_xmlparsing_genericxml_error);
xml_ctx->doc = xmlReadDoc((const unsigned char*)message, 0, NULL, 0);
if (xml_ctx->doc == NULL) {
ms_error("[LIME] XML doc is null");
ms_error("[LIME] XML doc is null");
retval = LIME_INVALID_ENCRYPTED_MESSAGE;
goto error;
}
if (linphone_create_xml_xpath_context(xml_ctx) < 0) {
ms_error("[LIME] Couldn't create xml xpath context");
ms_error("[LIME] Couldn't create xml xpath context");
retval = LIME_INVALID_ENCRYPTED_MESSAGE;
goto error;
}
@ -627,7 +631,7 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
/* Get the matching key from cache */
retval = lime_getCachedRcvKeyByZid(cachedb, &associatedKey, selfURI, peerURI);
if (retval != 0) {
ms_error("[LIME] Couldn't get cache rcv key by ZID");
ms_error("[LIME] Couldn't get cache rcv key by ZID");
goto error;
}
@ -636,7 +640,7 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
if ((msg_object != NULL) && (msg_object->nodesetval != NULL)) {
for (i = 1; i <= msg_object->nodesetval->nodeNr; i++) {
char *currentZidHex;
char *encryptedMessageb64;
char *encryptedContentTypeb64;
snprintf(xpath_str, sizeof(xpath_str), "/doc/msg[%i]/pzid", i);
@ -674,7 +678,7 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
/* do we have retrieved correctly all the needed data */
if (encryptedMessage == NULL) {
ms_error("[LIME] Encrypted message is null, something went wrong...");
ms_error("[LIME] Encrypted message is null, something went wrong...");
retval = LIME_UNABLE_TO_DECRYPT_MESSAGE;
goto error;
}
@ -684,7 +688,7 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
/* something wen't wrong with the cache, this shall never happen */
uint8_t associatedKeyIndexHex[9];
bctbx_uint32_to_str(associatedKeyIndexHex, associatedKey.sessionIndex);
ms_error("[LIME] Session index [%s] < associated key's session index [%s], should not happen !", sessionIndexHex, associatedKeyIndexHex);
ms_error("[LIME] Session index [%s] < associated key's session index [%s], should not happen !", sessionIndexHex, associatedKeyIndexHex);
ms_free(encryptedMessage);
retval = LIME_UNABLE_TO_DECRYPT_MESSAGE;
goto error;
@ -692,7 +696,7 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
if ((usedSessionIndex - associatedKey.sessionIndex > MAX_DERIVATION_NUMBER) ) {
/* we missed to many messages, ask for a cache reset via a ZRTP call */
ms_error("[LIME] Too many messages missed (%i), cache should be reset by ZRTP call", usedSessionIndex - associatedKey.sessionIndex);
ms_error("[LIME] Too many messages missed (%i), cache should be reset by ZRTP call", usedSessionIndex - associatedKey.sessionIndex);
ms_free(encryptedMessage);
retval = LIME_UNABLE_TO_DECRYPT_MESSAGE;
goto error;
@ -701,7 +705,7 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
if (associatedKey.sessionIndex != usedSessionIndex) {
uint8_t associatedKeyIndexHex[9];
bctbx_uint32_to_str(associatedKeyIndexHex, associatedKey.sessionIndex);
ms_warning("LIME] unexpected session index [%s] received from [%s] (expected [%s]), [%i] messages will be discarded",
ms_warning("LIME] unexpected session index [%s] received from [%s] (expected [%s]), [%i] messages will be discarded",
sessionIndexHex, peerURI, associatedKeyIndexHex, usedSessionIndex-associatedKey.sessionIndex);
}
@ -716,7 +720,7 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
if (retval != 0) {
ms_free(*output);
*output = NULL;
ms_error("[LIME] Couldn't decrypt message");
ms_error("[LIME] Couldn't decrypt message");
retval = LIME_UNABLE_TO_DECRYPT_MESSAGE;
goto error;
}
@ -729,7 +733,7 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
if (retval != 0) {
ms_free(*content_type);
*content_type = NULL;
ms_error("[LIME] Couldn't decrypt content type");
ms_error("[LIME] Couldn't decrypt content type");
retval = LIME_UNABLE_TO_DECRYPT_MESSAGE;
goto error;
}
@ -758,7 +762,7 @@ bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr) {
bool_t res;
limeURIKeys_t associatedKeys;
char *peer = linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(cr));
/* retrieve keys associated to the peer URI */
associatedKeys.peerURI = bctbx_strdup(peer);
associatedKeys.selfURI = NULL; /* TODO : there is no sender associated to chatroom so check for any local URI available, shall we add sender to chatroom? */
@ -798,7 +802,7 @@ int lime_im_encryption_engine_process_incoming_message_cb(LinphoneImEncryptionEn
}
peerUri = linphone_address_as_string_uri_only(msg->from);
selfUri = linphone_address_as_string_uri_only(msg->to);
retval = lime_decryptMultipartMessage(zrtp_cache_db, (uint8_t *)msg->message, selfUri, peerUri, &decrypted_body, &decrypted_content_type,
retval = lime_decryptMultipartMessage(zrtp_cache_db, (uint8_t *)msg->message, selfUri, peerUri, &decrypted_body, &decrypted_content_type,
bctbx_time_string_to_sec(lp_config_get_string(lc->config, "sip", "lime_key_validity", "0")));
ms_free(peerUri);
ms_free(selfUri);
@ -887,11 +891,11 @@ int lime_im_encryption_engine_process_outgoing_message_cb(LinphoneImEncryptionEn
int lime_im_encryption_engine_process_downloading_file_cb(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, size_t offset, const uint8_t *buffer, size_t size, uint8_t *decrypted_buffer) {
if (linphone_content_get_key(msg->file_transfer_information) == NULL) return -1;
if (buffer == NULL || size == 0) {
return lime_decryptFile(linphone_content_get_cryptoContext_address(msg->file_transfer_information), NULL, 0, NULL, NULL);
}
return lime_decryptFile(linphone_content_get_cryptoContext_address(msg->file_transfer_information),
(unsigned char *)linphone_content_get_key(msg->file_transfer_information), size, (char *)decrypted_buffer,
(char *)buffer);
@ -900,17 +904,17 @@ int lime_im_encryption_engine_process_downloading_file_cb(LinphoneImEncryptionEn
int lime_im_encryption_engine_process_uploading_file_cb(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, size_t offset, const uint8_t *buffer, size_t *size, uint8_t *encrypted_buffer) {
size_t file_size = linphone_content_get_size(msg->file_transfer_information);
if (linphone_content_get_key(msg->file_transfer_information) == NULL) return -1;
if (buffer == NULL || *size == 0) {
return lime_encryptFile(linphone_content_get_cryptoContext_address(msg->file_transfer_information), NULL, 0, NULL, NULL);
}
if (file_size == 0) {
ms_warning("File size has not been set, encryption will fail if not done in one step (if file is larger than 16K)");
} else if (offset + *size < file_size) {
*size -= (*size % 16);
}
return lime_encryptFile(linphone_content_get_cryptoContext_address(msg->file_transfer_information),
(unsigned char *)linphone_content_get_key(msg->file_transfer_information), *size,
(char *)buffer, (char *)encrypted_buffer);
@ -972,7 +976,7 @@ bool_t lime_im_encryption_engine_is_file_encryption_enabled_cb(LinphoneImEncrypt
return FALSE;
}
void lime_im_encryption_engine_generate_file_transfer_key_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
}
#endif /* HAVE_LIME */

View file

@ -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) {

View file

@ -445,8 +445,8 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneCore, belle_sip_object_t,
);
void lc_callback_obj_init(LCCallbackObj *obj,LinphoneCoreCbFunc func,void* ud) {
obj->_func=func;
obj->_user_data=ud;
obj->_func=func;
obj->_user_data=ud;
}
int lc_callback_obj_invoke(LCCallbackObj *obj, LinphoneCore *lc){
@ -1094,7 +1094,7 @@ static void net_config_read(LinphoneCore *lc) {
if (tmpstr!=NULL && (strlen(tmpstr)<1)) tmpstr=NULL;
linphone_core_set_nat_address(lc,tmpstr);
tmp=lp_config_get_int(lc->config,"net","nat_sdp_only",0);
lc->net_conf.nat_sdp_only=tmp;
lc->net_conf.nat_sdp_only=!!tmp;
tmp=lp_config_get_int(lc->config,"net","mtu",1300);
linphone_core_set_mtu(lc,tmp);
tmp=lp_config_get_int(lc->config,"net","download_ptime",-1);
@ -1103,9 +1103,9 @@ static void net_config_read(LinphoneCore *lc) {
linphone_core_set_download_ptime(lc,tmp);
}
tmp = lp_config_get_int(lc->config, "net", "dns_srv_enabled", 1);
linphone_core_enable_dns_srv(lc, tmp);
linphone_core_enable_dns_srv(lc, !!tmp);
tmp = lp_config_get_int(lc->config, "net", "dns_search_enabled", 1);
linphone_core_enable_dns_search(lc, tmp);
linphone_core_enable_dns_search(lc, !!tmp);
}
static void build_sound_devices_table(LinphoneCore *lc){
@ -1245,12 +1245,10 @@ static void sound_config_read(LinphoneCore *lc)
tmp=FALSE; /* on iOS we have builtin echo cancellation.*/
#endif
tmp=lp_config_get_int(lc->config,"sound","echocancellation",tmp);
linphone_core_enable_echo_cancellation(lc,tmp);
linphone_core_enable_echo_cancellation(lc, !!tmp);
linphone_core_set_echo_canceller_filter_name(lc, linphone_core_get_echo_canceller_filter_name(lc));
linphone_core_enable_echo_limiter(lc,
lp_config_get_int(lc->config,"sound","echolimiter",0));
linphone_core_enable_agc(lc,
lp_config_get_int(lc->config,"sound","agc",0));
linphone_core_enable_echo_limiter(lc, !!lp_config_get_int(lc->config,"sound","echolimiter",0));
linphone_core_enable_agc(lc, !!lp_config_get_int(lc->config,"sound","agc",0));
linphone_core_set_playback_gain_db (lc,lp_config_get_float(lc->config,"sound","playback_gain_db",0));
linphone_core_set_mic_gain_db (lc,lp_config_get_float(lc->config,"sound","mic_gain_db",0));
@ -1283,8 +1281,8 @@ static void certificates_config_read(LinphoneCore *lc) {
}
}
linphone_core_set_root_ca(lc,rootca);
linphone_core_verify_server_certificates(lc,lp_config_get_int(lc->config,"sip","verify_server_certs",TRUE));
linphone_core_verify_server_cn(lc,lp_config_get_int(lc->config,"sip","verify_server_cn",TRUE));
linphone_core_verify_server_certificates(lc, !!lp_config_get_int(lc->config,"sip","verify_server_certs",TRUE));
linphone_core_verify_server_cn(lc, !!lp_config_get_int(lc->config,"sip","verify_server_cn",TRUE));
bctbx_free(root_ca_path);
}
@ -1299,8 +1297,8 @@ static void sip_config_read(LinphoneCore *lc) {
sal_use_session_timers(lc->sal,200);
}
sal_use_no_initial_route(lc->sal,lp_config_get_int(lc->config,"sip","use_no_initial_route",0));
sal_use_rport(lc->sal,lp_config_get_int(lc->config,"sip","use_rport",1));
sal_use_no_initial_route(lc->sal, !!lp_config_get_int(lc->config,"sip","use_no_initial_route",0));
sal_use_rport(lc->sal, !!lp_config_get_int(lc->config,"sip","use_rport",1));
if (!lp_config_get_int(lc->config,"sip","ipv6_migration_done",FALSE) && lp_config_has_entry(lc->config,"sip","use_ipv6")) {
lp_config_clean_entry(lc->config,"sip","use_ipv6");
@ -1308,7 +1306,7 @@ static void sip_config_read(LinphoneCore *lc) {
ms_message("IPV6 settings migration done.");
}
lc->sip_conf.ipv6_enabled=lp_config_get_int(lc->config,"sip","use_ipv6",ipv6_default);
lc->sip_conf.ipv6_enabled = !!lp_config_get_int(lc->config,"sip","use_ipv6",ipv6_default);
memset(&tr,0,sizeof(tr));
@ -1343,7 +1341,7 @@ static void sip_config_read(LinphoneCore *lc) {
}
tmp=lp_config_get_int(lc->config,"sip","guess_hostname",1);
linphone_core_set_guess_hostname(lc,tmp);
linphone_core_set_guess_hostname(lc, !!tmp);
tmp=lp_config_get_int(lc->config,"sip","lime",LinphoneLimeDisabled);
linphone_core_enable_lime(lc,static_cast<LinphoneLimeState>(tmp));
@ -1385,23 +1383,23 @@ static void sip_config_read(LinphoneCore *lc) {
linphone_core_set_media_encryption(lc,linphone_core_get_media_encryption(lc));
/*for tuning or test*/
lc->sip_conf.sdp_200_ack=lp_config_get_int(lc->config,"sip","sdp_200_ack",0);
lc->sip_conf.sdp_200_ack = !!lp_config_get_int(lc->config,"sip","sdp_200_ack",0);
lc->sip_conf.register_only_when_network_is_up=
lp_config_get_int(lc->config,"sip","register_only_when_network_is_up",1);
!!lp_config_get_int(lc->config,"sip","register_only_when_network_is_up",1);
lc->sip_conf.register_only_when_upnp_is_ok=
lp_config_get_int(lc->config,"sip","register_only_when_upnp_is_ok",1);
lc->sip_conf.ping_with_options=lp_config_get_int(lc->config,"sip","ping_with_options",0);
lc->sip_conf.auto_net_state_mon=lp_config_get_int(lc->config,"sip","auto_net_state_mon",1);
lc->sip_conf.keepalive_period=lp_config_get_int(lc->config,"sip","keepalive_period",10000);
lc->sip_conf.tcp_tls_keepalive=lp_config_get_int(lc->config,"sip","tcp_tls_keepalive",0);
!!lp_config_get_int(lc->config,"sip","register_only_when_upnp_is_ok",1);
lc->sip_conf.ping_with_options= !!lp_config_get_int(lc->config,"sip","ping_with_options",0);
lc->sip_conf.auto_net_state_mon = !!lp_config_get_int(lc->config,"sip","auto_net_state_mon",1);
lc->sip_conf.keepalive_period = lp_config_get_int(lc->config,"sip","keepalive_period",10000);
lc->sip_conf.tcp_tls_keepalive = !!lp_config_get_int(lc->config,"sip","tcp_tls_keepalive",0);
linphone_core_enable_keep_alive(lc, (lc->sip_conf.keepalive_period > 0));
sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0));
sal_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0));
sal_enable_sip_update_method(lc->sal,lp_config_get_int(lc->config,"sip","sip_update",1));
lc->sip_conf.vfu_with_info=lp_config_get_int(lc->config,"sip","vfu_with_info",1);
sal_use_one_matching_codec_policy(lc->sal, !!lp_config_get_int(lc->config,"sip","only_one_codec",0));
sal_use_dates(lc->sal, !!lp_config_get_int(lc->config,"sip","put_date",0));
sal_enable_sip_update_method(lc->sal, !!lp_config_get_int(lc->config,"sip","sip_update",1));
lc->sip_conf.vfu_with_info = !!lp_config_get_int(lc->config,"sip","vfu_with_info",1);
linphone_core_set_sip_transport_timeout(lc, lp_config_get_int(lc->config, "sip", "transport_timeout", 63000));
sal_set_supported_tags(lc->sal,lp_config_get_string(lc->config,"sip","supported","replaces, outbound, gruu"));
lc->sip_conf.save_auth_info = lp_config_get_int(lc->config, "sip", "save_auth_info", 1);
lc->sip_conf.save_auth_info = !!lp_config_get_int(lc->config, "sip", "save_auth_info", 1);
linphone_core_create_im_notif_policy(lc);
}
@ -1448,11 +1446,11 @@ static void rtp_config_read(LinphoneCore *lc) {
linphone_core_set_video_jittcomp(lc,jitt_comp);
nortp_timeout=lp_config_get_int(lc->config,"rtp","nortp_timeout",30);
linphone_core_set_nortp_timeout(lc,nortp_timeout);
rtp_no_xmit_on_audio_mute=lp_config_get_int(lc->config,"rtp","rtp_no_xmit_on_audio_mute",FALSE);
rtp_no_xmit_on_audio_mute = !!lp_config_get_int(lc->config,"rtp","rtp_no_xmit_on_audio_mute",FALSE);
linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_no_xmit_on_audio_mute);
adaptive_jitt_comp_enabled = lp_config_get_int(lc->config, "rtp", "audio_adaptive_jitt_comp_enabled", TRUE);
adaptive_jitt_comp_enabled = !!lp_config_get_int(lc->config, "rtp", "audio_adaptive_jitt_comp_enabled", TRUE);
linphone_core_enable_audio_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled);
adaptive_jitt_comp_enabled = lp_config_get_int(lc->config, "rtp", "video_adaptive_jitt_comp_enabled", TRUE);
adaptive_jitt_comp_enabled = !!lp_config_get_int(lc->config, "rtp", "video_adaptive_jitt_comp_enabled", TRUE);
linphone_core_enable_video_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled);
lc->rtp_conf.disable_upnp = lp_config_get_int(lc->config, "rtp", "disable_upnp", FALSE);
linphone_core_set_avpf_mode(lc,static_cast<LinphoneAVPFMode>(lp_config_get_int(lc->config,"rtp","avpf",LinphoneAVPFDisabled)));
@ -1461,7 +1459,7 @@ static void rtp_config_read(LinphoneCore *lc) {
else
lc->rtp_conf.audio_multicast_addr=ms_strdup("224.1.2.3");
if ((tmp_int=lp_config_get_int(lc->config,"rtp","audio_multicast_enabled",-1)) >-1)
linphone_core_enable_audio_multicast(lc,tmp_int);
linphone_core_enable_audio_multicast(lc, !!tmp_int);
if ((tmp_int=lp_config_get_int(lc->config,"rtp","audio_multicast_ttl",-1))>0)
linphone_core_set_audio_multicast_ttl(lc,tmp_int);
else
@ -1475,7 +1473,7 @@ static void rtp_config_read(LinphoneCore *lc) {
else
lc->rtp_conf.video_multicast_ttl=1;/*local network*/
if ((tmp_int=lp_config_get_int(lc->config,"rtp","video_multicast_enabled",-1)) >0)
linphone_core_enable_video_multicast(lc,tmp_int);
linphone_core_enable_video_multicast(lc, !!tmp_int);
}
static PayloadType * find_payload(const bctbx_list_t *default_list, const char *mime_type, int clock_rate, int channels, const char *recv_fmtp){
@ -1616,7 +1614,7 @@ static bctbx_list_t *add_missing_supported_codecs(LinphoneCore *lc, const bctbx_
}
last_seen = pt;
ms_message("Supported codec %s/%i fmtp=%s automatically added to codec list.", pt->mime_type,
pt->clock_rate, pt->recv_fmtp ? pt->recv_fmtp : "");
pt->clock_rate, pt->recv_fmtp ? pt->recv_fmtp : "");
}else{
last_seen = (PayloadType*)elem2->data;
}
@ -1727,7 +1725,6 @@ static void build_video_devices_table(LinphoneCore *lc){
static void video_config_read(LinphoneCore *lc){
#ifdef VIDEO_ENABLED
int capture, display, self_view, reuse_source;
int automatic_video=1;
const char *str;
LinphoneVideoPolicy vpol;
@ -1749,17 +1746,13 @@ static void video_config_read(LinphoneCore *lc){
#if defined(__ANDROID__) || TARGET_OS_IPHONE
automatic_video=0;
#endif
capture=lp_config_get_int(lc->config,"video","capture",1);
display=lp_config_get_int(lc->config,"video","display",1);
self_view=lp_config_get_int(lc->config,"video","self_view",1);
reuse_source=lp_config_get_int(lc->config,"video","reuse_source",0);
vpol.automatically_initiate=lp_config_get_int(lc->config,"video","automatically_initiate",automatic_video);
vpol.automatically_accept=lp_config_get_int(lc->config,"video","automatically_accept",automatic_video);
linphone_core_enable_video_capture(lc, capture);
linphone_core_enable_video_display(lc, display);
linphone_core_enable_video_preview(lc,lp_config_get_int(lc->config,"video","show_local",0));
linphone_core_enable_self_view(lc,self_view);
linphone_core_enable_video_source_reuse(lc, reuse_source);
vpol.automatically_initiate = !!lp_config_get_int(lc->config,"video","automatically_initiate",automatic_video);
vpol.automatically_accept = !!lp_config_get_int(lc->config,"video","automatically_accept",automatic_video);
linphone_core_enable_video_capture(lc, !!lp_config_get_int(lc->config,"video","capture",1));
linphone_core_enable_video_display(lc, !!lp_config_get_int(lc->config,"video","display",1));
linphone_core_enable_video_preview(lc, !!lp_config_get_int(lc->config,"video","show_local",0));
linphone_core_enable_self_view(lc, !!lp_config_get_int(lc->config,"video","self_view",1));
linphone_core_enable_video_source_reuse(lc, !!lp_config_get_int(lc->config,"video","reuse_source",0));
linphone_core_set_video_policy(lc,&vpol);
#endif
}
@ -1815,7 +1808,7 @@ void linphone_core_enable_adaptive_rate_control(LinphoneCore *lc, bool_t enabled
}
bool_t linphone_core_adaptive_rate_control_enabled(const LinphoneCore *lc){
return lp_config_get_int(lc->config,"net","adaptive_rate_control",TRUE);
return !!lp_config_get_int(lc->config,"net","adaptive_rate_control",TRUE);
}
void linphone_core_set_adaptive_rate_algorithm(LinphoneCore *lc, const char* algorithm){
@ -1836,7 +1829,7 @@ const char * linphone_core_get_adaptive_rate_algorithm(const LinphoneCore *lc){
}
bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc){
return lp_config_get_int(lc->config,"rtp","rtcp_enabled",TRUE);
return !!lp_config_get_int(lc->config,"rtp","rtcp_enabled",TRUE);
}
void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw){
@ -1979,7 +1972,7 @@ static void misc_config_read(LinphoneCore *lc) {
sal_set_uuid(lc->sal, uuid);
lc->user_certificates_path=ms_strdup(lp_config_get_string(config,"misc","user_certificates_path","."));
lc->send_call_stats_periodical_updates = lp_config_get_int(config, "misc", "send_call_stats_periodical_updates", 0);
lc->send_call_stats_periodical_updates = !!lp_config_get_int(config, "misc", "send_call_stats_periodical_updates", 0);
}
void linphone_core_reload_ms_plugins(LinphoneCore *lc, const char *path){
@ -2143,7 +2136,7 @@ static void linphone_core_internal_subscription_state_changed(LinphoneCore *lc,
if (strcasecmp(linphone_event_get_name(lev), "Presence") == 0) {
linphone_friend_list_subscription_state_changed(lc, lev, state);
} else if (strcmp(linphone_event_get_name(lev), "Conference") == 0) {
}
}
@ -2184,11 +2177,11 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
LinphoneCoreCbs *internal_cbs = _linphone_core_cbs_new();
const char *msplugins_dir;
const char *image_resources_dir;
bctbx_init_logger(FALSE);
if (liblinphone_user_log_func && liblinphone_current_log_func == NULL)
bctbx_set_log_handler(liblinphone_current_log_func=liblinphone_user_log_func); /*default value*/
ms_message("Initializing LinphoneCore %s", linphone_core_get_version());
lc->config=lp_config_ref(config);
@ -2218,7 +2211,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");
ortp_set_log_handler(NULL); /*remove ortp default log handler*/
ortp_init();
linphone_core_activate_log_serialization_if_needed();
msplugins_dir = linphone_factory_get_msplugins_dir(lfactory);
@ -2523,7 +2516,7 @@ void linphone_core_enable_generic_comfort_noise(LinphoneCore *lc, bool_t enabled
}
bool_t linphone_core_generic_comfort_noise_enabled(const LinphoneCore *lc){
return lp_config_get_int(lc->config, "misc", "use_cn", FALSE);
return !!lp_config_get_int(lc->config, "misc", "use_cn", FALSE);
}
const bctbx_list_t* linphone_core_get_friend_list(const LinphoneCore *lc) {
@ -2720,7 +2713,7 @@ void linphone_core_set_nortp_timeout(LinphoneCore *lc, int nortp_timeout){
}
bool_t linphone_core_get_use_info_for_dtmf(LinphoneCore *lc) {
return lp_config_get_int(lc->config, "sip", "use_info", 0);
return !!lp_config_get_int(lc->config, "sip", "use_info", 0);
}
void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc,bool_t use_info) {
@ -2730,7 +2723,7 @@ void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc,bool_t use_info) {
}
bool_t linphone_core_get_use_rfc2833_for_dtmf(LinphoneCore *lc) {
return lp_config_get_int(lc->config, "sip", "use_rfc2833", 1);
return !!lp_config_get_int(lc->config, "sip", "use_rfc2833", 1);
}
void linphone_core_set_use_rfc2833_for_dtmf(LinphoneCore *lc,bool_t use_rfc2833) {
@ -2841,7 +2834,7 @@ int _linphone_core_apply_transports(LinphoneCore *lc){
}
bool_t linphone_core_sip_transport_supported(const LinphoneCore *lc, LinphoneTransportType tp){
return sal_transport_available(lc->sal,(SalTransport)tp);
return !!sal_transport_available(lc->sal,(SalTransport)tp);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneTransports);
@ -3350,22 +3343,22 @@ void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, L
}
/*
returns the ideal route set for making an operation through this proxy.
The list must be freed as well as the SalAddress content
returns the ideal route set for making an operation through this proxy.
The list must be freed as well as the SalAddress content
rfc3608
6.1. Procedures at the UA
rfc3608
6.1. Procedures at the UA
/.../
For example, some devices will use locally-configured
explicit loose routing to reach a next-hop proxy, and others will use
a default outbound-proxy routing rule. However, for the result to
function, the combination MUST provide valid routing in the local
environment. In general, the service route set is appended to any
locally configured route needed to egress the access proxy chain.
Systems designers must match the service routing policy of their
nodes with the basic SIP routing policy in order to get a workable
system.
/.../
For example, some devices will use locally-configured
explicit loose routing to reach a next-hop proxy, and others will use
a default outbound-proxy routing rule. However, for the result to
function, the combination MUST provide valid routing in the local
environment. In general, the service route set is appended to any
locally configured route needed to egress the access proxy chain.
Systems designers must match the service routing policy of their
nodes with the basic SIP routing policy in order to get a workable
system.
*/
static bctbx_list_t *make_routes_for_proxy(LinphoneProxyConfig *proxy, const LinphoneAddress *dest){
bctbx_list_t *ret=NULL;
@ -3444,7 +3437,7 @@ const char *linphone_core_find_best_identity(LinphoneCore *lc, const LinphoneAdd
LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url){
LinphoneCall *call;
LinphoneCallParams *p=linphone_core_create_call_params(lc, NULL);
linphone_call_params_enable_video(p, linphone_call_params_video_enabled(p) & !!lc->video_policy.automatically_initiate);
linphone_call_params_enable_video(p, linphone_call_params_video_enabled(p) && !!lc->video_policy.automatically_initiate);
call=linphone_core_invite_with_params(lc,url,p);
linphone_call_params_unref(p);
return call;
@ -3464,7 +3457,7 @@ LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *ur
LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddress *addr){
LinphoneCall *call;
LinphoneCallParams *p=linphone_core_create_call_params(lc, NULL);
linphone_call_params_enable_video(p, linphone_call_params_video_enabled(p) & !!lc->video_policy.automatically_initiate);
linphone_call_params_enable_video(p, linphone_call_params_video_enabled(p) && !!lc->video_policy.automatically_initiate);
call=linphone_core_invite_address_with_params (lc,addr,p);
linphone_call_params_unref(p);
return call;
@ -3506,7 +3499,7 @@ void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const Linphon
SalAddress *new_contact = contact ? sal_address_clone(contact) : NULL;
sal_op_set_and_clean_contact_address(proxy->op, new_contact);
}
sal_op_cnx_ip_to_0000_if_sendonly_enable(op,lp_config_get_default_int(lc->config,"sip","cnx_ip_to_0000_if_sendonly_enabled",0)); /*also set in linphone_call_new_incoming*/
sal_op_cnx_ip_to_0000_if_sendonly_enable(op, !!lp_config_get_default_int(lc->config,"sip","cnx_ip_to_0000_if_sendonly_enabled",0)); /*also set in linphone_call_new_incoming*/
}
void linphone_configure_op(LinphoneCore *lc, SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact) {
linphone_configure_op_with_proxy(lc, op, dest, headers,with_contact,linphone_core_lookup_known_proxy(lc,dest));
@ -3538,10 +3531,11 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
if (proxy!=NULL) {
from=linphone_proxy_config_get_identity(proxy);
linphone_call_params_enable_avpf(cp, linphone_proxy_config_avpf_enabled(proxy));
linphone_call_params_set_avpf_rr_interval(cp, linphone_proxy_config_get_avpf_rr_interval(proxy) * 1000);
linphone_call_params_set_avpf_rr_interval(cp, (uint16_t)(linphone_proxy_config_get_avpf_rr_interval(proxy) * 1000));
}else{
linphone_call_params_enable_avpf(cp, linphone_core_get_avpf_mode(lc)==LinphoneAVPFEnabled);
if (linphone_call_params_avpf_enabled(cp)) linphone_call_params_set_avpf_rr_interval(cp, linphone_core_get_avpf_rr_interval(lc) * 1000);
if (linphone_call_params_avpf_enabled(cp))
linphone_call_params_set_avpf_rr_interval(cp, (uint16_t)(linphone_core_get_avpf_rr_interval(lc) * 1000));
}
/* if no proxy or no identity defined for this proxy, default to primary contact*/
@ -4014,7 +4008,7 @@ int linphone_core_get_rec_level(LinphoneCore *lc) {
void linphone_core_set_ring_level(LinphoneCore *lc, int level){
MSSndCard *sndcard;
lc->sound_conf.ring_lev=level;
lc->sound_conf.ring_lev = (char)level;
sndcard=lc->sound_conf.ring_sndcard;
if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_PLAYBACK,level);
}
@ -4064,14 +4058,14 @@ float linphone_core_get_playback_gain_db(LinphoneCore *lc) {
void linphone_core_set_play_level(LinphoneCore *lc, int level){
MSSndCard *sndcard;
lc->sound_conf.play_lev=level;
lc->sound_conf.play_lev = (char)level;
sndcard=lc->sound_conf.play_sndcard;
if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_PLAYBACK,level);
}
void linphone_core_set_rec_level(LinphoneCore *lc, int level) {
MSSndCard *sndcard;
lc->sound_conf.rec_lev=level;
lc->sound_conf.rec_lev = (char)level;
sndcard=lc->sound_conf.capt_sndcard;
if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_CAPTURE,level);
}
@ -4160,9 +4154,9 @@ const char** linphone_core_get_video_devices(const LinphoneCore *lc){
}
void linphone_core_set_default_sound_devices(LinphoneCore *lc){
linphone_core_set_ringer_device(lc, NULL);
linphone_core_set_playback_device(lc, NULL);
linphone_core_set_capture_device(lc, NULL);
linphone_core_set_ringer_device(lc, NULL);
linphone_core_set_playback_device(lc, NULL);
linphone_core_set_capture_device(lc, NULL);
}
void linphone_core_reload_sound_devices(LinphoneCore *lc){
@ -4584,9 +4578,9 @@ void linphone_core_set_nat_policy(LinphoneCore *lc, LinphoneNatPolicy *policy) {
linphone_nat_policy_save_to_config(lc->nat_policy);
}
sal_nat_helper_enable(lc->sal, lp_config_get_int(lc->config, "net", "enable_nat_helper", 1));
sal_nat_helper_enable(lc->sal, !!lp_config_get_int(lc->config, "net", "enable_nat_helper", 1));
sal_enable_auto_contacts(lc->sal, TRUE);
sal_use_rport(lc->sal, lp_config_get_int(lc->config, "sip", "use_rport", 1));
sal_use_rport(lc->sal, !!lp_config_get_int(lc->config, "sip", "use_rport", 1));
if (lc->sip_conf.contact) update_primary_contact(lc);
}
@ -5769,7 +5763,7 @@ void sip_config_uninit(LinphoneCore *lc)
for(elem=config->proxies;elem!=NULL;elem=bctbx_list_next(elem)){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)(elem->data);
LinphoneRegistrationState state = linphone_proxy_config_get_state(cfg);
still_registered|=(state==LinphoneRegistrationOk||state==LinphoneRegistrationProgress);
still_registered = (state==LinphoneRegistrationOk||state==LinphoneRegistrationProgress);
}
ms_usleep(100000);
}
@ -6202,8 +6196,8 @@ void linphone_core_soundcard_hint_check( LinphoneCore* lc){
bctbx_list_t* the_calls = lc->calls;
LinphoneCall* call = NULL;
bool_t dont_need_sound = TRUE;
bool_t use_rtp_io = lp_config_get_int(lc->config, "sound", "rtp_io", FALSE);
bool_t use_rtp_io_enable_local_output = lp_config_get_int(lc->config, "sound", "rtp_io_enable_local_output", FALSE);
bool_t use_rtp_io = !!lp_config_get_int(lc->config, "sound", "rtp_io", FALSE);
bool_t use_rtp_io_enable_local_output = !!lp_config_get_int(lc->config, "sound", "rtp_io_enable_local_output", FALSE);
/* check if the remaining calls are paused */
while( the_calls ){

View file

@ -31,8 +31,8 @@ static xmlChar* convert_iso_to_utf8(const char *in) {
int ret, size, out_size, temp;
xmlCharEncodingHandlerPtr handler;
size = (int)strlen(in) + 1;
out_size = size * 2 - 1;
size = (int)strlen(in) + 1;
out_size = size * 2 - 1;
out = reinterpret_cast<xmlChar *>(ms_malloc((size_t)out_size));
if (out) {
@ -41,7 +41,7 @@ static xmlChar* convert_iso_to_utf8(const char *in) {
ms_free(out);
return NULL;
}
temp = size-1;
ret = handler->input(out, &out_size, (const xmlChar *)in, &temp);
if (ret < 0 || temp - size + 1) {
@ -53,7 +53,7 @@ static xmlChar* convert_iso_to_utf8(const char *in) {
}
}
return out;
}
}
struct _lpc2xml_context {
const LpConfig *lpc;
@ -131,7 +131,7 @@ static int processEntry(const char *section, const char *entry, xmlNode *node, l
}
lpc2xml_log(ctx, LPC2XML_MESSAGE, "Set %s|%s = %s", section, entry, content);
converted_content = convert_iso_to_utf8(content);
if (converted_content) {
// xmlNodeSetContent expects special characters to be escaped, xmlNodeAddContent doesn't (and escapes what needs to be)
xmlNodeSetContent(node, (const xmlChar *) "");
@ -142,7 +142,7 @@ static int processEntry(const char *section, const char *entry, xmlNode *node, l
xmlNodeSetContent(node, (const xmlChar *) "");
xmlNodeAddContent(node, (const xmlChar *) content);
}
if (lp_config_get_overwrite_flag_for_entry(ctx->lpc, section, entry) || lp_config_get_overwrite_flag_for_section(ctx->lpc, section)) {
xmlSetProp(node, (const xmlChar *)"overwrite", (const xmlChar *) "true");
}
@ -166,7 +166,7 @@ static void processSection_cb(const char *entry, struct __processSectionCtx *ctx
ctx->ret = 0;
return;
}
if (lp_config_get_skip_flag_for_entry(ctx->ctx->lpc, ctx->section, entry)) {
lpc2xml_log(ctx->ctx, LPC2XML_WARNING, "Skipped entry %s", entry);
ctx->ret = 0;
@ -208,13 +208,13 @@ static void processConfig_cb(const char *section, struct __processConfigCtx *ctx
if(ctx->ret == 0) {
xmlNode *node;
xmlAttr *name_attr;
if (lp_config_get_skip_flag_for_section(ctx->ctx->lpc, section)) {
lpc2xml_log(ctx->ctx, LPC2XML_WARNING, "Skipped section %s", section);
ctx->ret = 0;
return;
}
node = xmlNewChild(ctx->node, NULL, (const xmlChar *)"section", NULL);
if(node == NULL) {
lpc2xml_log(ctx->ctx, LPC2XML_ERROR, "Can't create \"section\" element");
@ -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);

View file

@ -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 {

View file

@ -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);
}

View file

@ -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){

View file

@ -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)
{

View file

@ -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;

View file

@ -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;
@ -119,11 +119,11 @@ static int sqlite3bctbx_Write(sqlite3_file *p, const void *buf, int count, sqlit
* TRuncates or extends a file depending on the size provided.
* @param p sqlite3_file file handle pointer.
* @param size New file size.
* @return SQLITE_OK on success, SQLITE_IOERR_TRUNCATE if an error occurred during truncate,
* SQLITE_ERROR if ther was a problem on the file descriptor.
* @return SQLITE_OK on success, SQLITE_IOERR_TRUNCATE if an error occurred during truncate,
* SQLITE_ERROR if ther was a problem on the file descriptor.
*/
static int sqlite3bctbx_Truncate(sqlite3_file *p, sqlite_int64 size){
int rc;
int rc;
sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*) p;
if (pFile->pbctbx_file){
rc = bctbx_file_truncate(pFile->pbctbx_file, size);
@ -259,7 +259,7 @@ static char* ConvertFromUtf8Filename(const char* fName){
char* convertedFilename;
int nChar, nb_byte;
LPWSTR wideFilename;
nChar = MultiByteToWideChar(CP_UTF8, 0, fName, -1, NULL, 0);
if (nChar == 0) return NULL;
wideFilename = reinterpret_cast<LPWSTR>(bctbx_malloc(nChar*sizeof(wideFilename[0])));
@ -269,7 +269,7 @@ static char* ConvertFromUtf8Filename(const char* fName){
bctbx_free(wideFilename);
wideFilename = 0;
}
nb_byte = WideCharToMultiByte(CP_ACP, 0, wideFilename, -1, 0, 0, 0, 0);
if (nb_byte == 0) return NULL;
convertedFilename = reinterpret_cast<char *>(bctbx_malloc(nb_byte));
@ -290,15 +290,14 @@ static char* ConvertFromUtf8Filename(const char* fName){
char *outbuf=db_file_locale, *inbuf=db_file_utf8;
size_t inbyteleft = MAX_PATH_SIZE, outbyteleft = MAX_PATH_SIZE;
iconv_t cb;
if (strcasecmp("UTF-8", nl_langinfo(CODESET)) == 0) {
strncpy(db_file_locale, fName, MAX_PATH_SIZE - 1);
} else {
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);
}
@ -346,7 +345,7 @@ static int sqlite3bctbx_Open(sqlite3_vfs *pVfs, const char *fName, sqlite3_file
if (pFile == NULL || fName == NULL){
return SQLITE_IOERR;
}
/* Set flags to open the file with */
if( flags&SQLITE_OPEN_EXCLUSIVE ) openFlags |= O_EXCL;
if( flags&SQLITE_OPEN_CREATE ) openFlags |= O_CREAT;
@ -363,7 +362,7 @@ static int sqlite3bctbx_Open(sqlite3_vfs *pVfs, const char *fName, sqlite3_file
} else {
pFile->pbctbx_file = NULL;
}
if( pFile->pbctbx_file == NULL){
return SQLITE_CANTOPEN;
}
@ -445,7 +444,7 @@ void sqlite3_bctbx_vfs_register( int makeDefault){
sqlite3_vfs* pDefault = sqlite3_vfs_find("unix-none");
#endif
pVfsToUse->xCurrentTime = pDefault->xCurrentTime;
pVfsToUse->xAccess = pDefault->xAccess;
pVfsToUse->xFullPathname = pDefault->xFullPathname;

View file

@ -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) {

View file

@ -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 */
}

View file

@ -803,9 +803,9 @@ void MediaSessionPrivate::setCompatibleIncomingCallParams (SalMediaDescription *
/* Handle AVPF, SRTP and DTLS */
params->enableAvpf(sal_media_description_has_avpf(md));
if (destProxy)
params->setAvpfRrInterval(linphone_proxy_config_get_avpf_rr_interval(destProxy) * 1000);
params->setAvpfRrInterval(static_cast<uint16_t>(linphone_proxy_config_get_avpf_rr_interval(destProxy) * 1000));
else
params->setAvpfRrInterval(linphone_core_get_avpf_rr_interval(core) * 1000);
params->setAvpfRrInterval(static_cast<uint16_t>(linphone_core_get_avpf_rr_interval(core) * 1000));
if (sal_media_description_has_zrtp(md) && linphone_core_media_encryption_supported(core, LinphoneMediaEncryptionZRTP))
params->setMediaEncryption(LinphoneMediaEncryptionZRTP);
else if (sal_media_description_has_dtls(md) && media_stream_dtls_supported())
@ -1440,8 +1440,8 @@ void MediaSessionPrivate::setupRtcpFb (SalMediaDescription *md) {
for (int i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (!sal_stream_description_active(&md->streams[i]))
continue;
md->streams[i].rtcp_fb.generic_nack_enabled = lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_fb_generic_nack_enabled", 0);
md->streams[i].rtcp_fb.tmmbr_enabled = lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_fb_tmmbr_enabled", 1);
md->streams[i].rtcp_fb.generic_nack_enabled = !!lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_fb_generic_nack_enabled", 0);
md->streams[i].rtcp_fb.tmmbr_enabled = !!lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_fb_tmmbr_enabled", 1);
md->streams[i].implicit_rtcp_fb = params->getPrivate()->implicitRtcpFbEnabled();
for (const bctbx_list_t *it = md->streams[i].payloads; it != nullptr; it = bctbx_list_next(it)) {
OrtpPayloadType *pt = reinterpret_cast<OrtpPayloadType *>(bctbx_list_get_data(it));
@ -1460,7 +1460,7 @@ void MediaSessionPrivate::setupRtcpFb (SalMediaDescription *md) {
}
void MediaSessionPrivate::setupRtcpXr (SalMediaDescription *md) {
md->rtcp_xr.enabled = lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_xr_enabled", 1);
md->rtcp_xr.enabled = !!lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_xr_enabled", 1);
if (md->rtcp_xr.enabled) {
const char *rcvr_rtt_mode = lp_config_get_string(linphone_core_get_config(core), "rtp", "rtcp_xr_rcvr_rtt_mode", "all");
if (strcasecmp(rcvr_rtt_mode, "all") == 0)
@ -1471,10 +1471,10 @@ void MediaSessionPrivate::setupRtcpXr (SalMediaDescription *md) {
md->rtcp_xr.rcvr_rtt_mode = OrtpRtcpXrRcvrRttNone;
if (md->rtcp_xr.rcvr_rtt_mode != OrtpRtcpXrRcvrRttNone)
md->rtcp_xr.rcvr_rtt_max_size = lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_xr_rcvr_rtt_max_size", 10000);
md->rtcp_xr.stat_summary_enabled = lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_xr_stat_summary_enabled", 1);
md->rtcp_xr.stat_summary_enabled = !!lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_xr_stat_summary_enabled", 1);
if (md->rtcp_xr.stat_summary_enabled)
md->rtcp_xr.stat_summary_flags = OrtpRtcpXrStatSummaryLoss | OrtpRtcpXrStatSummaryDup | OrtpRtcpXrStatSummaryJitt | OrtpRtcpXrStatSummaryTTL;
md->rtcp_xr.voip_metrics_enabled = lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_xr_voip_metrics_enabled", 1);
md->rtcp_xr.voip_metrics_enabled = !!lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_xr_voip_metrics_enabled", 1);
}
for (int i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (!sal_stream_description_active(&md->streams[i]))
@ -1739,7 +1739,7 @@ void MediaSessionPrivate::updateCryptoParameters (SalMediaDescription *oldMd, Sa
}
bool MediaSessionPrivate::updateStreamCryptoParameters (const SalStreamDescription *localStreamDesc, SalStreamDescription *oldStream, SalStreamDescription *newStream, MediaStream *ms) {
int cryptoIdx = findCryptoIndexFromTag(localStreamDesc->crypto, newStream->crypto_local_tag);
int cryptoIdx = findCryptoIndexFromTag(localStreamDesc->crypto, static_cast<unsigned char>(newStream->crypto_local_tag));
if (cryptoIdx >= 0) {
if (localDescChanged & SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED)
ms_media_stream_sessions_set_srtp_send_key_b64(&ms->sessions, newStream->crypto[0].algo, localStreamDesc->crypto[cryptoIdx].master_key);
@ -2277,7 +2277,7 @@ void MediaSessionPrivate::initializeAudioStream () {
}
}
audio_stream_enable_automatic_gain_control(audioStream, linphone_core_agc_enabled(core));
int enabled = lp_config_get_int(linphone_core_get_config(core), "sound", "noisegate", 0);
bool_t enabled = !!lp_config_get_int(linphone_core_get_config(core), "sound", "noisegate", 0);
audio_stream_enable_noise_gate(audioStream, enabled);
audio_stream_set_features(audioStream, linphone_core_get_audio_features(core));
@ -2384,8 +2384,10 @@ void MediaSessionPrivate::initializeVideoStream () {
int dscp = linphone_core_get_video_dscp(core);
if (dscp!=-1)
video_stream_set_dscp(videoStream, dscp);
video_stream_enable_display_filter_auto_rotate(videoStream,
lp_config_get_int(linphone_core_get_config(core), "video", "display_filter_auto_rotate", 0));
video_stream_enable_display_filter_auto_rotate(
videoStream,
!!lp_config_get_int(linphone_core_get_config(core), "video", "display_filter_auto_rotate", 0)
);
int videoRecvBufSize = lp_config_get_int(linphone_core_get_config(core), "video", "recv_buf_size", 0);
if (videoRecvBufSize > 0)
rtp_session_set_recv_buf_size(videoStream->ms.sessions.rtp_session, videoRecvBufSize);
@ -2474,7 +2476,7 @@ void MediaSessionPrivate::postConfigureAudioStream (AudioStream *stream, bool mu
else
audio_stream_set_mic_gain_db(stream, micGain);
float recvGain = core->sound_conf.soft_play_lev;
if (recvGain)
if (static_cast<int>(recvGain))
setPlaybackGainDb(stream, recvGain);
LinphoneConfig *config = linphone_core_get_config(core);
float ngThres = lp_config_get_float(config, "sound", "ng_thres", 0.05f);
@ -2487,18 +2489,18 @@ void MediaSessionPrivate::postConfigureAudioStream (AudioStream *stream, bool mu
float force = lp_config_get_float(config, "sound", "el_force", -1);
int sustain = lp_config_get_int(config, "sound", "el_sustain", -1);
float transmitThres = lp_config_get_float(config, "sound", "el_transmit_thres", -1);
if (speed == -1)
if (static_cast<int>(speed) == -1)
speed = 0.03f;
if (force == -1)
if (static_cast<int>(force) == -1)
force = 25;
MSFilter *f = stream->volsend;
ms_filter_call_method(f, MS_VOLUME_SET_EA_SPEED, &speed);
ms_filter_call_method(f, MS_VOLUME_SET_EA_FORCE, &force);
if (thres != -1)
if (static_cast<int>(thres) != -1)
ms_filter_call_method(f, MS_VOLUME_SET_EA_THRESHOLD, &thres);
if (sustain != -1)
if (static_cast<int>(sustain) != -1)
ms_filter_call_method(f, MS_VOLUME_SET_EA_SUSTAIN, &sustain);
if (transmitThres != -1)
if (static_cast<int>(transmitThres) != -1)
ms_filter_call_method(f, MS_VOLUME_SET_EA_TRANSMIT_THRESHOLD, &transmitThres);
ms_filter_call_method(f, MS_VOLUME_SET_NOISE_GATE_THRESHOLD, &ngThres);
ms_filter_call_method(f, MS_VOLUME_SET_NOISE_GATE_FLOORGAIN, &ngFloorGain);
@ -2610,7 +2612,7 @@ void MediaSessionPrivate::startAudioStream (LinphoneCallState targetState, bool
/* Valid local tags are > 0 */
if (sal_stream_description_has_srtp(stream)) {
const SalStreamDescription *localStreamDesc = sal_media_description_find_stream(localDesc, stream->proto, SalAudio);
int cryptoIdx = findCryptoIndexFromTag(localStreamDesc->crypto, stream->crypto_local_tag);
int cryptoIdx = findCryptoIndexFromTag(localStreamDesc->crypto, static_cast<unsigned char>(stream->crypto_local_tag));
if (cryptoIdx >= 0) {
ms_media_stream_sessions_set_srtp_recv_key_b64(&audioStream->ms.sessions, stream->crypto[0].algo, stream->crypto[0].master_key);
ms_media_stream_sessions_set_srtp_send_key_b64(&audioStream->ms.sessions, stream->crypto[0].algo, localStreamDesc->crypto[cryptoIdx].master_key);
@ -2795,7 +2797,7 @@ void MediaSessionPrivate::startTextStream () {
currentParams->getPrivate()->setUsedRealtimeTextCodec(rtp_profile_get_payload(textProfile, usedPt));
currentParams->enableRealtimeText(true);
if (sal_stream_description_has_srtp(tstream)) {
int cryptoIdx = findCryptoIndexFromTag(localStreamDesc->crypto, tstream->crypto_local_tag);
int cryptoIdx = findCryptoIndexFromTag(localStreamDesc->crypto, static_cast<unsigned char>(tstream->crypto_local_tag));
if (cryptoIdx >= 0) {
ms_media_stream_sessions_set_srtp_recv_key_b64(&textStream->ms.sessions, tstream->crypto[0].algo, tstream->crypto[0].master_key);
ms_media_stream_sessions_set_srtp_send_key_b64(&textStream->ms.sessions, tstream->crypto[0].algo, localStreamDesc->crypto[cryptoIdx].master_key);
@ -2887,7 +2889,7 @@ void MediaSessionPrivate::startVideoStream (LinphoneCallState targetState) {
if (isActive) {
if (sal_stream_description_has_srtp(vstream)) {
const SalStreamDescription *localStreamDesc = sal_media_description_find_stream(localDesc, vstream->proto, SalVideo);
int cryptoIdx = findCryptoIndexFromTag(localStreamDesc->crypto, vstream->crypto_local_tag);
int cryptoIdx = findCryptoIndexFromTag(localStreamDesc->crypto, static_cast<unsigned char>(vstream->crypto_local_tag));
if (cryptoIdx >= 0) {
ms_media_stream_sessions_set_srtp_recv_key_b64(&videoStream->ms.sessions, vstream->crypto[0].algo, vstream->crypto[0].master_key);
ms_media_stream_sessions_set_srtp_send_key_b64(&videoStream->ms.sessions, vstream->crypto[0].algo, localStreamDesc->crypto[cryptoIdx].master_key);
@ -2900,7 +2902,7 @@ void MediaSessionPrivate::startVideoStream (LinphoneCallState targetState) {
video_stream_set_direction(videoStream, dir);
lInfo() << "startVideoStream: device_rotation=" << core->device_rotation;
video_stream_set_device_rotation(videoStream, core->device_rotation);
video_stream_set_freeze_on_error(videoStream, lp_config_get_int(linphone_core_get_config(core), "video", "freeze_on_error", 1));
video_stream_set_freeze_on_error(videoStream, !!lp_config_get_int(linphone_core_get_config(core), "video", "freeze_on_error", 1));
if (isMulticast)
rtp_session_set_multicast_ttl(videoStream->ms.sessions.rtp_session, vstream->ttl);
video_stream_use_video_preset(videoStream, lp_config_get_string(linphone_core_get_config(core), "video", "preset", nullptr));
@ -3393,7 +3395,7 @@ void MediaSessionPrivate::propagateEncryptionChanged () {
void MediaSessionPrivate::fillLogStats (MediaStream *st) {
float quality = media_stream_get_average_quality_rating(st);
if (quality >= 0) {
if (log->quality == -1)
if (static_cast<int>(log->quality) == -1)
log->quality = quality;
else
log->quality *= quality / 5.0f;

View file

@ -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 "logger/logger.h"
#include "linphone/core.h"
#include "conference/session/media-session-p.h"
#include "logger/logger.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)

View file

@ -16,20 +16,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stun-client.h"
#include "logger/logger.h"
#include "linphone/core.h"
#include "private.h"
#include "logger/logger.h"
#include "stun-client.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;

View file

@ -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;
} else if (ic < 0x100000) {
result[2] = 0x80 + (ic & 0x3F);
result[1] = 0x80 + ((ic >> 6) & 0x3F);
result[0] = 0xE0 + ((ic >> 12) & 0xF);
result[2] = static_cast<char>(0x80 + (ic & 0x3F));
result[1] = static_cast<char>(0x80 + ((ic >> 6) & 0x3F));
result[0] = static_cast<char>(0xE0 + ((ic >> 12) & 0xF));
size = 3;
} else if (ic < 0x110000) {
result[3] = 0x80 + (ic & 0x3F);
result[2] = 0x80 + ((ic >> 6) & 0x3F);
result[1] = 0x80 + ((ic >> 12) & 0x3F);
result[0] = 0xF0 + ((ic >> 18) & 0x7);
result[3] = static_cast<char>(0x80 + (ic & 0x3F));
result[2] = static_cast<char>(0x80 + ((ic >> 6) & 0x3F));
result[1] = static_cast<char>(0x80 + ((ic >> 12) & 0x3F));
result[0] = static_cast<char>(0xF0 + ((ic >> 18) & 0x7));
size = 4;
}
result[size] = '\0';

View file

@ -278,9 +278,9 @@ static inline long long getAssumedNumber (const VariantPrivate &p) {
case Variant::Char:
return p.value.c;
case Variant::Double:
return p.value.d;
return static_cast<long long>(p.value.d);
case Variant::Float:
return p.value.f;
return static_cast<long long>(p.value.f);
default:
L_ASSERT(false);
@ -416,13 +416,13 @@ static inline float getValueAsFloat (const VariantPrivate &p, bool *soFarSoGood)
case Variant::Long:
case Variant::LongLong:
case Variant::Char:
return static_cast<double>(getAssumedNumber(p));
return static_cast<float>(getAssumedNumber(p));
case Variant::UnsignedInt:
case Variant::UnsignedShort:
case Variant::UnsignedLong:
case Variant::UnsignedLongLong:
return static_cast<double>(getAssumedUnsignedNumber(p));
return static_cast<float>(getAssumedUnsignedNumber(p));
case Variant::Float:
return p.value.f;
@ -431,13 +431,13 @@ static inline float getValueAsFloat (const VariantPrivate &p, bool *soFarSoGood)
return static_cast<float>(p.value.d);
case Variant::Bool:
return static_cast<double>(p.value.b);
return static_cast<float>(p.value.b);
case Variant::String:
return Utils::stof(*p.value.str);
case Variant::Generic:
return static_cast<double>(!!p.value.g);
return static_cast<float>(!!p.value.g);
default:
*soFarSoGood = false;

View file

@ -38,12 +38,21 @@
#include <xsd/cxx/pre.hxx>
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#include "conference-info.h"
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif
namespace conference_info
{
// Conference_type
//
//
const Conference_type::Conference_descriptionOptional& Conference_type::
getConference_description () const
@ -365,7 +374,7 @@ namespace conference_info
// State_type
//
//
State_type::
State_type (Value v)
@ -402,7 +411,7 @@ namespace conference_info
State_type& State_type::
operator= (Value v)
{
static_cast< ::xml_schema::String& > (*this) =
static_cast< ::xml_schema::String& > (*this) =
::xml_schema::String (_xsd_State_type_literals_[v]);
return *this;
@ -410,7 +419,7 @@ namespace conference_info
// Conference_description_type
//
//
const Conference_description_type::Display_textOptional& Conference_description_type::
getDisplay_text () const
@ -696,7 +705,7 @@ namespace conference_info
// Host_type
//
//
const Host_type::Display_textOptional& Host_type::
getDisplay_text () const
@ -838,7 +847,7 @@ namespace conference_info
// Conference_state_type
//
//
const Conference_state_type::User_countOptional& Conference_state_type::
getUser_count () const
@ -962,7 +971,7 @@ namespace conference_info
// Conference_media_type
//
//
const Conference_media_type::EntrySequence& Conference_media_type::
getEntry () const
@ -1014,7 +1023,7 @@ namespace conference_info
// Conference_medium_type
//
//
const Conference_medium_type::Display_textOptional& Conference_medium_type::
getDisplay_text () const
@ -1186,7 +1195,7 @@ namespace conference_info
// Uris_type
//
//
const Uris_type::EntrySequence& Uris_type::
getEntry () const
@ -1274,7 +1283,7 @@ namespace conference_info
// Uri_type
//
//
const Uri_type::UriType& Uri_type::
getUri () const
@ -1470,7 +1479,7 @@ namespace conference_info
}
// Users_type
//
//
const Users_type::UserSequence& Users_type::
getUser () const
@ -1576,7 +1585,7 @@ namespace conference_info
// User_type
//
//
const User_type::Display_textOptional& User_type::
getDisplay_text () const
@ -1862,7 +1871,7 @@ namespace conference_info
// User_roles_type
//
//
const User_roles_type::EntrySequence& User_roles_type::
getEntry () const
@ -1938,7 +1947,7 @@ namespace conference_info
}
// Endpoint_type
//
//
const Endpoint_type::Display_textOptional& Endpoint_type::
getDisplay_text () const
@ -2314,7 +2323,7 @@ namespace conference_info
// Endpoint_status_type
//
//
Endpoint_status_type::
Endpoint_status_type (Value v)
@ -2351,7 +2360,7 @@ namespace conference_info
Endpoint_status_type& Endpoint_status_type::
operator= (Value v)
{
static_cast< ::xml_schema::String& > (*this) =
static_cast< ::xml_schema::String& > (*this) =
::xml_schema::String (_xsd_Endpoint_status_type_literals_[v]);
return *this;
@ -2359,7 +2368,7 @@ namespace conference_info
// Joining_type
//
//
Joining_type::
Joining_type (Value v)
@ -2396,7 +2405,7 @@ namespace conference_info
Joining_type& Joining_type::
operator= (Value v)
{
static_cast< ::xml_schema::String& > (*this) =
static_cast< ::xml_schema::String& > (*this) =
::xml_schema::String (_xsd_Joining_type_literals_[v]);
return *this;
@ -2404,7 +2413,7 @@ namespace conference_info
// Disconnection_type
//
//
Disconnection_type::
Disconnection_type (Value v)
@ -2441,7 +2450,7 @@ namespace conference_info
Disconnection_type& Disconnection_type::
operator= (Value v)
{
static_cast< ::xml_schema::String& > (*this) =
static_cast< ::xml_schema::String& > (*this) =
::xml_schema::String (_xsd_Disconnection_type_literals_[v]);
return *this;
@ -2449,7 +2458,7 @@ namespace conference_info
// Execution_type
//
//
const Execution_type::WhenOptional& Execution_type::
getWhen () const
@ -2573,7 +2582,7 @@ namespace conference_info
// Call_type
//
//
const Call_type::SipOptional& Call_type::
getSip () const
@ -2655,7 +2664,7 @@ namespace conference_info
// Sip_dialog_id_type
//
//
const Sip_dialog_id_type::Display_textOptional& Sip_dialog_id_type::
getDisplay_text () const
@ -2827,7 +2836,7 @@ namespace conference_info
// Media_type
//
//
const Media_type::Display_textOptional& Media_type::
getDisplay_text () const
@ -3059,7 +3068,7 @@ namespace conference_info
// Media_status_type
//
//
Media_status_type::
Media_status_type (Value v)
@ -3096,7 +3105,7 @@ namespace conference_info
Media_status_type& Media_status_type::
operator= (Value v)
{
static_cast< ::xml_schema::String& > (*this) =
static_cast< ::xml_schema::String& > (*this) =
::xml_schema::String (_xsd_Media_status_type_literals_[v]);
return *this;
@ -3104,7 +3113,7 @@ namespace conference_info
// Sidebars_by_val_type
//
//
const Sidebars_by_val_type::EntrySequence& Sidebars_by_val_type::
getEntry () const
@ -9269,4 +9278,3 @@ namespace conference_info
//
//
// End epilogue.

View file

@ -38,8 +38,17 @@
#include <xsd/cxx/pre.hxx>
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#include "xml.h"
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif
namespace namespace_
{
// Lang
@ -66,7 +75,7 @@ namespace namespace_
}
// Space
//
//
Space::
Space (Value v)
@ -103,7 +112,7 @@ namespace namespace_
Space& Space::
operator= (Value v)
{
static_cast< ::xml_schema::Ncname& > (*this) =
static_cast< ::xml_schema::Ncname& > (*this) =
::xml_schema::Ncname (_xsd_Space_literals_[v]);
return *this;
@ -111,7 +120,7 @@ namespace namespace_
// Lang_member
//
//
Lang_member::
Lang_member (Value v)
@ -148,7 +157,7 @@ namespace namespace_
Lang_member& Lang_member::
operator= (Value v)
{
static_cast< ::xml_schema::String& > (*this) =
static_cast< ::xml_schema::String& > (*this) =
::xml_schema::String (_xsd_Lang_member_literals_[v]);
return *this;
@ -448,4 +457,3 @@ namespace namespace_
//
//
// End epilogue.