diff --git a/coreapi/Config.cc b/coreapi/Config.cc index 66655772f..2e0f7900e 100644 --- a/coreapi/Config.cc +++ b/coreapi/Config.cc @@ -258,7 +258,7 @@ LpItem *lp_section_find_item(const LpSection *sec, const char *name){ return NULL; } -static LpSection* linphone_config_parse_line(LpConfig* lpconfig, const char* line, LpSection* cur) { +static LpSection* linphone_config_parse_line(LpConfig* lpconfig, char* line, LpSection* cur) { LpSectionParam *params = NULL; char *pos1,*pos2; int nbs; @@ -523,7 +523,7 @@ static void xml2lpc_callback(void *ctx, xml2lpc_log_level level, const char *fmt case XML2LPC_DEBUG: bctbx_level = BCTBX_LOG_DEBUG; break; case XML2LPC_MESSAGE: bctbx_level = BCTBX_LOG_MESSAGE;break; case XML2LPC_WARNING: bctbx_level = BCTBX_LOG_WARNING;break; - case XML2LPC_ERROR: + case XML2LPC_ERROR: default: bctbx_level = BCTBX_LOG_ERROR;break; } @@ -631,7 +631,7 @@ bctbx_list_t * linphone_config_get_string_list(const LpConfig *lpconfig, const c bool_t linphone_config_get_range(const LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max) { const char *str = linphone_config_get_string(lpconfig, section, key, NULL); if (str != NULL) { - char *minusptr = strchr(str, '-'); + const char *minusptr = strchr(str, '-'); if ((minusptr == NULL) || (minusptr == str)) { *min = default_min; *max = default_max; diff --git a/coreapi/Enum.cc b/coreapi/Enum.cc index d5120998e..fa71f8945 100644 --- a/coreapi/Enum.cc +++ b/coreapi/Enum.cc @@ -80,7 +80,7 @@ static bool_t is_a_number(const char *str){ } //4970072278724 bool_t is_enum(const char *sipaddress, char **enum_domain){ - char *p; + const char *p; p=strstr(sipaddress,"sip:"); if (p==NULL) return FALSE; /* enum should look like sip:4369959250*/ else p+=4; diff --git a/coreapi/Misc.cc b/coreapi/Misc.cc index 5c41f650e..bb8541138 100644 --- a/coreapi/Misc.cc +++ b/coreapi/Misc.cc @@ -251,13 +251,12 @@ static int send_stun_request(int sock, const struct sockaddr *server, socklen_t int linphone_parse_host_port(const char *input, char *host, size_t hostlen, int *port){ char tmphost[NI_MAXHOST]={0}; - char *p1, *p2; if ((sscanf(input, "[%64[^]]]:%d", tmphost, port) == 2) || (sscanf(input, "[%64[^]]]", tmphost) == 1)) { } else { - p1 = strchr(input, ':'); - p2 = strrchr(input, ':'); + const char *p1 = strchr(input, ':'); + const char *p2 = strrchr(input, ':'); if (p1 && p2 && (p1 != p2)) {/* an ipv6 address without port*/ strncpy(tmphost, input, sizeof(tmphost) - 1); } else if (sscanf(input, "%[^:]:%d", tmphost, port) != 2) { @@ -366,7 +365,7 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ } sock3=create_socket(call->media_ports[call->main_text_stream_index].rtp_port); if (sock3==-1) return -1; - + got_audio=FALSE; got_video=FALSE; got_text=FALSE; @@ -731,7 +730,7 @@ void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call) { call->audio_stats->ice_state = LinphoneIceStateFailed; } }else call->audio_stats->ice_state = LinphoneIceStateNotActivated; - + if (call->params->has_video && (video_check_list != NULL)) { if (ice_check_list_state(video_check_list) == ICL_Completed) { switch (ice_check_list_selected_valid_candidate_type(video_check_list)) { @@ -754,7 +753,7 @@ void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call) { call->video_stats->ice_state = LinphoneIceStateFailed; } }else call->video_stats->ice_state = LinphoneIceStateNotActivated; - + if (call->params->realtimetext_enabled && (text_check_list != NULL)) { if (ice_check_list_state(text_check_list) == ICL_Completed) { switch (ice_check_list_selected_valid_candidate_type(text_check_list)) { @@ -843,7 +842,7 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess ms_warning("If ICE has completed successfully, rtp_candidate should be set!"); } } - + strncpy(desc->ice_pwd, ice_session_local_pwd(session), sizeof(desc->ice_pwd)); strncpy(desc->ice_ufrag, ice_session_local_ufrag(session), sizeof(desc->ice_ufrag)); for (i = 0; i < desc->nb_streams; i++) { @@ -951,14 +950,14 @@ static void clear_ice_check_list(LinphoneCall *call, IceCheckList *removed){ void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMediaDescription *md){ int i; - + if (!call->localdesc) return; for (i = 0; i < md->nb_streams; i++) { const SalStreamDescription *local_stream = &call->localdesc->streams[i]; const SalStreamDescription *stream = &md->streams[i]; IceCheckList *cl = ice_session_check_list(call->ice_session, i); if (!cl || !local_stream) continue; - + if (stream->rtcp_mux && local_stream->rtcp_mux){ ice_check_list_remove_rtcp_candidates(cl); } @@ -1747,7 +1746,7 @@ static void _create_ice_check_lists_and_parse_ice_attributes(LinphoneCall *call, else remote_family = AF_INET; if (strchr(addr, ':') != NULL) family = AF_INET6; else family = AF_INET; - + ice_add_losing_pair(cl, j + 1, remote_family, remote_candidate->addr, remote_candidate->port, family, addr, port); losing_pairs_added = TRUE; } @@ -1771,7 +1770,7 @@ static void _update_ice_from_remote_media_description(LinphoneCall *call, const stream = &md->streams[i]; cl = ice_session_check_list(call->ice_session, i); if (!cl) continue; - + if (!sal_stream_description_active(stream)) { ice_session_remove_check_list_from_idx(call->ice_session, i); clear_ice_check_list(call, cl); @@ -1819,7 +1818,7 @@ void linphone_core_report_call_log(LinphoneCore *lc, LinphoneCallLog *call_log){ } call_logs_write_to_config_file(lc); } - + linphone_core_notify_call_log_updated(lc,call_log); } diff --git a/coreapi/Presence.cc b/coreapi/Presence.cc index a19764d6a..45e285b59 100644 --- a/coreapi/Presence.cc +++ b/coreapi/Presence.cc @@ -994,7 +994,7 @@ LinphonePresenceActivity * linphone_presence_activity_new(LinphonePresenceActivi char * linphone_presence_activity_to_string(const LinphonePresenceActivity *activity) { LinphonePresenceActivityType acttype = linphone_presence_activity_get_type(activity); const char *description = linphone_presence_activity_get_description(activity); - const char *acttype_str = acttype_str = presence_activity_type_to_string(acttype); + const char *acttype_str = presence_activity_type_to_string(acttype); return ms_strdup_printf("%s%s%s", acttype_str, (description == NULL) ? "" : ": ", (description == NULL) ? "" : description); @@ -1535,7 +1535,7 @@ void linphone_core_notify_all_friends(LinphoneCore *lc, LinphonePresenceModel *p LinphoneFriendList *lfl = linphone_core_get_default_friend_list(lc); ms_message("Notifying all friends that we are [%s]", activity_str); if (activity_str != NULL) ms_free(activity_str); - + if (lfl) { linphone_friend_list_notify_presence(lfl, presence); } else { @@ -1922,7 +1922,7 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa LinphoneFriend *lf = NULL; const LinphoneAddress *lfa=NULL; LinphonePresenceModel *presence; - + if (model != NULL) { presence = (LinphonePresenceModel *)model; } else { diff --git a/coreapi/Sal.cc b/coreapi/Sal.cc index 1659b9ec6..b52557aad 100644 --- a/coreapi/Sal.cc +++ b/coreapi/Sal.cc @@ -733,7 +733,7 @@ void __sal_op_free(SalOp *op){ sal_custom_header_free(b->recv_custom_headers); if (b->sent_custom_headers) sal_custom_header_free(b->sent_custom_headers); - + if (b->entity_tag != NULL){ ms_free(b->entity_tag); b->entity_tag = NULL; @@ -867,7 +867,7 @@ const char* sal_privacy_to_string(SalPrivacy privacy) { } static void remove_trailing_spaces(char *line) { - size_t size = size = strlen(line); + size_t size = strlen(line); char *end = line + size - 1; while (end >= line && isspace(*end)) { end--; @@ -926,4 +926,3 @@ void sal_op_set_entity_tag(SalOp *op, const char* entity_tag) { else op_base->entity_tag = NULL; } -