diff --git a/libs/spandsp/src/image_translate.c b/libs/spandsp/src/image_translate.c index 1768b92138..217e560260 100644 --- a/libs/spandsp/src/image_translate.c +++ b/libs/spandsp/src/image_translate.c @@ -685,7 +685,6 @@ static int image_format_to_bytes_per_pixel(int image_format) case T4_IMAGE_TYPE_4COLOUR_12BIT: return 8; } - return 1; } /*- End of function --------------------------------------------------------*/ diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 54e0d369ad..1993bc7009 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -434,6 +434,11 @@ static inline int switch_true(const char *expr) (switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE); } +static inline switch_byte_t switch_true_byte(const char *expr) +{ + return (switch_byte_t)switch_true(expr); +} + #define switch_true_buf(expr)\ ((( !strcasecmp(expr, "yes") ||\ !strcasecmp(expr, "on") ||\ diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index ab386f8ecd..f90cd67d52 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -695,7 +695,7 @@ static cc_queue_t *load_queue(const char *queue_name) queue_set_config(queue); /* Add the params to the event structure */ - count = switch_event_import_xml(switch_xml_child(x_queue, "param"), "name", "value", &event); + count = (int)switch_event_import_xml(switch_xml_child(x_queue, "param"), "name", "value", &event); if (switch_xml_config_parse_event(event, count, SWITCH_FALSE, queue->config) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to process configuration\n"); @@ -1938,11 +1938,11 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames if (cbt->tier_rule_no_agent_no_wait == SWITCH_TRUE && cbt->tier_agent_available == 0) { cbt->tier = atoi(agent_tier_level); /* Multiple the tier level by the tier wait time */ - } else if (cbt->tier_rule_wait_multiply_level == SWITCH_TRUE && (long) local_epoch_time_now(NULL) - atol(cbt->member_joined_epoch) >= atoi(agent_tier_level) * cbt->tier_rule_wait_second) { + } else if (cbt->tier_rule_wait_multiply_level == SWITCH_TRUE && (long) local_epoch_time_now(NULL) - atol(cbt->member_joined_epoch) >= atoi(agent_tier_level) * (int)cbt->tier_rule_wait_second) { cbt->tier = atoi(agent_tier_level); cbt->tier_agent_available = 0; /* Just check if joined is bigger than next tier wait time */ - } else if (cbt->tier_rule_wait_multiply_level == SWITCH_FALSE && (long) local_epoch_time_now(NULL) - atol(cbt->member_joined_epoch) >= cbt->tier_rule_wait_second) { + } else if (cbt->tier_rule_wait_multiply_level == SWITCH_FALSE && (long) local_epoch_time_now(NULL) - atol(cbt->member_joined_epoch) >= (int)cbt->tier_rule_wait_second) { cbt->tier = atoi(agent_tier_level); cbt->tier_agent_available = 0; } else { @@ -2069,8 +2069,6 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames return 1; } } - - return 0; } static int members_callback(void *pArg, int argc, char **argv, char **columnNames) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index eb9c0a8fee..57b4e758e7 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1407,7 +1407,7 @@ SWITCH_STANDARD_API(expand_function) } } - if ((arg = strchr(mycmd, ' '))) { + if (mycmd && (arg = strchr(mycmd, ' '))) { *arg++ = '\0'; } @@ -6305,7 +6305,7 @@ SWITCH_STANDARD_JSON_API(json_status_function) oo = cJSON_CreateObject(); cJSON_AddItemToObject(o, "count", oo); - cJSON_AddItemToObject(oo, "total", cJSON_CreateNumber(switch_core_session_id() - 1)); + cJSON_AddItemToObject(oo, "total", cJSON_CreateNumber((double)(switch_core_session_id() - 1))); cJSON_AddItemToObject(oo, "active", cJSON_CreateNumber(switch_core_session_count())); cJSON_AddItemToObject(oo, "peak", cJSON_CreateNumber(sessions_peak)); cJSON_AddItemToObject(oo, "peak5Min", cJSON_CreateNumber(sessions_peak_fivemin)); @@ -6332,8 +6332,8 @@ SWITCH_STANDARD_JSON_API(json_status_function) o = cJSON_CreateObject(); cJSON_AddItemToObject(reply, "stackSizeKB", o); - cJSON_AddItemToObject(o, "current", cJSON_CreateNumber(cur / 1024)); - cJSON_AddItemToObject(o, "max", cJSON_CreateNumber(max / 1024)); + cJSON_AddItemToObject(o, "current", cJSON_CreateNumber((double)(cur / 1024))); + cJSON_AddItemToObject(o, "max", cJSON_CreateNumber((double)(max / 1024))); } diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 22c7079dc4..23423d737b 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2365,7 +2365,7 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr { conference_obj_t *conference = (conference_obj_t *) obj; conference_member_t *imember; - switch_frame_t *vid_frame; + switch_frame_t *vid_frame = NULL; switch_status_t status; int want_refresh = 0; int yield = 0; @@ -2706,7 +2706,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v } else if (conference->fnode->type == NODE_TYPE_FILE) { switch_core_file_read(&conference->fnode->fh, file_frame, &file_sample_len); if (conference->fnode->fh.vol) { - switch_change_sln_volume_granular((void *)file_frame, file_sample_len, conference->fnode->fh.vol); + switch_change_sln_volume_granular((void *)file_frame, (uint32_t)file_sample_len, conference->fnode->fh.vol); } } @@ -3583,10 +3583,10 @@ static int noise_gate_check(conference_member_t *member) if (target_score < 0) target_score = 0; - r = member->score > target_score; + r = (int)member->score > target_score; } else { - r = member->score > member->energy_level; + r = (int32_t)member->score > member->energy_level; } return r; @@ -3607,11 +3607,11 @@ static void check_agc_levels(conference_member_t *member) if (!member->avg_score) return; - if (member->avg_score < member->conference->agc_level - 100) { + if ((int)member->avg_score < member->conference->agc_level - 100) { member->agc_volume_in_level++; switch_normalize_volume_granular(member->agc_volume_in_level); x = 1; - } else if (member->avg_score > member->conference->agc_level + 100) { + } else if ((int)member->avg_score > member->conference->agc_level + 100) { member->agc_volume_in_level--; switch_normalize_volume_granular(member->agc_volume_in_level); x = -1; @@ -3743,7 +3743,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v goto do_continue; } - if (member->nt_tally > (member->read_impl.actual_samples_per_second / member->read_impl.samples_per_packet) * 3) { + if (member->nt_tally > (int32_t)(member->read_impl.actual_samples_per_second / member->read_impl.samples_per_packet) * 3) { member->agc_volume_in_level = 0; clear_avg(member); } @@ -4016,14 +4016,14 @@ static void member_add_file_data(conference_member_t *member, int16_t *data, swi /* Check for output volume adjustments */ if (member->volume_out_level) { - switch_change_sln_volume(file_frame, file_sample_len, member->volume_out_level); + switch_change_sln_volume(file_frame, (uint32_t)file_sample_len, member->volume_out_level); } for (i = 0; i < file_sample_len; i++) { if (member->fnode->mux) { sample = data[i] + file_frame[i]; switch_normalize_to_16bit(sample); - data[i] = sample; + data[i] = (int16_t)sample; } else { data[i] = file_frame[i]; } @@ -8398,7 +8398,7 @@ SWITCH_STANDARD_APP(conference_function) while (!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) { size_t dpin_length = dpin ? strlen(dpin) : 0; size_t mdpin_length = mdpin ? strlen(mdpin) : 0; - int maxpin = dpin_length > mdpin_length ? dpin_length : mdpin_length; + int maxpin = dpin_length > mdpin_length ? (int)dpin_length : (int)mdpin_length; switch_status_t pstatus = SWITCH_STATUS_FALSE; /* be friendly */ diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index 50c4701364..7390708d41 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -177,7 +177,7 @@ char *string_to_keypad_digit(const char *in) while (*s) { char c; - if ((c = digit_matching_keypad(*s++)) > 0) { + if ((c = (char)digit_matching_keypad(*s++)) > 0) { *d++ = c + 48; } } @@ -843,7 +843,7 @@ switch_status_t navigate_entrys(switch_core_session_t *session, dir_profile_t *p params->try_again = 1; status = SWITCH_STATUS_BREAK; goto end; - } else if (profile->max_result != 0 && result_count > profile->max_result) { + } else if (profile->max_result != 0 && (uint32_t)result_count > profile->max_result) { switch_ivr_phrase_macro(session, DIR_RESULT_COUNT_TOO_LARGE, NULL, NULL, NULL); params->try_again = 1; status = SWITCH_STATUS_BREAK; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index b5b7718231..4167800a22 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -4749,7 +4749,7 @@ SWITCH_STANDARD_APP(blind_transfer_ack_function) switch_bool_t val = 0; if (data) { - val = switch_true((char *) val); + val = (switch_bool_t)switch_true((char *) data); } switch_ivr_blind_transfer_ack(session, val); @@ -5233,7 +5233,7 @@ void *SWITCH_THREAD_FUNC call_monitor_thread(switch_thread_t *thread, void *obj) switch_mutex_t *mutex; uint32_t counter = 0; switch_memory_pool_t *pool = cm->pool; - int size; + unsigned int size; char *argv[512] = { 0 }; int busy = 0; switch_event_t *var_event = NULL; diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index f09236539a..7225d9713c 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -1720,15 +1720,15 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) expanded_originate_string = switch_event_expand_headers(ovars, h->originate_string); - if (switch_stristr("origination_caller", expanded_originate_string)) { + if (node && switch_stristr("origination_caller", expanded_originate_string)) { originate_string = switch_mprintf("{execute_on_answer='unset fifo_hangup_check',fifo_name='%q',fifo_hangup_check='%q'}%s", node->name, node->name, expanded_originate_string); } else { - if (!zstr(node->outbound_name)) { + if (node && !zstr(node->outbound_name)) { originate_string = switch_mprintf("{execute_on_answer='unset fifo_hangup_check',fifo_name='%q',fifo_hangup_check='%q'," "origination_caller_id_name=Queue,origination_caller_id_number='Queue: %q'}%s", node->name, node->name, node->outbound_name, expanded_originate_string); - } else { + } else if (node) { originate_string = switch_mprintf("{execute_on_answer='unset fifo_hangup_check',fifo_name='%q',fifo_hangup_check='%q'," "origination_caller_id_name=Queue,origination_caller_id_number='Queue: %q'}%s", node->name, node->name, node->name, expanded_originate_string); @@ -1737,7 +1737,7 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) } if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", node->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", node ? node->name : ""); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "pre-dial"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Outbound-UUID", h->uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "outbound-strategy", "enterprise"); @@ -1759,7 +1759,7 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", node->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", node ? node->name : ""); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "post-dial"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Outbound-UUID", h->uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "outbound-strategy", "enterprise"); @@ -1776,7 +1776,7 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(channel, event); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", node->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", node ? node->name : ""); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "post-dial"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Outbound-UUID", h->uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "outbound-strategy", "enterprise"); diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 67acca7a7a..0410b72ed4 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -690,7 +690,7 @@ end: static switch_status_t fsv_file_write(switch_file_handle_t *handle, void *data, size_t *len) { - uint32_t datalen = *len * 2; + size_t datalen = *len * 2; size_t size; switch_status_t status; @@ -720,7 +720,7 @@ static switch_status_t fsv_file_write(switch_file_handle_t *handle, void *data, static switch_status_t fsv_file_write_video(switch_file_handle_t *handle, void *data, size_t *len) { - uint32_t datalen = *len; + uint32_t datalen = (uint32_t)*len; uint32_t bytes = datalen | VID_BIT; size_t size; switch_status_t status = SWITCH_STATUS_SUCCESS; diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index 87c2f0521b..96a59b1f7e 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -58,7 +58,7 @@ typedef struct { uint32_t rate_usage; /* < Current rate usage */ time_t last_check; /* < Last rate check */ uint32_t interval; /* < Interval used on last rate check */ - uint32_t last_update; /* < Last updated timestamp (rate or total) */ + switch_time_t last_update; /* < Last updated timestamp (rate or total) */ } limit_hash_item_t; struct callback { @@ -837,7 +837,7 @@ static void *SWITCH_THREAD_FUNC limit_remote_thread(switch_thread_t *thread, voi limit_remote_t *remote = (limit_remote_t*)obj; while (remote->state > REMOTE_OFF) { if (remote->state != REMOTE_UP) { - if (esl_connect_timeout(&remote->handle, remote->host, remote->port, remote->username, remote->password, 5000) == ESL_SUCCESS) { + if (esl_connect_timeout(&remote->handle, remote->host, (esl_port_t)remote->port, remote->username, remote->password, 5000) == ESL_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected to remote FreeSWITCH (%s) at %s:%d\n", remote->name, remote->host, remote->port); diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 7c61f52719..7f195cc7c8 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -1892,15 +1892,15 @@ static switch_status_t do_config(void) char *val = (char *) switch_xml_attr_soft(param, "value"); if (!strcasecmp(var, "all")) { - switch_byte_t all = switch_true(val); + switch_byte_t all = switch_true_byte(val); memset(&profile->perms, all, sizeof(profile->perms)); } else if (!strcasecmp(var, "none")) { - switch_byte_t none = switch_true(val); + switch_byte_t none = switch_true_byte(val); memset(&profile->perms, none, sizeof(profile->perms)); } else if (!strcasecmp(var, "set-params")) { - profile->perms.set_params = switch_true(val); + profile->perms.set_params = switch_true_byte(val); } else if (!strcasecmp(var, "set-vars")) { - profile->perms.set_vars = switch_true(val); + profile->perms.set_vars = switch_true_byte(val); if (profile->perms.set_vars) { switch_xml_t x_list, x_var; @@ -1928,7 +1928,7 @@ static switch_status_t do_config(void) } } } else if (!strcasecmp(var, "get-vars")) { - profile->perms.get_vars = switch_true(val); + profile->perms.get_vars = switch_true_byte(val); if (profile->perms.get_vars) { switch_xml_t x_list, x_var; @@ -1956,9 +1956,9 @@ static switch_status_t do_config(void) } } } else if (!strcasecmp(var, "extended-data")) { - profile->perms.extended_data = switch_true(val); + profile->perms.extended_data = switch_true_byte(val); } else if (!strcasecmp(var, "execute-apps")) { - profile->perms.execute_apps = switch_true(val); + profile->perms.execute_apps = switch_true_byte(val); if (profile->perms.execute_apps) { switch_xml_t x_list, x_app; @@ -1987,7 +1987,7 @@ static switch_status_t do_config(void) } } else if (!strcasecmp(var, "expand-vars")) { - profile->perms.expand_vars = switch_true(val); + profile->perms.expand_vars = switch_true_byte(val); if (profile->perms.expand_vars) { switch_xml_t x_list, x_var, x_api; @@ -2039,27 +2039,27 @@ static switch_status_t do_config(void) } } else if (!strcasecmp(var, "dial")) { - profile->perms.dial.enabled = switch_true(val); + profile->perms.dial.enabled = switch_true_byte(val); } else if (!strcasecmp(var, "dial-set-context")) { if (switch_true(val)) profile->perms.dial.enabled = SWITCH_TRUE; - profile->perms.dial.set_context = switch_true(val); + profile->perms.dial.set_context = switch_true_byte(val); } else if (!strcasecmp(var, "dial-set-dialplan")) { if (switch_true(val)) profile->perms.dial.enabled = SWITCH_TRUE; - profile->perms.dial.set_dp = switch_true(val); + profile->perms.dial.set_dp = switch_true_byte(val); } else if (!strcasecmp(var, "dial-set-cid-name")) { if (switch_true(val)) profile->perms.dial.enabled = SWITCH_TRUE; - profile->perms.dial.set_cid_name = switch_true(val); + profile->perms.dial.set_cid_name = switch_true_byte(val); } else if (!strcasecmp(var, "dial-set-cid-number")) { if (switch_true(val)) profile->perms.dial.enabled = SWITCH_TRUE; - profile->perms.dial.set_cid_number = switch_true(val); + profile->perms.dial.set_cid_number = switch_true_byte(val); } else if (!strcasecmp(var, "dial-full-originate")) { if (switch_true(val)) profile->perms.dial.enabled = SWITCH_TRUE; - profile->perms.dial.full_originate = switch_true(val); + profile->perms.dial.full_originate = switch_true_byte(val); } else if (!strcasecmp(var, "conference")) { - profile->perms.conference.enabled = switch_true(val); + profile->perms.conference.enabled = switch_true_byte(val); } else if (!strcasecmp(var, "conference-set-profile")) { if (switch_true(val)) profile->perms.conference.enabled = SWITCH_TRUE; - profile->perms.conference.set_profile = switch_true(val); + profile->perms.conference.set_profile = switch_true_byte(val); } } @@ -2577,7 +2577,7 @@ static switch_status_t write_meta_file(http_file_context_t *context, const char data); - status = write(fd, write_data, strlen(write_data) + 1) > 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; + status = write(fd, write_data, (int)strlen(write_data) + 1) > 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; } close(fd); @@ -2947,7 +2947,7 @@ static switch_status_t http_file_file_read(switch_file_handle_t *handle, void *d *len = context->samples; } - context->samples -= *len; + context->samples -= (int)*len; memset(data, 255, *len *2); status = SWITCH_STATUS_SUCCESS; } else { diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index c5e6e26841..2b879fd6d6 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -666,7 +666,7 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa } else if (CF("lcr_limit_id")) { additional->limit_id = switch_core_strdup(pool, switch_str_nil(argv[i])); } else if (CF("lcr_limit_max")) { - additional->limit_max = (float)atof(switch_str_nil(argv[i])); + additional->limit_max = (int)(float)atof(switch_str_nil(argv[i])); } /* add all fields to the fields event */ @@ -944,7 +944,7 @@ static switch_status_t lcr_do_lookup(callback_t *cb_struct) if ((channel = switch_core_session_get_channel(cb_struct->session))) { const char *max_rate = switch_channel_get_variable(channel, "max_rate"); if (!zstr(max_rate)) { - cb_struct->max_rate = atof(max_rate); + cb_struct->max_rate = (float)atof(max_rate); } switch_channel_set_variable_var_check(channel, "lcr_rate_field", rate_field, SWITCH_FALSE); switch_channel_set_variable_var_check(channel, "lcr_user_rate_field", user_rate_field, SWITCH_FALSE); @@ -1611,7 +1611,7 @@ SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt) } } - if (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) { + if (caller_profile && lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) { if ((extension = switch_caller_extension_new(session, caller_profile->destination_number, caller_profile->destination_number)) == 0) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "memory error!\n"); goto end; @@ -1646,7 +1646,7 @@ SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt) switch_caller_extension_add_application(session, extension, app, argc); } } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "LCR lookup failed for %s using profile %s\n", caller_profile->destination_number, caller_profile->context); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "LCR lookup failed for %s using profile %s\n", caller_profile ? caller_profile->destination_number : "unknown", caller_profile ? caller_profile->context : "unknown"); } end: @@ -1953,31 +1953,31 @@ SWITCH_STANDARD_API(dialplan_lcr_function) stream->write_function(stream, " \n", rowcount); } - write_data(stream, as_xml, "prefix", current->digit_str, 2, maximum_lengths.digit_str); - write_data(stream, as_xml, "carrier_name", current->carrier_name, 2, maximum_lengths.carrier_name); - write_data(stream, as_xml, "rate", current->rate_str, 2, maximum_lengths.rate); + write_data(stream, as_xml, "prefix", current->digit_str, 2, (int)maximum_lengths.digit_str); + write_data(stream, as_xml, "carrier_name", current->carrier_name, 2, (int)maximum_lengths.carrier_name); + write_data(stream, as_xml, "rate", current->rate_str, 2, (int)maximum_lengths.rate); if (current->codec) { - write_data(stream, as_xml, "codec", current->codec, 2, maximum_lengths.codec); + write_data(stream, as_xml, "codec", current->codec, 2, (int)maximum_lengths.codec); } else { - write_data(stream, as_xml, "codec", "", 2, maximum_lengths.codec); + write_data(stream, as_xml, "codec", "", 2, (int)maximum_lengths.codec); } if (current->cid) { - write_data(stream, as_xml, "cid", current->cid, 2, maximum_lengths.cid); + write_data(stream, as_xml, "cid", current->cid, 2, (int)maximum_lengths.cid); } else { - write_data(stream, as_xml, "cid", "", 2, maximum_lengths.cid); + write_data(stream, as_xml, "cid", "", 2, (int)maximum_lengths.cid); } if (current->limit_realm && current->limit_id) { char *str = NULL; str = switch_core_sprintf(pool, "%s %s %d", current->limit_realm, current->limit_id, current->limit_max); - write_data(stream, as_xml, "limit", str, 2, maximum_lengths.limit); + write_data(stream, as_xml, "limit", str, 2, (int)maximum_lengths.limit); } else { - write_data(stream, as_xml, "limit", "", 2, maximum_lengths.limit); + write_data(stream, as_xml, "limit", "", 2, (int)maximum_lengths.limit); } - write_data(stream, as_xml, "dialstring", current->dialstring, 2, maximum_lengths.dialstring); + write_data(stream, as_xml, "dialstring", current->dialstring, 2, (int)maximum_lengths.dialstring); if (as_xml) { event_xml = switch_event_xmlize(current->fields, SWITCH_VA_NONE); event_str = switch_xml_toxml(event_xml, SWITCH_FALSE); diff --git a/src/mod/applications/mod_redis/credis.c b/src/mod/applications/mod_redis/credis.c index d25756fc3a..a76cbedf49 100644 --- a/src/mod/applications/mod_redis/credis.c +++ b/src/mod/applications/mod_redis/credis.c @@ -341,8 +341,8 @@ static int cr_readln(REDIS rhnd, int start, char **line, int *idx) *line = buf->data + buf->idx; if (idx) *idx = buf->idx; - len = nl - *line; - buf->idx = (nl - buf->data) + 2; /* skip "\r\n" */ + len = (int)(nl - *line); + buf->idx = (int)((nl - buf->data) + 2); /* skip "\r\n" */ DEBUG("size=%d, len=%d, idx=%d, start=%d, line=%s", buf->size, buf->len, buf->idx, start, *line); diff --git a/src/mod/applications/mod_redis/mod_redis.c b/src/mod/applications/mod_redis/mod_redis.c index 48b27d503b..e579013ee5 100755 --- a/src/mod/applications/mod_redis/mod_redis.c +++ b/src/mod/applications/mod_redis/mod_redis.c @@ -260,7 +260,7 @@ SWITCH_LIMIT_RESET(limit_reset_redis) if ((keyc = credis_keys(redis, rediskey, uuids, switch_arraylen(uuids))) > 0) { int i = 0; - int hostnamelen = strlen(switch_core_get_switchname())+1; + int hostnamelen = (int)strlen(switch_core_get_switchname())+1; for (i = 0; i < keyc && uuids[i]; i++){ const char *key = uuids[i] + hostnamelen; diff --git a/src/mod/applications/mod_sms/mod_sms.c b/src/mod/applications/mod_sms/mod_sms.c index 49037f24d9..b2ed664e1f 100644 --- a/src/mod/applications/mod_sms/mod_sms.c +++ b/src/mod/applications/mod_sms/mod_sms.c @@ -76,7 +76,7 @@ typedef enum { #define check_tz() \ do { \ tzoff = switch_event_get_header(event, "tod_tz_offset"); \ - tzname = switch_event_get_header(event, "timezone"); \ + tzname_ = switch_event_get_header(event, "timezone"); \ if (!zstr(tzoff) && switch_is_number(tzoff)) { \ offset = atoi(tzoff); \ break; \ @@ -93,7 +93,7 @@ static int parse_exten(switch_event_t *event, switch_xml_t xexten, switch_event_ char *expression_expanded = NULL, *field_expanded = NULL; switch_regex_t *re = NULL; const char *to = switch_event_get_header(event, "to"); - const char *tzoff = NULL, *tzname = NULL; + const char *tzoff = NULL, *tzname_ = NULL; int offset = 0; check_tz(); @@ -117,7 +117,7 @@ static int parse_exten(switch_event_t *event, switch_xml_t xexten, switch_event_ int time_match; check_tz(); - time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL, tzname); + time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL, tzname_); switch_safe_free(field_expanded); switch_safe_free(expression_expanded); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 42e31d1ef5..5dfe7bbf50 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -399,7 +399,7 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da if (pvt->verbose) { span_log_set_level(dtmf_rx_get_logging_state(pvt->dtmf_detect), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); } - dtmf_rx_parms(pvt->dtmf_detect, pvt->filter_dialtone, pvt->twist, pvt->reverse_twist, pvt->threshold); + dtmf_rx_parms(pvt->dtmf_detect, pvt->filter_dialtone, (float)pvt->twist, (float)pvt->reverse_twist, (float)pvt->threshold); dtmf_rx_set_realtime_callback(pvt->dtmf_detect, spandsp_dtmf_rx_realtime_callback, pvt); break; } diff --git a/src/mod/applications/mod_spandsp/udptl.c b/src/mod/applications/mod_spandsp/udptl.c index 553e4135e3..d1e21d648d 100644 --- a/src/mod/applications/mod_spandsp/udptl.c +++ b/src/mod/applications/mod_spandsp/udptl.c @@ -28,7 +28,9 @@ #include "udptl.h" #define FALSE 0 +#ifndef TRUE #define TRUE (!FALSE) +#endif static int decode_length(const uint8_t *buf, int limit, int *len, int *pvalue) { diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index 9ed68f16dc..cc4639cd0d 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -162,7 +162,8 @@ static int find_longest(valet_lot_t *lot, int min, int max) const void *i_var; void *i_val; valet_token_t *token; - int longest = 0, cur = 0, longest_ext = 0; + int longest_ext = 0; + time_t longest = 0, cur = 0; time_t now = switch_epoch_time_now(NULL); switch_mutex_lock(lot->mutex); diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index e2f9b7eb79..a800efa855 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -710,7 +710,8 @@ static vm_profile_t *load_profile(const char *profile_name) if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile_name))) { switch_memory_pool_t *pool; - int x, count; + int x; + switch_size_t count; char *errmsg; if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) { @@ -751,7 +752,7 @@ static vm_profile_t *load_profile(const char *profile_name) } - if (switch_xml_config_parse_event(event, count, SWITCH_FALSE, profile->config) != SWITCH_STATUS_SUCCESS) { + if (switch_xml_config_parse_event(event, (int)count, SWITCH_FALSE, profile->config) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to process configuration\n"); switch_core_destroy_memory_pool(&pool); goto end; @@ -2845,7 +2846,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile, if (!message_len) { size_t len = 0; if (measure_file_len(file_path, &len) == SWITCH_STATUS_SUCCESS) { - message_len = len; + message_len = (uint32_t)len; } } @@ -3658,7 +3659,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p if (x_user) { switch_channel_get_variables(channel, &vars); - status = deliver_vm(profile, x_user, domain_name, file_path, message_len, read_flags, vars, + status = deliver_vm(profile, x_user, domain_name, file_path, (uint32_t)message_len, read_flags, vars, switch_core_session_get_pool(session), caller_id_name, caller_id_number, NULL, SWITCH_FALSE, session ? switch_core_session_get_uuid(session) : NULL, session); switch_event_destroy(&vars); diff --git a/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c b/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c index df99eed95e..f7cef99573 100644 --- a/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c +++ b/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c @@ -294,7 +294,7 @@ static switch_bool_t stop_detect(pocketsphinx_t *ps, int16_t *data, unsigned int /* Check silence timeouts */ if (ps->silence_time && switch_test_flag(ps, PSFLAG_INPUT_TIMERS)) { - int elapsed_ms = (switch_micro_time_now() - ps->silence_time) / 1000; + switch_time_t elapsed_ms = (switch_micro_time_now() - ps->silence_time) / 1000; if (switch_test_flag(ps, PSFLAG_START_OF_SPEECH)) { if (ps->speech_timeout > 0 && !switch_test_flag(ps, PSFLAG_SPEECH_TIMEOUT) && elapsed_ms >= ps->speech_timeout) { switch_set_flag_locked(ps, PSFLAG_SPEECH_TIMEOUT); diff --git a/src/mod/codecs/mod_silk/mod_silk.c b/src/mod/codecs/mod_silk/mod_silk.c index c585548ea6..f8d789ca47 100644 --- a/src/mod/codecs/mod_silk/mod_silk.c +++ b/src/mod/codecs/mod_silk/mod_silk.c @@ -287,13 +287,13 @@ static switch_status_t switch_silk_encode(switch_codec_t *codec, { struct silk_context *context = codec->private_info; SKP_int16 ret; - SKP_int16 pktsz = context->encoder_object.packetSize; + SKP_int16 pktsz = (SKP_int16)context->encoder_object.packetSize; SKP_int16 nBytes = MAX_BYTES_PER_FRAME * MAX_INPUT_FRAMES; SKP_int16 *lindata = (SKP_int16 *)decoded_data; - SKP_int16 samples = decoded_data_len /sizeof(SKP_int16); + SKP_int16 samples = (SKP_int16)(decoded_data_len /sizeof(SKP_int16)); *encoded_data_len = 0; while (samples >= pktsz){ - ret = SKP_Silk_SDK_Encode(context->enc_state, + ret = (SKP_int16)SKP_Silk_SDK_Encode(context->enc_state, &context->encoder_object, lindata, pktsz, @@ -345,9 +345,9 @@ static switch_status_t switch_silk_decode(switch_codec_t *codec, } if (jb && codec && codec->cur_frame) { for (i = 1; i <= MAX_LBRR_DELAY; i++) { - found_frame = stfu_n_copy_next_frame(jb, codec->cur_frame->timestamp, codec->cur_frame->seq, i, &next_frame); + found_frame = stfu_n_copy_next_frame(jb, (uint32_t)codec->cur_frame->timestamp, codec->cur_frame->seq, (uint16_t)i, &next_frame); if (found_frame) { - SKP_Silk_SDK_search_for_LBRR(next_frame.data, next_frame.dlen, i, (SKP_uint8*) &recbuff, &reclen); + SKP_Silk_SDK_search_for_LBRR(next_frame.data, (const int)next_frame.dlen, i, (SKP_uint8*) &recbuff, &reclen); if (reclen) { encoded_data = &recbuff; encoded_data_len = reclen; @@ -361,7 +361,7 @@ static switch_status_t switch_silk_decode(switch_codec_t *codec, } do { - ret = SKP_Silk_SDK_Decode(context->dec_state, + ret = (SKP_int16)SKP_Silk_SDK_Decode(context->dec_state, &context->decoder_object, lost_flag, encoded_data, diff --git a/src/mod/codecs/mod_speex/mod_speex.c b/src/mod/codecs/mod_speex/mod_speex.c index 4919816624..4f59f36452 100644 --- a/src/mod/codecs/mod_speex/mod_speex.c +++ b/src/mod/codecs/mod_speex/mod_speex.c @@ -236,12 +236,12 @@ static switch_status_t switch_speex_fmtp_parse(const char *fmtp, switch_codec_fm } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "choosing speex/8000 mode %s\n", mode_str); codec_settings->quality = codec_settings->quality; - codec_settings->vbr_quality = codec_settings->quality; + codec_settings->vbr_quality = (float)codec_settings->quality; } else { if (mode_num >= 0 && mode_num <= 10) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "choosing speex/%d mode %s\n", codec_fmtp->actual_samples_per_second, mode_str); codec_settings->quality = mode_num; - codec_settings->vbr_quality = mode_num; + codec_settings->vbr_quality = (float)mode_num; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "ignoring invalid speex/%d mode %s\n", codec_fmtp->actual_samples_per_second, mode_str); continue; @@ -519,7 +519,7 @@ static void load_configuration() default_codec_settings.vbr = switch_true(value); } else if (!strcasecmp("vbr-quality", name)) { /* variable bit rate quality, float 0-10 */ - float tmp = atof(value); + float tmp = (float)atof(value); if (switch_is_number(value) && tmp >= 0 && tmp <= 10) { default_codec_settings.vbr_quality = tmp; } else { @@ -547,7 +547,7 @@ static void load_configuration() default_codec_settings.pp_agc = switch_true(value); } else if (!strcasecmp("pp-agc-level", name)) { /* agc level, float */ - float tmp = atof(value); + float tmp = (float)atof(value); if (switch_is_number(value) && tmp >= 0.0f) { default_codec_settings.pp_agc_level = tmp; } else { @@ -561,7 +561,7 @@ static void load_configuration() default_codec_settings.pp_dereverb = switch_true(value); } else if (!strcasecmp("pp-dereverb-decay", name)) { /* reverberation removal decay, float */ - float tmp = atof(value); + float tmp = (float)atof(value); if (switch_is_number(value) && tmp >= 0.0f) { default_codec_settings.pp_dereverb_decay = tmp; } else { @@ -569,7 +569,7 @@ static void load_configuration() } } else if (!strcasecmp("pp-dereverb-level", name)) { /* reverberation removal level, float */ - float tmp = atof(value); + float tmp = (float)atof(value); if (switch_is_number(value) && tmp >= 0.0f) { default_codec_settings.pp_dereverb_level = tmp; } else { diff --git a/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c b/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c index 65b7a47e8d..6408caf810 100644 --- a/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c +++ b/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c @@ -131,7 +131,7 @@ SWITCH_STANDARD_DIALPLAN(directory_dialplan_hunt) if ((data = strchr(app, ' ')) != 0) { *data++ = '\0'; } - switch_caller_extension_add_application(session, extension, app, data); + switch_caller_extension_add_application(session, extension, app, data ? data : ""); } } } diff --git a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c index 30bcdee997..30fb123648 100644 --- a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c +++ b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c @@ -86,7 +86,7 @@ static switch_status_t exec_app(switch_core_session_t *session, const char *app, #define check_tz() \ do { \ tzoff = switch_channel_get_variable(channel, "tod_tz_offset"); \ - tzname = switch_channel_get_variable(channel, "timezone"); \ + tzname_ = switch_channel_get_variable(channel, "timezone"); \ if (!zstr(tzoff) && switch_is_number(tzoff)) { \ offset = atoi(tzoff); \ break; \ @@ -104,7 +104,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * char *expression_expanded = NULL, *field_expanded = NULL; switch_regex_t *re = NULL, *save_re = NULL; int offset = 0; - const char *tmp, *tzoff = NULL, *tzname = NULL, *req_nesta = NULL; + const char *tmp, *tzoff = NULL, *tzname_ = NULL, *req_nesta = NULL; char nbuf[128] = ""; int req_nest = 1; char space[MAX_RECUR_SPACE] = ""; @@ -171,7 +171,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * int time_match; check_tz(); - time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL, tzname); + time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL, tzname_); switch_safe_free(field_expanded); switch_safe_free(expression_expanded); @@ -227,7 +227,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * for (xregex = switch_xml_child(xcond, "regex"); xregex; xregex = xregex->next) { check_tz(); - time_match = switch_xml_std_datetime_check(xregex, tzoff ? &offset : NULL, tzname); + time_match = switch_xml_std_datetime_check(xregex, tzoff ? &offset : NULL, tzname_); if (time_match == 1) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index e7ecaaf949..5c0d36b596 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -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)) { diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index b3b3c1546c..8c011fec1c 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -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; diff --git a/src/mod/endpoints/mod_portaudio/pablio.c b/src/mod/endpoints/mod_portaudio/pablio.c index 34a52df335..0aebc7c7ab 100644 --- a/src/mod/endpoints/mod_portaudio/pablio.c +++ b/src/mod/endpoints/mod_portaudio/pablio.c @@ -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 { diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index b9ec3de21b..6d53e9ee9c 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -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 diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index b586bd0489..8f843a0000 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -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; diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index b1542a39cc..cc6a50adfc 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -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; } diff --git a/src/mod/endpoints/mod_sofia/rtp.c b/src/mod/endpoints/mod_sofia/rtp.c index a1467f9647..bbb78c88a2 100644 --- a/src/mod/endpoints/mod_sofia/rtp.c +++ b/src/mod/endpoints/mod_sofia/rtp.c @@ -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 { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 6e72cc6fef..21b2599592 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -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; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 0ad5696780..4ab7d3f989 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -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; } } diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index bab266abdf..138f4ff271 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -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); } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index fe4f0c57b9..b0cab240e5 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -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))) { diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 75c9f8b791..88cfeb7e9e 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -412,7 +412,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load) switch_goto_status(SWITCH_STATUS_TERM, fail); } - if (switch_mcast_loopback(globals.udp_socket, globals.loopback) != SWITCH_STATUS_SUCCESS) { + if (switch_mcast_loopback(globals.udp_socket, (uint8_t)globals.loopback) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set loopback to '%d'\n", globals.loopback); switch_goto_status(SWITCH_STATUS_TERM, fail); } @@ -573,7 +573,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime) char *var, *val, *term = NULL, tmpname[128]; switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Multicast", "yes"); var = packet; - while (*var) { + while (var && *var) { if ((val = strchr(var, ':')) != 0) { *val++ = '\0'; while (*val == ' ') { diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 8c0c85911a..03437e4bef 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -593,9 +593,9 @@ static void send_disconnect(listener_t *listener, const char *message) if (listener->session) { switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n" "Controlled-Session-UUID: %s\n" - "Content-Disposition: disconnect\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), mlen); + "Content-Disposition: disconnect\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), (int)mlen); } else { - switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\nContent-Length: %d\n\n", mlen); + switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\nContent-Length: %d\n\n", (int)mlen); } if (!listener->sock) return; @@ -965,7 +965,7 @@ SWITCH_STANDARD_API(event_sink_function) while (switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS) { switch_log_node_t *dnode = (switch_log_node_t *) pop; - int encode_len = (strlen(dnode->data) * 3) + 1; + size_t encode_len = (strlen(dnode->data) * 3) + 1; char *encode_buf = malloc(encode_len); switch_assert(encode_buf); @@ -1131,7 +1131,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, char *tmp; int pos; - pos = (ptr - mbuf); + pos = (int)(ptr - mbuf); buf_len += block_len; tmp = realloc(mbuf, buf_len); switch_assert(tmp); @@ -2294,7 +2294,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even listener->linger_timeout = linger_time; switch_set_flag_locked(listener, LFLAG_LINGER); if (listener->linger_timeout != (time_t) -1) { - switch_snprintf(reply, reply_len, "+OK will linger %d seconds", linger_time); + switch_snprintf(reply, reply_len, "+OK will linger %d seconds", (int)linger_time); } else { switch_snprintf(reply, reply_len, "+OK will linger"); } @@ -2514,7 +2514,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) for (x = 0; x < prefs.acl_count; x++) { if (!switch_check_network_list_ip(listener->remote_ip, prefs.acl[x])) { const char message[] = "Access Denied, go away.\n"; - int mlen = strlen(message); + int mlen = (int)strlen(message); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", listener->remote_ip, prefs.acl[x]); diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index c94958ea87..42b4b87ce8 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -216,7 +216,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void continue; } - if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, temp_pool) != SWITCH_STATUS_SUCCESS) { + if (switch_core_timer_init(&timer, source->timer_name, source->interval, (int)source->samples, temp_pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n"); switch_dir_close(source->dir_handle); source->dir_handle = NULL; @@ -233,7 +233,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void if (source->chime_total) { if (source->chime_counter > 0) { - source->chime_counter -= source->samples; + source->chime_counter -= (int32_t)source->samples; } if (!switch_test_flag((&source->chime_fh), SWITCH_FILE_OPEN) && source->chime_counter <= 0) { @@ -272,7 +272,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void source->chime_counter = source->rate * source->chime_freq; use_fh = &fh; goto retry; - switch_core_file_close(&fh); + //switch_core_file_close(&fh); } } } @@ -288,7 +288,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void is_open = 0; } else { if (use_fh == &source->chime_fh && source->chime_max) { - source->chime_max_counter += source->samples; + source->chime_max_counter += (int32_t)source->samples; if (source->chime_max_counter >= source->chime_max) { source->chime_max_counter = 0; switch_core_file_close(use_fh); @@ -318,7 +318,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void continue; } switch_mutex_lock(cp->audio_mutex); - bused = switch_buffer_inuse(cp->audio_buffer); + bused = (uint32_t)switch_buffer_inuse(cp->audio_buffer); if (bused > source->samples * 768) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Flushing Stream Handle Buffer [%s() %s:%d] size: %u samples: %ld\n", cp->func, cp->file, cp->line, bused, (long)source->samples); diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 0b64ba7e5b..ad4954816c 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -138,7 +138,7 @@ static void decode_fd(shout_context_t *context, void *data, size_t bytes); static inline void free_context(shout_context_t *context) { - int ret; + size_t ret; if (context) { switch_mutex_lock(context->audio_mutex); @@ -370,8 +370,9 @@ static size_t stream_callback(void *ptr, size_t size, size_t nmemb, void *data) shout_context_t *context = data; int decode_status = 0; size_t usedlen; - uint32_t used, buf_size = 1024 * 128; /* do not make this 64 or less, stutter will ensue after + uint32_t buf_size = 1024 * 128; /* do not make this 64 or less, stutter will ensue after first 64k buffer is dry */ + switch_size_t used; if (context->prebuf) { buf_size = context->prebuf; @@ -553,13 +554,13 @@ static void *SWITCH_THREAD_FUNC write_stream_thread(switch_thread_t *thread, voi r[i] = audio[j++]; } - if ((rlen = lame_encode_buffer(context->gfp, l, r, audio_read / 4, mp3buf, sizeof(mp3buf))) < 0) { + if ((rlen = lame_encode_buffer(context->gfp, l, r, (int)(audio_read / 4), mp3buf, sizeof(mp3buf))) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen); goto error; } } else if (context->channels == 1) { - if ((rlen = lame_encode_buffer(context->gfp, (void *) audio, NULL, audio_read / sizeof(int16_t), mp3buf, sizeof(mp3buf))) < 0) { + if ((rlen = lame_encode_buffer(context->gfp, (void *) audio, NULL, (int)(audio_read / sizeof(int16_t)), mp3buf, sizeof(mp3buf))) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen); goto error; } @@ -653,7 +654,7 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char if (mpg123_format_all(context->mh) != MPG123_OK) { MPGERROR(); } - if (mpg123_param(context->mh, MPG123_FORCE_RATE, context->samplerate, 0) != MPG123_OK) { + if (mpg123_param(context->mh, MPG123_FORCE_RATE, (long)context->samplerate, 0) != MPG123_OK) { MPGERROR(); } @@ -1017,13 +1018,13 @@ static switch_status_t shout_file_write(switch_file_handle_t *handle, void *data context->r[i] = audio[j++]; } - if ((rlen = lame_encode_buffer(context->gfp, context->l, context->r, nsamples, context->mp3buf, context->mp3buflen)) < 0) { + if ((rlen = lame_encode_buffer(context->gfp, context->l, context->r, (int)nsamples, context->mp3buf, (int)context->mp3buflen)) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen); return SWITCH_STATUS_FALSE; } } else if (handle->channels == 1) { - if ((rlen = lame_encode_buffer(context->gfp, audio, NULL, nsamples, context->mp3buf, context->mp3buflen)) < 0) { + if ((rlen = lame_encode_buffer(context->gfp, audio, NULL, (int)nsamples, context->mp3buf, (int)context->mp3buflen)) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen); return SWITCH_STATUS_FALSE; } @@ -1032,7 +1033,7 @@ static switch_status_t shout_file_write(switch_file_handle_t *handle, void *data } if (rlen) { - int ret = fwrite(context->mp3buf, 1, rlen, context->fp); + int ret = (int)fwrite(context->mp3buf, 1, rlen, context->fp); if (ret < 0) { return SWITCH_STATUS_FALSE; } @@ -1268,7 +1269,7 @@ void do_telecast(switch_stream_handle_t *stream) memset(buf, 0, bytes); } - if ((rlen = lame_encode_buffer(gfp, (void *) buf, NULL, bytes / 2, mp3buf, sizeof(mp3buf))) < 0) { + if ((rlen = lame_encode_buffer(gfp, (void *) buf, NULL, (int)(bytes / 2), mp3buf, sizeof(mp3buf))) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen); goto end; } @@ -1370,7 +1371,7 @@ void do_broadcast(switch_stream_handle_t *stream) break; } - if ((rlen = lame_encode_buffer(gfp, (void *) buf, NULL, samples, mp3buf, sizeof(mp3buf))) < 0) { + if ((rlen = lame_encode_buffer(gfp, (void *) buf, NULL, (int)samples, mp3buf, sizeof(mp3buf))) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen); goto end; } diff --git a/src/mod/formats/mod_tone_stream/mod_tone_stream.c b/src/mod/formats/mod_tone_stream/mod_tone_stream.c index 2aafff129f..630acd37ac 100644 --- a/src/mod/formats/mod_tone_stream/mod_tone_stream.c +++ b/src/mod/formats/mod_tone_stream/mod_tone_stream.c @@ -90,11 +90,11 @@ static switch_status_t silence_stream_file_read(switch_file_handle_t *handle, vo *len = sh->samples; } - sh->samples -= *len; + sh->samples -= (int32_t)*len; } if (sh->silence) { - switch_generate_sln_silence((int16_t *) data, *len, sh->silence); + switch_generate_sln_silence((int16_t *) data, (uint32_t)*len, sh->silence); } else { memset(data, 0, *len * 2); } diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 2cb9947e56..5e4c9016d8 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -1491,7 +1491,7 @@ static JSBool session_recordfile(JSContext * cx, JSObject * obj, uintN argc, jsv check_hangup_hook(jss, &ret); *rval = cb_state.ret; - return ret; + return (JSBool)ret; } static JSBool session_collect_input(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) @@ -1550,7 +1550,7 @@ static JSBool session_collect_input(JSContext * cx, JSObject * obj, uintN argc, check_hangup_hook(jss, &ret); *rval = cb_state.ret; - return ret; + return (JSBool)ret; } /* session.sayphrase(phrase_name, phrase_data, language, dtmf_callback, dtmf_callback_args)*/ @@ -1626,7 +1626,7 @@ static JSBool session_sayphrase(JSContext * cx, JSObject * obj, uintN argc, jsva check_hangup_hook(jss, &ret); *rval = cb_state.ret; - return ret; + return (JSBool)ret; } static jsval check_hangup_hook(struct js_session *jss, jsval * rp) @@ -1770,7 +1770,7 @@ static JSBool session_streamfile(JSContext * cx, JSObject * obj, uintN argc, jsv switch_snprintf(posbuf, sizeof(posbuf), "%u", fh.offset_pos); switch_channel_set_variable(channel, "last_file_position", posbuf); - return ret; + return (JSBool)ret; } @@ -1834,7 +1834,7 @@ static JSBool session_sleep(JSContext * cx, JSObject * obj, uintN argc, jsval * check_hangup_hook(jss, &ret); *rval = cb_state.ret; - return ret; + return (JSBool)ret; } static JSBool session_set_variable(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) @@ -2028,7 +2028,7 @@ static JSBool session_speak(JSContext * cx, JSObject * obj, uintN argc, jsval * check_hangup_hook(jss, &ret); *rval = cb_state.ret; - return ret; + return (JSBool)ret; } static JSBool session_get_digits(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) @@ -2228,7 +2228,7 @@ static JSBool session_wait_for_media(JSContext * cx, JSObject * obj, uintN argc, JS_ResumeRequest(cx, saveDepth); check_hangup_hook(jss, &ret); - return ret; + return (JSBool)ret; } static JSBool session_wait_for_answer(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) @@ -2274,7 +2274,7 @@ static JSBool session_wait_for_answer(JSContext * cx, JSObject * obj, uintN argc } JS_ResumeRequest(cx, saveDepth); check_hangup_hook(jss, &ret); - return ret; + return (JSBool)ret; } static JSBool session_detach(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) @@ -2311,7 +2311,7 @@ static JSBool session_detach(JSContext * cx, JSObject * obj, uintN argc, jsval * *rval = JS_FALSE; } - return ret; + return (JSBool)ret; } static JSBool session_execute(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) @@ -2354,7 +2354,7 @@ static JSBool session_execute(JSContext * cx, JSObject * obj, uintN argc, jsval } *rval = BOOLEAN_TO_JSVAL(retval); - return ret; + return (JSBool)ret; } static JSBool session_get_event(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) diff --git a/src/mod/loggers/mod_console/mod_console.c b/src/mod/loggers/mod_console/mod_console.c index 4b80add5e4..c9d332ef09 100644 --- a/src/mod/loggers/mod_console/mod_console.c +++ b/src/mod/loggers/mod_console/mod_console.c @@ -248,8 +248,8 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit DWORD outbytes = 0; SetConsoleTextAttribute(hStdout, COLORS[node->level]); if (log_uuid && !zstr(node->userdata)) { - WriteFile(hStdout, node->userdata, strlen(node->userdata), &outbytes, NULL); - WriteFile(hStdout, " ", strlen(" "), &outbytes, NULL); + WriteFile(hStdout, node->userdata, (DWORD)strlen(node->userdata), &outbytes, NULL); + WriteFile(hStdout, " ", 1, &outbytes, NULL); } WriteFile(hStdout, node->data, len, &outbytes, NULL); SetConsoleTextAttribute(hStdout, wOldColorAttrs); diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index 4e2776281a..60b1108694 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -375,7 +375,7 @@ static abyss_bool is_authorized(const TSession * r, const char *command) switch_safe_free(dup); if (!ok) { - ResponseStatus(r, err); + ResponseStatus(r, (xmlrpc_uint16_t)err); } @@ -546,8 +546,7 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name) } void stop_hook_event_handler(switch_event_t *event) { - char *json; - wsh_t *wsh = (TSession *)event->bind_user_data; + wsh_t *wsh = (wsh_t *)event->bind_user_data; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "got websocket::stophook, closing\n"); wsh->down++; @@ -555,7 +554,7 @@ void stop_hook_event_handler(switch_event_t *event) { void event_handler(switch_event_t *event) { char *json; - wsh_t *wsh = (TSession *)event->bind_user_data; + wsh_t *wsh = (wsh_t *)event->bind_user_data; switch_event_serialize_json(event, &json); ws_write_frame(wsh, WSOC_TEXT, json, strlen(json)); free(json); diff --git a/src/mod/xml_int/mod_xml_rpc/ws.c b/src/mod/xml_int/mod_xml_rpc/ws.c index 9099444189..4ab65749fc 100644 --- a/src/mod/xml_int/mod_xml_rpc/ws.c +++ b/src/mod/xml_int/mod_xml_rpc/ws.c @@ -140,7 +140,7 @@ static int cheezy_get_var(char *data, char *name, char *buf, size_t buflen) } if (v && e) { - int cplen; + size_t cplen; size_t len = e - v; if (len > buflen - 1) { @@ -266,7 +266,6 @@ int ws_handshake_kvp(wsh_t *wsh, char *key, char *version, char *proto) issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) { issize_t r; - int x = 0; TConn *conn = wsh->tsession->connP; if (!wsh->handshake) { @@ -305,8 +304,8 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) return r; } else { memcpy(data, conn->buffer.b + conn->bufferpos, bytes); - conn->bufferpos += bytes; - return bytes; + conn->bufferpos += (uint32_t)bytes; + return (issize_t)bytes; } } @@ -319,14 +318,14 @@ issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) if (wsh->ssl) { do { - r = SSL_write(wsh->ssl, data, bytes); - } while (r == -1 && SSL_get_error(wsh->ssl, r) == SSL_ERROR_WANT_WRITE); + r = SSL_write(wsh->ssl, data, (int)bytes); + } while (r == -1 && SSL_get_error(wsh->ssl, (int)r) == SSL_ERROR_WANT_WRITE); - return r; + return (issize_t)r; } - if (ConnWrite(wsh->tsession->connP, data, bytes)) { - return bytes; + if (ConnWrite(wsh->tsession->connP, data, (uint32_t)bytes)) { + return (issize_t)bytes; } else { return 0; } @@ -549,9 +548,9 @@ issize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes) memcpy(wsh->wbuffer + wsh->wdatalen, data, bytes); - wsh->wdatalen += bytes; + wsh->wdatalen += (issize_t)bytes; - return bytes; + return (issize_t)bytes; } issize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc) @@ -612,7 +611,7 @@ issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes) return -2; } - return bytes; + return (issize_t)bytes; } diff --git a/src/switch_console.c b/src/switch_console.c index e1c1448d03..c636c12a30 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -724,7 +724,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch } if (!zstr(cursor) && !zstr(line)) { - pos = (cursor - line); + pos = (int)(cursor - line); } h.out = console_out; @@ -783,7 +783,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch buf = lp + 1; } - h.len = strlen(buf); + h.len = (int)strlen(buf); if (h.out) { fprintf(h.out, "\n\n"); diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 9831d0099f..fb41d0c039 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -230,7 +230,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b } if (!bug->record_frame_size) { - switch_size_t frame_size; + uint32_t frame_size; switch_codec_implementation_t read_impl = { 0 }; //switch_codec_implementation_t other_read_impl = { 0 }; //switch_core_session_t *other_session; @@ -301,7 +301,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b } switch_mutex_unlock(bug->read_mutex); } else if (fill_read) { - frame->datalen = bytes; + frame->datalen = (uint32_t)bytes; memset(frame->data, 255, frame->datalen); } @@ -326,7 +326,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b fp = (int16_t *) frame->data; rlen = frame->datalen / 2; wlen = datalen / 2; - blen = bytes / 2; + blen = (uint32_t)(bytes / 2); if (switch_test_flag(bug, SMBF_STEREO)) { int16_t *left, *right; @@ -380,8 +380,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b } } - frame->datalen = bytes; - frame->samples = bytes / sizeof(int16_t); + frame->datalen = (uint32_t)bytes; + frame->samples = (uint32_t)(bytes / sizeof(int16_t)); frame->rate = read_impl.actual_samples_per_second; frame->codec = NULL; diff --git a/src/switch_core_speech.c b/src/switch_core_speech.c index cb3e0d1d56..e7110a0c74 100644 --- a/src/switch_core_speech.c +++ b/src/switch_core_speech.c @@ -232,7 +232,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle } } - switch_resample_process(sh->resampler, data, *datalen / 2); + switch_resample_process(sh->resampler, data, (uint32_t)(*datalen / 2)); if (sh->resampler->to_len < want / 2 || sh->resampler->to_len > orig_len / 2) { if (!sh->buffer) { int factor = sh->resampler->to_len * sh->samplerate / 1000; diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 05d27c6caf..65546607b7 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -605,7 +605,7 @@ static switch_status_t switch_cache_db_execute_sql_chunked(switch_cache_db_handl { switch_status_t status = SWITCH_STATUS_FALSE; char *p, *s, *e; - int chunk_count; + switch_size_t chunk_count; switch_size_t len; switch_assert(chunk_size); @@ -1871,7 +1871,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread, if (switch_test_flag((&runtime), SCF_DEBUG_SQL)) { char line[128] = ""; - int l; + switch_size_t l; switch_snprintf(line, sizeof(line), "%s RUN QUEUE [", qm->name); diff --git a/src/switch_ivr_menu.c b/src/switch_ivr_menu.c index e3dfa5c848..5fe1ed832f 100644 --- a/src/switch_ivr_menu.c +++ b/src/switch_ivr_menu.c @@ -473,7 +473,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s char digit_buffer[128] = ""; char *digits_regex = switch_core_session_sprintf(session, "^%s$", menu->pin); - if (switch_play_and_get_digits(session, strlen(menu->pin), strlen(menu->pin), 3, 3000, "#", + if (switch_play_and_get_digits(session, (uint32_t)strlen(menu->pin), (uint32_t)strlen(menu->pin), 3, 3000, "#", menu->prompt_pin_file, menu->bad_pin_file, NULL, digit_buffer, sizeof(digit_buffer), digits_regex, 10000, NULL) != SWITCH_STATUS_SUCCESS) { switch_goto_status(SWITCH_STATUS_FALSE, end); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 208e5a3e3c..efcf35f2de 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -214,8 +214,8 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void } status = switch_ivr_read(collect->session, - len, - len, + (uint32_t)len, + (uint32_t)len, collect->file, NULL, buf, sizeof(buf), collect->confirm_timeout, NULL, 0); @@ -3150,12 +3150,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_buffer_peek(early_state.buffer, &mlen, sizeof(uint16_t)); if (buflen >= (mlen + sizeof(uint16_t))) { switch_buffer_toss(early_state.buffer, sizeof(uint16_t)); - write_frame.datalen = switch_buffer_read(early_state.buffer, write_frame.data, mlen); + write_frame.datalen = (uint32_t)switch_buffer_read(early_state.buffer, write_frame.data, mlen); } } } else { if (switch_buffer_inuse(early_state.buffer) >= write_frame.codec->implementation->decoded_bytes_per_packet) { - write_frame.datalen = switch_buffer_read(early_state.buffer, write_frame.data, + write_frame.datalen = (uint32_t)switch_buffer_read(early_state.buffer, write_frame.data, write_frame.codec->implementation->decoded_bytes_per_packet); } } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 74ed83efb8..b98355777e 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1492,7 +1492,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } } - fh->offset_pos += switch_test_flag(fh, SWITCH_FILE_NATIVE) ? bread : bread / 2; + fh->offset_pos += (uint32_t)(switch_test_flag(fh, SWITCH_FILE_NATIVE) ? bread : bread / 2); if (bread < framelen) { memset(abuf + bread, 255, framelen - bread); @@ -1538,7 +1538,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_buffer_write(fh->audio_buffer, abuf, switch_test_flag(fh, SWITCH_FILE_NATIVE) ? olen : olen * 2); olen = switch_buffer_read(fh->audio_buffer, abuf, framelen); - fh->offset_pos += olen / 2; + fh->offset_pos += (uint32_t)(olen / 2); if (!switch_test_flag(fh, SWITCH_FILE_NATIVE)) { olen /= 2; diff --git a/src/switch_json.c b/src/switch_json.c index 4467692dba..ccdaedb83e 100644 --- a/src/switch_json.c +++ b/src/switch_json.c @@ -343,7 +343,8 @@ static const char *parse_array(cJSON *item,const char *value) static char *print_array(cJSON *item,int depth,int fmt) { char **entries; - char *out=0,*ptr,*ret;int len=5; + char *out=0,*ptr,*ret; + size_t len=5; cJSON *child=item->child; int numentries=0,i=0,fail=0; @@ -430,7 +431,8 @@ static const char *parse_object(cJSON *item,const char *value) static char *print_object(cJSON *item,int depth,int fmt) { char **entries=0,**names=0; - char *out=0,*ptr,*ret,*str;int len=7,i=0,j; + char *out=0,*ptr,*ret,*str;int i=0,j; + size_t len=7; cJSON *child=item->child; int numentries=0,fail=0; /* Count the number of entries. */ diff --git a/src/switch_mprintf.c b/src/switch_mprintf.c index cdd85088de..23cb3604c9 100644 --- a/src/switch_mprintf.c +++ b/src/switch_mprintf.c @@ -457,7 +457,7 @@ static int vxprintf(void (*func) (void *, const char *, int), /* Consumer of tex longvalue = longvalue / base; } while (longvalue > 0); } - length = &buf[etBUFSIZE - 1] - bufpt; + length = (int)(&buf[etBUFSIZE - 1] - bufpt); for (idx = precision - length; idx > 0; idx--) { *(--bufpt) = '0'; /* Zero pad */ } @@ -472,7 +472,7 @@ static int vxprintf(void (*func) (void *, const char *, int), /* Consumer of tex *(--bufpt) = x; } } - length = &buf[etBUFSIZE - 1] - bufpt; + length = (int)(&buf[etBUFSIZE - 1] - bufpt); break; case etFLOAT: case etEXP: @@ -625,7 +625,7 @@ static int vxprintf(void (*func) (void *, const char *, int), /* Consumer of tex /* The converted number is in buf[] and zero terminated. Output it. ** Note that the number is in the usual order, not reversed as with ** integer conversions. */ - length = bufpt - buf; + length = (int)(bufpt - buf); bufpt = buf; /* Special case: Add leading zeros if the flag_zeropad flag is @@ -672,7 +672,7 @@ static int vxprintf(void (*func) (void *, const char *, int), /* Consumer of tex } else if (xtype == etDYNSTRING) { zExtra = bufpt; } - length = strlen(bufpt); + length = (int)strlen(bufpt); if (precision >= 0 && precision < length) length = precision; break; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 2bde4cd3f6..ef24270833 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -817,7 +817,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d memcpy(buf, data, cpylen); - packet = switch_stun_packet_parse(buf, cpylen); + packet = switch_stun_packet_parse(buf, (uint32_t)cpylen); if (!packet) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Invalid STUN/ICE packet received %ld %d\n", (long)cpylen, *(uint8_t *) data); goto end; @@ -1676,7 +1676,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) str_cname = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_local_addr); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 to %s\n", str_cname); - sr->sr_desc_ssrc.length = strlen(str_cname); + sr->sr_desc_ssrc.length = (unsigned int)strlen(str_cname); memcpy ((char*)sr->sr_desc_ssrc.text, str_cname, strlen(str_cname)); } @@ -2504,7 +2504,7 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls) // //} - if ((ret = BIO_write(dtls->read_bio, dtls->data, dtls->bytes)) != (int)dtls->bytes) { + if ((ret = BIO_write(dtls->read_bio, dtls->data, (int)dtls->bytes)) != (int)dtls->bytes) { ret = SSL_get_error(dtls->ssl, ret); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "%s DTLS packet read err %d\n", rtp_type(rtp_session), ret); dtls_set_state(dtls, DS_FAIL); @@ -2512,7 +2512,7 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls) } } - if (SSL_read(dtls->ssl, dtls->data, dtls->bytes) == (int)dtls->bytes) { + if (SSL_read(dtls->ssl, dtls->data, (int)dtls->bytes) == (int)dtls->bytes) { if (BIO_reset(dtls->read_bio)); } diff --git a/src/switch_stun.c b/src/switch_stun.c index 8be191e782..b491c34226 100644 --- a/src/switch_stun.c +++ b/src/switch_stun.c @@ -502,7 +502,7 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_integrity(switch_stun_p xlen = ntohs(packet->header.length) + sizeof(switch_stun_packet_header_t); packet->header.length += htons(sizeof(switch_stun_packet_attribute_t)) + attribute->length; - HMAC(EVP_sha1(), (unsigned char *)pass, strlen(pass), (void *)packet, xlen, (void *)attribute->value, NULL); + HMAC(EVP_sha1(), (unsigned char *)pass, (int)strlen(pass), (void *)packet, xlen, (void *)attribute->value, NULL); return 1; } diff --git a/src/switch_utils.c b/src/switch_utils.c index 12b417b40a..4ed7f82445 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -82,7 +82,7 @@ SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switc switch_zmalloc(new_frame, sizeof(*new_frame)); switch_set_flag(new_frame, SFF_DYNAMIC); - new_frame->buflen = size; + new_frame->buflen = (uint32_t)size; new_frame->data = malloc(size); switch_assert(new_frame->data); @@ -167,7 +167,7 @@ SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param, next = strchr(ptr, ';'); if (!strncasecmp(ptr, param, len) && *e == '=') { - int mlen; + size_t mlen; ptr = ++e; @@ -2149,7 +2149,7 @@ SWITCH_DECLARE(char *) switch_escape_string(const char *in, char *out, switch_si SWITCH_DECLARE(char *) switch_escape_string_pool(const char *in, switch_memory_pool_t *pool) { - int len = strlen(in) * 2 + 1; + size_t len = strlen(in) * 2 + 1; char *buf = switch_core_alloc(pool, len); return switch_escape_string(in, buf, len); } diff --git a/src/switch_xml_config.c b/src/switch_xml_config.c index cebe6ccbe7..ef12b9965c 100644 --- a/src/switch_xml_config.c +++ b/src/switch_xml_config.c @@ -101,7 +101,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse(switch_xml_t xml, switch { switch_event_t *event = NULL; switch_status_t result; - int count = switch_event_import_xml(xml, "name", "value", &event); + int count = (int)switch_event_import_xml(xml, "name", "value", &event); result = switch_xml_config_parse_event(event, count, reload, instructions);