mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-25 20:54:15 +00:00
Lots of trivial tweaks to minimize compiler warnings, especially on 64-bit platform: Added missing type casts, changed types, added missing NULL checks.
This commit is contained in:
1 parent
643c88f49b
commit
084e245085
57 files changed
+226
-216
No files matched your search
@@ -170,8 +170,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
*szpt = switch_event_get_header_nil(var_event, kPT);
|
||||
|
||||
|
||||
switch_port_t local_port = !zstr(szlocal_port) ? atoi(szlocal_port) : 0,
|
||||
remote_port = !zstr(szremote_port) ? atoi(szremote_port) : 0;
|
||||
switch_port_t local_port = !zstr(szlocal_port) ? (switch_port_t)atoi(szlocal_port) : 0,
|
||||
remote_port = !zstr(szremote_port) ? (switch_port_t)atoi(szremote_port) : 0;
|
||||
|
||||
int ptime = !zstr(szptime) ? atoi(szptime) : 0,
|
||||
//rfc2833_pt = !zstr(szrfc2833_pt) ? atoi(szrfc2833_pt) : 0,
|
||||
@@ -203,7 +203,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
tech_pvt->remote_address = switch_core_session_strdup(*new_session, remote_addr);
|
||||
tech_pvt->remote_port = remote_port;
|
||||
tech_pvt->ptime = ptime;
|
||||
tech_pvt->agreed_pt = pt;
|
||||
tech_pvt->agreed_pt = (switch_payload_t)pt;
|
||||
tech_pvt->dtmf_type = DTMF_2833; /* XXX */
|
||||
|
||||
if (zstr(local_addr) || local_port == 0) {
|
||||
@@ -456,7 +456,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
|
||||
compare_var(event, channel, kREMOTEPORT)) {
|
||||
char *remote_addr = switch_event_get_header(event, kREMOTEADDR);
|
||||
char *szremote_port = switch_event_get_header(event, kREMOTEPORT);
|
||||
switch_port_t remote_port = !zstr(szremote_port) ? atoi(szremote_port) : 0;
|
||||
switch_port_t remote_port = !zstr(szremote_port) ? (switch_port_t)atoi(szremote_port) : 0;
|
||||
const char *err;
|
||||
|
||||
|
||||
@@ -512,7 +512,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
|
||||
goto fail;
|
||||
}
|
||||
|
||||
switch_rtp_set_default_payload(tech_pvt->rtp_session, pt);
|
||||
switch_rtp_set_default_payload(tech_pvt->rtp_session, (switch_payload_t)pt);
|
||||
//switch_rtp_set_recv_pt(tech_pvt->rtp_session, pt);
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
|
||||
int pt = !zstr(szpt) ? atoi(szpt) : 0;
|
||||
|
||||
switch_channel_set_variable(channel, kRFC2833PT, szpt);
|
||||
switch_rtp_set_telephony_event(tech_pvt->rtp_session, pt);
|
||||
switch_rtp_set_telephony_event(tech_pvt->rtp_session, (switch_payload_t)pt);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -500,12 +500,12 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
|
||||
int cur_len = 0;
|
||||
char *tmp = NULL;
|
||||
char *hold = strdup(sip_header_as_string(nua_handle_home(nh), (void *) call_info));
|
||||
cur_len = strlen(hold);
|
||||
cur_len = (int)strlen(hold);
|
||||
|
||||
while ( call_info->ci_next != NULL) {
|
||||
call_info = call_info->ci_next;
|
||||
tmp = strdup(sip_header_as_string(nua_handle_home(nh), (void *) call_info));
|
||||
cur_len = cur_len + strlen(tmp) +2;
|
||||
cur_len = cur_len + (int)strlen(tmp) +2;
|
||||
hold = realloc(hold, cur_len);
|
||||
switch_assert(hold);
|
||||
strcat(hold,",");
|
||||
@@ -1792,7 +1792,7 @@ void sofia_queue_message(sofia_dispatch_event_t *de)
|
||||
}
|
||||
|
||||
|
||||
if ((switch_queue_size(mod_sofia_globals.msg_queue) > (SOFIA_MSG_QUEUE_SIZE * msg_queue_threads))) {
|
||||
if ((switch_queue_size(mod_sofia_globals.msg_queue) > (SOFIA_MSG_QUEUE_SIZE * (unsigned int)msg_queue_threads))) {
|
||||
launch++;
|
||||
}
|
||||
|
||||
@@ -1878,7 +1878,7 @@ void sofia_event_callback(nua_event_t event,
|
||||
}
|
||||
|
||||
|
||||
if (switch_queue_size(mod_sofia_globals.msg_queue) > critical) {
|
||||
if (switch_queue_size(mod_sofia_globals.msg_queue) > (unsigned int)critical) {
|
||||
nua_respond(nh, 503, "System Busy", SIPTAG_RETRY_AFTER_STR("300"), NUTAG_WITH_THIS(nua), TAG_END());
|
||||
goto end;
|
||||
}
|
||||
@@ -2346,7 +2346,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
|
||||
|
||||
|
||||
if (!sofia_test_pflag(profile, PFLAG_STANDBY)) {
|
||||
if (++ireg_loops >= profile->ireg_seconds) {
|
||||
if (++ireg_loops >= (uint32_t)profile->ireg_seconds) {
|
||||
time_t now = switch_epoch_time_now(NULL);
|
||||
sofia_reg_check_expire(profile, now, 0);
|
||||
ireg_loops = 0;
|
||||
@@ -2630,13 +2630,13 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
||||
|
||||
for (via = vias; via; via = via->v_next) {
|
||||
if (sofia_test_pflag(profile, PFLAG_AUTO_ASSIGN_PORT) && !strcmp(via->v_protocol, "SIP/2.0/UDP")) {
|
||||
profile->sip_port = atoi(via->v_port);
|
||||
profile->sip_port = (switch_port_t)atoi(via->v_port);
|
||||
if (!profile->extsipport) profile->extsipport = profile->sip_port;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found auto sip port %d for %s\n", profile->sip_port, profile->name);
|
||||
}
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_AUTO_ASSIGN_TLS_PORT) && !strcmp(via->v_protocol, "SIP/2.0/TLS")) {
|
||||
profile->tls_sip_port = atoi(via->v_port);
|
||||
profile->tls_sip_port = (switch_port_t)atoi(via->v_port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found auto sip port %d for %s (TLS)\n", profile->tls_sip_port, profile->name);
|
||||
}
|
||||
|
||||
@@ -4216,7 +4216,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
||||
profile->sipip = switch_core_strdup(profile->pool, ip);
|
||||
} else if (!strcasecmp(var, "ext-sip-port") && val) {
|
||||
int tmp = atoi(val);
|
||||
if (tmp > 0) profile->extsipport = tmp;
|
||||
if (tmp > 0) profile->extsipport = (switch_port_t)tmp;
|
||||
} else if (!strcasecmp(var, "ext-sip-ip")) {
|
||||
if (!zstr(val)) {
|
||||
char *ip = mod_sofia_globals.guess_ip;
|
||||
|
||||
@@ -288,9 +288,9 @@ enum tport_tls_verify_policy sofia_glue_str2tls_verify_policy(const char * str){
|
||||
|
||||
while (ptr_cur) {
|
||||
if ((ptr_next = strchr(ptr_cur, '|'))) {
|
||||
len = ptr_next++ - ptr_cur;
|
||||
len = (int)(ptr_next++ - ptr_cur);
|
||||
} else {
|
||||
len = strlen(ptr_cur);
|
||||
len = (int)strlen(ptr_cur);
|
||||
}
|
||||
if (!strncasecmp(ptr_cur, "in",len)) {
|
||||
ret |= TPTLS_VERIFY_IN;
|
||||
@@ -483,7 +483,7 @@ void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port)
|
||||
su_addrinfo_t *addrinfo = msg_addrinfo(msg);
|
||||
|
||||
if (buf) {
|
||||
get_addr(buf, buflen, addrinfo->ai_addr, addrinfo->ai_addrlen);
|
||||
get_addr(buf, buflen, addrinfo->ai_addr, (socklen_t)addrinfo->ai_addrlen);
|
||||
}
|
||||
|
||||
if (port) {
|
||||
@@ -1834,14 +1834,14 @@ int sofia_recover_callback(switch_core_session_t *session)
|
||||
if ((tmp = switch_channel_get_variable(tech_pvt->channel, "rtp_2833_send_payload"))) {
|
||||
int te = atoi(tmp);
|
||||
if (te > 64) {
|
||||
tech_pvt->te = te;
|
||||
tech_pvt->te = (switch_payload_t)te;
|
||||
}
|
||||
}
|
||||
|
||||
if ((tmp = switch_channel_get_variable(tech_pvt->channel, "rtp_2833_recv_payload"))) {
|
||||
int te = atoi(tmp);
|
||||
if (te > 64) {
|
||||
tech_pvt->recv_te = te;
|
||||
tech_pvt->recv_te = (switch_payload_t)te;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4626,7 +4626,7 @@ void sofia_presence_handle_sip_i_message(int status,
|
||||
auth_res = sofia_reg_parse_auth(profile, authorization, sip, de,
|
||||
(char *) sip->sip_request->rq_method_name, key, keylen, network_ip, NULL, 0,
|
||||
REG_INVITE, NULL, NULL, NULL, NULL);
|
||||
} else if ( sofia_reg_handle_register(nua, profile, nh, sip, de, REG_INVITE, key, keylen, &v_event, NULL, NULL, NULL)) {
|
||||
} else if ( sofia_reg_handle_register(nua, profile, nh, sip, de, REG_INVITE, key, (uint32_t)keylen, &v_event, NULL, NULL, NULL)) {
|
||||
if (v_event) {
|
||||
switch_event_destroy(&v_event);
|
||||
}
|
||||
|
||||
@@ -1071,7 +1071,8 @@ static int debounce_check(sofia_profile_t *profile, const char *user, const char
|
||||
int r = 0;
|
||||
time_t *last, now = switch_epoch_time_now(NULL);
|
||||
|
||||
snprintf(key, sizeof(key), "%s%s", user, host);
|
||||
snprintf(key, sizeof(key)-1, "%s%s", user, host);
|
||||
key[sizeof(key)-1] = '\0';
|
||||
|
||||
switch_mutex_lock(profile->ireg_mutex);
|
||||
if ((last = switch_core_hash_find(profile->mwi_debounce_hash, key))) {
|
||||
|
||||
Reference in new issue
Block a user