diff --git a/coreapi/bellesip_sal/sal_op_call.c b/coreapi/bellesip_sal/sal_op_call.c index 24e613b53..f3b486b58 100644 --- a/coreapi/bellesip_sal/sal_op_call.c +++ b/coreapi/bellesip_sal/sal_op_call.c @@ -302,7 +302,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 =1000*((float)rand()/RAND_MAX); + unsigned int retry_in = (unsigned int)(1000*((float)rand()/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); diff --git a/coreapi/chat.c b/coreapi/chat.c index 36eaecffd..5c60a10c4 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -515,7 +515,7 @@ void linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessag been encrypted */ /* convert the key from base 64 */ xmlChar *keyb64 = xmlNodeListGetString(xmlMessageBody, cur->xmlChildrenNode, 1); - int keyLength = b64_decode((char *)keyb64, strlen((char *)keyb64), NULL, 0); + size_t keyLength = b64_decode((char *)keyb64, strlen((char *)keyb64), NULL, 0); uint8_t *keyBuffer = (uint8_t *)malloc(keyLength); /* decode the key into local key buffer */ b64_decode((char *)keyb64, strlen((char *)keyb64), keyBuffer, keyLength); diff --git a/coreapi/chat_file_transfer.c b/coreapi/chat_file_transfer.c index 6cb7d85f7..fecbcfc69 100644 --- a/coreapi/chat_file_transfer.c +++ b/coreapi/chat_file_transfer.c @@ -246,7 +246,7 @@ static void linphone_chat_message_process_response_from_post_file(void *data, ->xmlChildrenNode; /* need to parse the children node to update the file-name one */ /* convert key to base64 */ - int b64Size = b64_encode(NULL, FILE_TRANSFER_KEY_SIZE, NULL, 0); + size_t b64Size = b64_encode(NULL, FILE_TRANSFER_KEY_SIZE, NULL, 0); char *keyb64 = (char *)ms_malloc0(b64Size + 1); int xmlStringLength; diff --git a/coreapi/dict.c b/coreapi/dict.c index 417bb33f0..adc50d480 100644 --- a/coreapi/dict.c +++ b/coreapi/dict.c @@ -103,7 +103,7 @@ int linphone_dictionary_haskey(const LinphoneDictionary* obj, const char* key) void linphone_dictionary_foreach(const LinphoneDictionary* obj, void (*apply_func)(const char*, void*, void*), void* userdata) { - return belle_sip_dict_foreach(obj, apply_func, userdata); + belle_sip_dict_foreach(obj, apply_func, userdata); } struct lp_config_to_dict { diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index bff0a00f1..e99912c1b 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -161,21 +161,21 @@ static void ecc_play_tones(EcCalibrator *ecc){ strncpy(expected_tone.tone_name,"freq1",sizeof(expected_tone.tone_name)); expected_tone.frequency=2000; expected_tone.min_duration=40; - expected_tone.min_amplitude=0.1; + 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=2300; expected_tone.min_duration=40; - expected_tone.min_amplitude=0.1; + 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=2500; expected_tone.min_duration=40; - expected_tone.min_amplitude=0.1; + expected_tone.min_amplitude=0.1f; ms_filter_call_method (ecc->det,MS_TONE_DETECTOR_ADD_SCAN,&expected_tone); @@ -208,7 +208,7 @@ static void ecc_play_tones(EcCalibrator *ecc){ ms_sleep(1); if (ecc->freq1 && ecc->freq2 && ecc->freq3) { - int delay=ecc->acc/3; + int delay=(int)(ecc->acc/3); if (delay<0){ ms_error("Quite surprising calibration result, delay=%i",delay); ecc->status=LinphoneEcCalibratorFailed; diff --git a/coreapi/enum.c b/coreapi/enum.c index 8818ae6ee..1c0651675 100644 --- a/coreapi/enum.c +++ b/coreapi/enum.c @@ -31,9 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static char *create_enum_domain(const char *number){ - int len=strlen(number); + size_t len=strlen(number); char *domain=ms_malloc((len*2)+10); - int i,j; + size_t i,j; for (i=0,j=len-1;j>=0;j--){ domain[i]=number[j]; diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d11a4e1dd..3f4b8bbc0 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -53,8 +53,8 @@ MSWebCam *get_nowebcam_device(){ } -static bool_t generate_b64_crypto_key(int key_length, char* key_out, size_t key_out_size) { - int b64_size; +static bool_t generate_b64_crypto_key(size_t key_length, char* key_out, size_t key_out_size) { + size_t b64_size; uint8_t* tmp = (uint8_t*) ms_malloc0(key_length); if (sal_get_random_bytes(tmp, key_length)==NULL) { ms_error("Failed to generate random key"); @@ -428,7 +428,7 @@ static void update_media_description_from_stun(SalMediaDescription *md, const St } static int setup_encryption_key(SalSrtpCryptoAlgo *crypto, MSCryptoSuite suite, unsigned int tag){ - int keylen=0; + size_t keylen=0; crypto->tag=tag; crypto->algo=suite; switch(suite){ @@ -1936,7 +1936,7 @@ bool_t linphone_call_has_transfer_pending(const LinphoneCall *call){ **/ int linphone_call_get_duration(const LinphoneCall *call){ if (call->log->connected_date_time==0) return 0; - return ms_time(NULL)-call->log->connected_date_time; + return (int)(ms_time(NULL) - call->log->connected_date_time); } /** @@ -2503,7 +2503,7 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute float mic_gain=lc->sound_conf.soft_mic_lev; float thres = 0; float recv_gain; - float ng_thres=lp_config_get_float(lc->config,"sound","ng_thres",0.05); + float ng_thres=lp_config_get_float(lc->config,"sound","ng_thres",0.05f); float ng_floorgain=lp_config_get_float(lc->config,"sound","ng_floorgain",0); int dc_removal=lp_config_get_int(lc->config,"sound","dc_removal",0); float speed; @@ -2532,7 +2532,7 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute sustain=lp_config_get_int(lc->config,"sound","el_sustain",-1); transmit_thres=lp_config_get_float(lc->config,"sound","el_transmit_thres",-1); f=st->volsend; - if (speed==-1) speed=0.03; + if (speed==-1) speed=0.03f; if (force==-1) force=25; ms_filter_call_method(f,MS_VOLUME_SET_EA_SPEED,&speed); ms_filter_call_method(f,MS_VOLUME_SET_EA_FORCE,&force); @@ -2548,7 +2548,7 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute } if (st->volrecv){ /* parameters for a limited noise-gate effect, using echo limiter threshold */ - floorgain = 1/pow(10,(mic_gain)/10); + floorgain = (float)(1/pow(10,mic_gain/10)); spk_agc=lp_config_get_int(lc->config,"sound","speaker_agc_enabled",0); ms_filter_call_method(st->volrecv, MS_VOLUME_ENABLE_AGC, &spk_agc); ms_filter_call_method(st->volrecv,MS_VOLUME_SET_NOISE_GATE_THRESHOLD,&ng_thres); @@ -3460,7 +3460,7 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, MediaStream *st){ float quality=media_stream_get_average_quality_rating(st); if (quality>=0){ if (log->quality!=-1){ - log->quality*=quality/5.0; + log->quality*=quality/5.0f; }else log->quality=quality; } } @@ -3482,7 +3482,7 @@ static void linphone_call_stop_audio_stream(LinphoneCall *call) { media_stream_reclaim_sessions(&call->audiostream->ms,&call->sessions[call->main_audio_stream_index]); if (call->audiostream->ec){ - const char *state_str=NULL; + char *state_str=NULL; ms_filter_call_method(call->audiostream->ec,MS_ECHO_CANCELLER_GET_STATE_STRING,&state_str); if (state_str){ ms_message("Writing echo canceler state, %i bytes",(int)strlen(state_str)); @@ -3703,19 +3703,19 @@ void linphone_call_set_microphone_volume_gain(LinphoneCall *call, float volume) * active audio stream exist. Otherwise it returns the quality rating. **/ float linphone_call_get_current_quality(LinphoneCall *call){ - float audio_rating=-1; - float video_rating=-1; + float audio_rating=-1.f; + float video_rating=-1.f; float result; if (call->audiostream){ - audio_rating=media_stream_get_quality_rating((MediaStream*)call->audiostream)/5.0; + audio_rating=media_stream_get_quality_rating((MediaStream*)call->audiostream)/5.0f; } if (call->videostream){ - video_rating=media_stream_get_quality_rating((MediaStream*)call->videostream)/5.0; + video_rating=media_stream_get_quality_rating((MediaStream*)call->videostream)/5.0f; } if (audio_rating<0 && video_rating<0) result=-1; - else if (audio_rating<0) result=video_rating*5.0; - else if (video_rating<0) result=audio_rating*5.0; - else result=audio_rating*video_rating*5.0; + else if (audio_rating<0) result=video_rating*5.0f; + else if (video_rating<0) result=audio_rating*5.0f; + else result=audio_rating*video_rating*5.0f; return result; } @@ -3812,7 +3812,7 @@ float linphone_call_stats_get_sender_loss_rate(const LinphoneCallStats *stats) { srb = rtcp_RR_get_report_block(stats->sent_rtcp, 0); if (!srb) return 0.0; - return 100.0 * report_block_get_fraction_lost(srb) / 256.0; + return 100.0f * report_block_get_fraction_lost(srb) / 256.0f; } /** @@ -3833,7 +3833,7 @@ float linphone_call_stats_get_receiver_loss_rate(const LinphoneCallStats *stats) rrb = rtcp_SR_get_report_block(stats->received_rtcp, 0); if (!rrb) return 0.0; - return 100.0 * report_block_get_fraction_lost(rrb) / 256.0; + return 100.0f * report_block_get_fraction_lost(rrb) / 256.0f; } /** @@ -3988,14 +3988,14 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v bool_t as_active = as ? (media_stream_get_state(as) == MSStreamStarted) : FALSE; bool_t vs_active = vs ? (media_stream_get_state(vs) == MSStreamStarted) : FALSE; - call->stats[LINPHONE_CALL_STATS_AUDIO].download_bandwidth=(as_active) ? (media_stream_get_down_bw(as)*1e-3) : 0; - call->stats[LINPHONE_CALL_STATS_AUDIO].upload_bandwidth=(as_active) ? (media_stream_get_up_bw(as)*1e-3) : 0; - call->stats[LINPHONE_CALL_STATS_VIDEO].download_bandwidth=(vs_active) ? (media_stream_get_down_bw(vs)*1e-3) : 0; - call->stats[LINPHONE_CALL_STATS_VIDEO].upload_bandwidth=(vs_active) ? (media_stream_get_up_bw(vs)*1e-3) : 0; - call->stats[LINPHONE_CALL_STATS_AUDIO].rtcp_download_bandwidth=(as_active) ? (media_stream_get_rtcp_down_bw(as)*1e-3) : 0; - call->stats[LINPHONE_CALL_STATS_AUDIO].rtcp_upload_bandwidth=(as_active) ? (media_stream_get_rtcp_up_bw(as)*1e-3) : 0; - call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_download_bandwidth=(vs_active) ? (media_stream_get_rtcp_down_bw(vs)*1e-3) : 0; - call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_upload_bandwidth=(vs_active) ? (media_stream_get_rtcp_up_bw(vs)*1e-3) : 0; + call->stats[LINPHONE_CALL_STATS_AUDIO].download_bandwidth=(as_active) ? (float)(media_stream_get_down_bw(as)*1e-3) : 0.f; + call->stats[LINPHONE_CALL_STATS_AUDIO].upload_bandwidth=(as_active) ? (float)(media_stream_get_up_bw(as)*1e-3) : 0.f; + call->stats[LINPHONE_CALL_STATS_VIDEO].download_bandwidth=(vs_active) ? (float)(media_stream_get_down_bw(vs)*1e-3) : 0.f; + call->stats[LINPHONE_CALL_STATS_VIDEO].upload_bandwidth=(vs_active) ? (float)(media_stream_get_up_bw(vs)*1e-3) : 0.f; + call->stats[LINPHONE_CALL_STATS_AUDIO].rtcp_download_bandwidth=(as_active) ? (float)(media_stream_get_rtcp_down_bw(as)*1e-3) : 0.f; + call->stats[LINPHONE_CALL_STATS_AUDIO].rtcp_upload_bandwidth=(as_active) ? (float)(media_stream_get_rtcp_up_bw(as)*1e-3) : 0.f; + call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_download_bandwidth=(vs_active) ? (float)(media_stream_get_rtcp_down_bw(vs)*1e-3) : 0.f; + call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_upload_bandwidth=(vs_active) ? (float)(media_stream_get_rtcp_up_bw(vs)*1e-3) : 0.f; call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); @@ -4400,7 +4400,7 @@ void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, if (zoom_factor < 1) zoom_factor = 1; - halfsize = 0.5 * 1.0 / zoom_factor; + halfsize = 0.5f * 1.0f / zoom_factor; if ((*cx - halfsize) < 0) *cx = 0 + halfsize; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index fb7cd222d..cb9446cd6 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -410,7 +410,7 @@ static int log_collection_upload_on_send_body(belle_sip_user_body_handler_t *bh, #else FILE *log_file = fopen(log_filename, "r"); #endif - if (fseek(log_file, offset, SEEK_SET)) { + if (fseek(log_file, (long)offset, SEEK_SET)) { ms_error("Cannot seek file [%s] at position [%lu] errno [%s]",log_filename,(unsigned long)offset,strerror(errno)); } else { @@ -537,16 +537,16 @@ static void process_response_from_post_file_log_collection(void *data, const bel */ static int compress_file(FILE *input_file, COMPRESS_FILE_PTR output_file) { char buffer[131072]; /* 128kB */ - int bytes; + size_t bytes; while ((bytes = fread(buffer, 1, sizeof(buffer), input_file)) > 0) { - if (bytes < 0) return bytes; #ifdef HAVE_ZLIB - bytes = gzwrite(output_file, buffer, bytes); + int res = gzwrite(output_file, buffer, (unsigned int)bytes); + if (res < 0) return 0; #else bytes = fwrite(buffer, 1, bytes, output_file); + if (bytes < 0) return (int)bytes; #endif - if (bytes < 0) return bytes; } return 0; } @@ -569,7 +569,7 @@ static int prepare_log_collection_file_to_upload(const char *filename) { input_file = fopen(input_filename, "r"); if (input_file == NULL) goto error; ret = compress_file(input_file, output_file); - if (ret < 0) goto error; + if (ret == 0) goto error; fclose(input_file); ms_free(input_filename); input_filename = ms_strdup_printf("%s/%s2.log", @@ -578,7 +578,7 @@ static int prepare_log_collection_file_to_upload(const char *filename) { input_file = fopen(input_filename, "r"); if (input_file != NULL) { ret = compress_file(input_file, output_file); - if (ret < 0) goto error; + if (ret == 0) goto error; } error: @@ -2568,7 +2568,7 @@ void linphone_core_iterate(LinphoneCore *lc){ calls = lc->calls; while(calls!= NULL){ call = (LinphoneCall *)calls->data; - elapsed = current_real_time - call->log->start_date_time; + elapsed = (int)(current_real_time - call->log->start_date_time); /* get immediately a reference to next one in case the one we are going to examine is destroy and removed during linphone_core_start_invite() */ @@ -5844,7 +5844,7 @@ static MSFilter *get_audio_resource(LinphoneCore *lc, LinphoneAudioResourceType return NULL; } if (lc->ringstream==NULL){ - float amp=lp_config_get_float(lc->config,"sound","dtmf_player_amp",0.1); + float amp=lp_config_get_float(lc->config,"sound","dtmf_player_amp",0.1f); MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard; if (ringcard == NULL) return NULL; diff --git a/coreapi/lpc2xml.c b/coreapi/lpc2xml.c index 1446a94cc..b00c4560a 100644 --- a/coreapi/lpc2xml.c +++ b/coreapi/lpc2xml.c @@ -74,7 +74,7 @@ static void lpc2xml_log(lpc2xml_context *xmlCtx, int level, const char *fmt, ... static void lpc2xml_genericxml_error(void *ctx, const char *fmt, ...) { lpc2xml_context *xmlCtx = (lpc2xml_context *)ctx; - int sl = strlen(xmlCtx->errorBuffer); + size_t sl = strlen(xmlCtx->errorBuffer); va_list args; va_start(args, fmt); vsnprintf(xmlCtx->errorBuffer + sl, LPC2XML_BZ-sl, fmt, args); diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index 7300d63e2..de463890a 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -231,7 +231,7 @@ static LpSection* lp_config_parse_line(LpConfig* lpconfig, const char* line, LpS LpSectionParam *params = NULL; char *pos1,*pos2; int nbs; - int size=strlen(line)+1; + size_t size=strlen(line)+1; char *secname=ms_malloc(size); char *key=ms_malloc(size); char *value=ms_malloc(size); diff --git a/coreapi/misc.c b/coreapi/misc.c index 77bb7743b..6cc1a9490 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -233,7 +233,7 @@ bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, cons case PAYLOAD_AUDIO_CONTINUOUS: case PAYLOAD_AUDIO_PACKETIZED: codec_band=get_audio_payload_bandwidth(lc,pt,bandwidth_limit); - ret=bandwidth_is_greater(bandwidth_limit,codec_band); + ret=bandwidth_is_greater(bandwidth_limit,(int)codec_band); /*ms_message("Payload %s: codec_bandwidth=%g, bandwidth_limit=%i",pt->mime_type,codec_band,bandwidth_limit);*/ break; case PAYLOAD_VIDEO: @@ -381,7 +381,7 @@ int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, sock } if (!res) return -1; memcpy(ss,res->ai_addr,res->ai_addrlen); - *socklen=res->ai_addrlen; + *socklen=(socklen_t)res->ai_addrlen; freeaddrinfo(res); return 0; } @@ -458,15 +458,15 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ int id; if (loops%20==0){ ms_message("Sending stun requests..."); - sendStunRequest(sock1,ai->ai_addr,ai->ai_addrlen,11,TRUE); - sendStunRequest(sock1,ai->ai_addr,ai->ai_addrlen,1,FALSE); + sendStunRequest((int)sock1,ai->ai_addr,(socklen_t)ai->ai_addrlen,11,TRUE); + sendStunRequest((int)sock1,ai->ai_addr,(socklen_t)ai->ai_addrlen,1,FALSE); if (sock2!=-1){ - sendStunRequest(sock2,ai->ai_addr,ai->ai_addrlen,22,TRUE); - sendStunRequest(sock2,ai->ai_addr,ai->ai_addrlen,2,FALSE); + sendStunRequest((int)sock2,ai->ai_addr,(socklen_t)ai->ai_addrlen,22,TRUE); + sendStunRequest((int)sock2,ai->ai_addr,(socklen_t)ai->ai_addrlen,2,FALSE); } if (sock3!=-1){ - sendStunRequest(sock3,ai->ai_addr,ai->ai_addrlen,33,TRUE); - sendStunRequest(sock3,ai->ai_addr,ai->ai_addrlen,3,FALSE); + sendStunRequest((int)sock3,ai->ai_addr,(socklen_t)ai->ai_addrlen,33,TRUE); + sendStunRequest((int)sock3,ai->ai_addr,(socklen_t)ai->ai_addrlen,3,FALSE); } } ms_usleep(10000); @@ -674,7 +674,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) ms_message("ICE: gathering candidate from [%s]",server); /* Gather local srflx candidates. */ - ice_session_gather_candidates(call->ice_session, ai->ai_addr, ai->ai_addrlen); + ice_session_gather_candidates(call->ice_session, ai->ai_addr, (socklen_t)ai->ai_addrlen); return 0; } @@ -1188,7 +1188,7 @@ static int get_local_ip_for_with_connect(int type, const char *dest, char *resul if (err<0){ ms_warning("Error in setsockopt: %s",strerror(errno)); } - err=connect(sock,res->ai_addr,res->ai_addrlen); + err=connect(sock,res->ai_addr,(int)res->ai_addrlen); if (err<0) { /*the network isn't reachable*/ if (getSocketErrorCode()!=ENETUNREACH) ms_error("Error in connect: %s",strerror(errno)); diff --git a/coreapi/player.c b/coreapi/player.c index 1b2a01022..668b91c01 100644 --- a/coreapi/player.c +++ b/coreapi/player.c @@ -94,7 +94,7 @@ int linphone_player_get_current_position(LinphonePlayer *obj) { * @param obj the player. **/ void linphone_player_close(LinphonePlayer *obj){ - return obj->close(obj); + obj->close(obj); } /** diff --git a/coreapi/quality_reporting.c b/coreapi/quality_reporting.c index f9d815849..94fa77d83 100644 --- a/coreapi/quality_reporting.c +++ b/coreapi/quality_reporting.c @@ -44,7 +44,7 @@ static char * float_to_one_decimal_string(float f) { float rounded_f = floorf(f * 10 + .5f) / 10; int floor_part = (int) rounded_f; - int one_decimal_part = floorf (10 * (rounded_f - floor_part) + .5f); + int one_decimal_part = (int)floorf(10 * (rounded_f - floor_part) + .5f); return ms_strdup_printf("%d.%d", floor_part, one_decimal_part); } @@ -442,11 +442,11 @@ static void qos_analyzer_on_action_suggested(void *user_data, int datac, const c if (streams[i]->encoder!=NULL){ if (ms_filter_has_method(streams[i]->encoder,MS_FILTER_GET_BITRATE)){ ms_filter_call_method(streams[i]->encoder,MS_FILTER_GET_BITRATE,&bitrate[i]); - bitrate[i] /= 1000.f; + bitrate[i] /= 1000; } } - up_bw[i] = media_stream_get_up_bw(streams[i])/1000.f; - down_bw[i] = media_stream_get_down_bw(streams[i])/1000.f; + up_bw[i] = (int)(media_stream_get_up_bw(streams[i])/1000.f); + down_bw[i] = (int)(media_stream_get_down_bw(streams[i])/1000.f); } } if (call->audiostream!=NULL){ @@ -628,14 +628,14 @@ void linphone_reporting_on_rtcp_update(LinphoneCall *call, SalStreamType stats_t if (rtt > 1e-6){ metrics->rtcp_sr_count++; - metrics->delay.round_trip_delay += 1000*rtt; + metrics->delay.round_trip_delay += (int)(1000*rtt); } } }while(rtcp_next_packet(block)); /* check if we should send an interval report - use a random sending time to dispatch reports and avoid sending them too close from each other */ - if (report_interval>0 && ms_time(NULL)-report->last_report_date>reporting_rand(report_interval)){ + if ((report_interval > 0) && ((float)(ms_time(NULL) - report->last_report_date) > reporting_rand((float)report_interval))) { linphone_reporting_update_media_info(call, stats_type); send_report(call, report, "VQIntervalReport"); } diff --git a/coreapi/sal.c b/coreapi/sal.c index 976951697..ab3649a1e 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -728,14 +728,14 @@ const char* sal_privacy_to_string(SalPrivacy privacy) { } static void remove_trailing_spaces(char *line){ - int i; + size_t i; for(i=strlen(line)-1;i>=0;--i){ if (isspace(line[i])) line[i]='\0'; else break; } } -static int line_get_value(const char *input, const char *key, char *value, size_t value_size, int *read){ +static int line_get_value(const char *input, const char *key, char *value, size_t value_size, size_t *read){ const char *end=strchr(input,'\n'); char line[256]={0}; char key_candidate[256]; @@ -760,7 +760,7 @@ static int line_get_value(const char *input, const char *key, char *value, size_ } int sal_lines_get_value(const char *data, const char *key, char *value, size_t value_size){ - int read=0; + size_t read=0; do{ if (line_get_value(data,key,value,value_size,&read)) diff --git a/coreapi/xml.c b/coreapi/xml.c index b4b994174..8c7c3beaf 100644 --- a/coreapi/xml.c +++ b/coreapi/xml.c @@ -51,7 +51,7 @@ void linphone_xmlparsing_context_destroy(xmlparsing_context_t *ctx) { void linphone_xmlparsing_genericxml_error(void *ctx, const char *fmt, ...) { xmlparsing_context_t *xmlCtx = (xmlparsing_context_t *)ctx; - int sl = strlen(xmlCtx->errorBuffer); + size_t sl = strlen(xmlCtx->errorBuffer); va_list args; va_start(args, fmt); vsnprintf(xmlCtx->errorBuffer + sl, XMLPARSING_BUFFER_LEN - sl, fmt, args); diff --git a/coreapi/xml2lpc.c b/coreapi/xml2lpc.c index 57380bcd2..21437e61f 100644 --- a/coreapi/xml2lpc.c +++ b/coreapi/xml2lpc.c @@ -80,7 +80,7 @@ static void xml2lpc_log(xml2lpc_context *xmlCtx, int level, const char *fmt, ... static void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) { xml2lpc_context *xmlCtx = (xml2lpc_context *)ctx; - int sl = strlen(xmlCtx->errorBuffer); + size_t sl = strlen(xmlCtx->errorBuffer); va_list args; va_start(args, fmt); vsnprintf(xmlCtx->errorBuffer + sl, XML2LPC_BZ-sl, fmt, args); @@ -89,7 +89,7 @@ static void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) { static void xml2lpc_genericxml_warning(void *ctx, const char *fmt, ...) { xml2lpc_context *xmlCtx = (xml2lpc_context *)ctx; - int sl = strlen(xmlCtx->warningBuffer); + size_t sl = strlen(xmlCtx->warningBuffer); va_list args; va_start(args, fmt); vsnprintf(xmlCtx->warningBuffer + sl, XML2LPC_BZ-sl, fmt, args); diff --git a/include/sal/sal.h b/include/sal/sal.h index 263ab52ee..423ed7ab1 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -759,8 +759,8 @@ SalPrivacy sal_op_get_privacy(const SalOp* op); -#define payload_type_set_number(pt,n) (pt)->user_data=(void*)((long)n); -#define payload_type_get_number(pt) ((int)(long)(pt)->user_data) +#define payload_type_set_number(pt,n) (pt)->user_data=(void*)((intptr_t)n); +#define payload_type_get_number(pt) ((int)(intptr_t)(pt)->user_data) /*misc*/ void sal_get_default_local_ip(Sal *sal, int address_family, char *ip, size_t iplen);