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:
Peter Olsson committed 2014-01-22 22:30:23 +01:00
1 parent 643c88f49b
commit 084e245085
57 files changed
+226 -216

No files matched your search

@@ -1543,7 +1543,7 @@ static int do_tport_candidates(struct private_object *tech_pvt, ldl_transport_ty
cand->port = tech_pvt->transports[ttype].adv_local_port;
cand->address = address;
if (!strncasecmp(advip, "stun:", 5)) {
if (advip && !strncasecmp(advip, "stun:", 5)) {
char *stun_ip = advip + 5;
if (tech_pvt->transports[ttype].stun_ip) {
@@ -1665,7 +1665,7 @@ static char *lame(char *in)
static void setup_codecs(struct private_object *tech_pvt)
{
ldl_payload_t payloads[LDL_MAX_PAYLOADS] = { {0} };
int idx = 0, i = 0;
unsigned int idx = 0, i = 0;
int dft_audio = -1, dft_video = -1;
memset(payloads, 0, sizeof(payloads));
@@ -2203,7 +2203,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
if (!switch_test_flag((&tech_pvt->transports[LDL_TPORT_RTP].read_frame), SFF_CNG)) {
if ((bytes = tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->encoded_bytes_per_packet)) {
frames = (tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen / bytes);
frames = (int)(tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen / bytes);
}
tech_pvt->transports[LDL_TPORT_RTP].read_frame.samples = (int) (frames * tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet);
}
@@ -2936,7 +2936,9 @@ static void set_profile_val(mdl_profile_t *profile, char *var, char *val)
globals.auto_nat = 0;
ip = zstr(val) ? globals.guess_ip : val;
}
profile->extip = switch_core_strdup(module_pool, ip);
if (ip) {
profile->extip = switch_core_strdup(module_pool, ip);
}
} else if (!strcasecmp(var, "server") && !zstr(val)) {
profile->server = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "rtp-timer-name") && !zstr(val)) {
@@ -1233,7 +1233,7 @@ static switch_status_t load_config(int reload_type)
uint32_t interface_id = 0;
int controldevice_speed = 115200; //FIXME TODO
int controldevice_audio_speed = 115200; //FIXME TODO
//int controldevice_audio_speed = 115200; //FIXME TODO
uint32_t controldevprotocol = PROTOCOL_AT; //FIXME TODO
uint32_t running = 1; //FIXME TODO
const char *gsmopen_serial_sync_period = "300"; //FIXME TODO
@@ -1472,7 +1472,7 @@ static switch_status_t load_config(int reload_type)
if (interface_id && interface_id < GSMOPEN_MAX_INTERFACES) {
private_t newconf;
int res = 0;
//int res = 0;
memset(&newconf, '\0', sizeof(newconf));
globals.GSMOPEN_INTERFACES[interface_id] = newconf;
+2 -2
View File
@@ -88,7 +88,7 @@ static int iblockingIOCallback(const void *inputBuffer, void *outputBuffer,
if (inputBuffer != NULL) {
/* retrieve the data for each channel and put it in the ring buffer */
for (c = 0; c < data->channelCount; c++) {
for (i = 0, j = c; i < framesPerBuffer; j += data->channelCount, i++) {
for (i = 0, j = c; i < (int)framesPerBuffer; j += data->channelCount, i++) {
chanSamples[i] = inputSamples[j];
}
if (PaUtil_WriteRingBuffer(&data->inFIFOs[c], chanSamples, numBytes) != numBytes) {
@@ -114,7 +114,7 @@ static int oblockingIOCallback(const void *inputBuffer, void *outputBuffer,
for (c = 0; c < data->channelCount; c++) {
int numRead = PaUtil_ReadRingBuffer(&data->outFIFOs[c], chanSamples, numBytes);
numRead = numRead / sizeof(int16_t);
for (i = 0, j = c; i < framesPerBuffer; j += data->channelCount, i++) {
for (i = 0, j = c; i < (int)framesPerBuffer; j += data->channelCount, i++) {
if (i < numRead) {
outputSamples[j] = chanSamples[i];
} else {
+1 -1
View File
@@ -1870,7 +1870,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste
tech_pvt->read_impl.microseconds_per_packet / 1000,
switch_rtp_ready(tech_pvt->rtp_session) ? "SUCCESS" : err);
#ifdef WIN32
addr.s_addr = inet_addr((uint16_t) tech_pvt->local_sdp_audio_ip);
addr.s_addr = inet_addr(tech_pvt->local_sdp_audio_ip);
#else
inet_aton(tech_pvt->local_sdp_audio_ip, &addr);
#endif
@@ -314,7 +314,7 @@ static switch_status_t interface_exists(char *the_interface)
/* CLOUDTREE (Thomas Hazel) static */ switch_status_t remove_interface(char *the_interface, /* CLOUDTREE (Thomas Hazel) */ switch_bool_t force)
{
int x = 10;
unsigned int howmany = 8;
switch_size_t howmany = 8;
int interface_id = -1;
private_t *tech_pvt = NULL;
switch_status_t status;
@@ -884,7 +884,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
switch_mutex_lock(tech_pvt->mutex_audio_srv);
if (tech_pvt->read_buffer && switch_buffer_inuse(tech_pvt->read_buffer)) {
bytes_read = switch_buffer_read(tech_pvt->read_buffer, tech_pvt->read_frame.data, BYTES_PER_FRAME);
tech_pvt->read_frame.datalen = bytes_read;
tech_pvt->read_frame.datalen = (uint32_t)bytes_read;
}
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
@@ -2069,7 +2069,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown)
int x;
private_t *tech_pvt = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
unsigned int howmany = 8;
switch_size_t howmany = 8;
int interface_id;
running = 0;
@@ -1310,7 +1310,7 @@ int skypopen_pipe_read(switch_file_t *pipe, short *buf, int howmany)
switch_file_read(pipe, buf, &quantity);
howmany = quantity;
howmany = (int)quantity;
return howmany;
}
@@ -1323,7 +1323,7 @@ int skypopen_pipe_write(switch_file_t *pipe, short *buf, int howmany)
switch_file_write(pipe, buf, &quantity);
howmany = quantity;
howmany = (int)quantity;
return howmany;
}
+6 -6
View File
@@ -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 {
+8 -8
View File
@@ -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;
+5 -5
View File
@@ -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;
}
}
+1 -1
View File
@@ -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);
}
+2 -1
View File
@@ -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))) {