case T4_IMAGE_TYPE_4COLOUR_12BIT:
return 8;
}
- return 1;
}
/*- End of function --------------------------------------------------------*/
(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") ||\
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");
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 {
return 1;
}
}
-
- return 0;
}
static int members_callback(void *pArg, int argc, char **argv, char **columnNames)
}
}
- if ((arg = strchr(mycmd, ' '))) {
+ if (mycmd && (arg = strchr(mycmd, ' '))) {
*arg++ = '\0';
}
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));
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)));
}
{
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;
} 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);
}
}
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;
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;
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);
}
/* 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];
}
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 */
while (*s) {
char c;
- if ((c = digit_matching_keypad(*s++)) > 0) {
+ if ((c = (char)digit_matching_keypad(*s++)) > 0) {
*d++ = c + 48;
}
}
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;
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);
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;
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);
}
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");
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");
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");
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;
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;
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 {
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);
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;
}
}
} 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;
}
}
} 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;
}
} 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;
}
} 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);
}
}
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);
*len = context->samples;
}
- context->samples -= *len;
+ context->samples -= (int)*len;
memset(data, 255, *len *2);
status = SWITCH_STATUS_SUCCESS;
} else {
} 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 */
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);
}
}
- 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;
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:
stream->write_function(stream, " <row id=\"%d\">\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);
*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);
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;
#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; \
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();
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);
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;
}
#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)
{
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);
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) {
}
- 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;
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;
}
}
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);
/* 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);
{
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,
}
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;
}
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,
}
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;
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 {
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 {
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 {
}
} 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 {
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 : "");
}
}
}
#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; \
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] = "";
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);
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,
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) {
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));
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);
}
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)) {
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
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;
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) {
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 {
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
/* 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;
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);
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;
switch_file_read(pipe, buf, &quantity);
- howmany = quantity;
+ howmany = (int)quantity;
return howmany;
}
switch_file_write(pipe, buf, &quantity);
- howmany = quantity;
+ howmany = (int)quantity;
return howmany;
}
*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,
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) {
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;
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);
}
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 {
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,",");
}
- 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++;
}
}
- 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;
}
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;
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);
}
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;
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;
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) {
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;
}
}
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);
}
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))) {
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);
}
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 == ' ') {
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;
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);
char *tmp;
int pos;
- pos = (ptr - mbuf);
+ pos = (int)(ptr - mbuf);
buf_len += block_len;
tmp = realloc(mbuf, buf_len);
switch_assert(tmp);
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");
}
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]);
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;
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) {
source->chime_counter = source->rate * source->chime_freq;
use_fh = &fh;
goto retry;
- switch_core_file_close(&fh);
+ //switch_core_file_close(&fh);
}
}
}
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);
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);
static inline void free_context(shout_context_t *context)
{
- int ret;
+ size_t ret;
if (context) {
switch_mutex_lock(context->audio_mutex);
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;
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;
}
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();
}
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;
}
}
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;
}
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;
}
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;
}
*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);
}
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)
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)*/
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)
switch_snprintf(posbuf, sizeof(posbuf), "%u", fh.offset_pos);
switch_channel_set_variable(channel, "last_file_position", posbuf);
- return ret;
+ return (JSBool)ret;
}
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)
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)
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)
}
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)
*rval = JS_FALSE;
}
- return ret;
+ return (JSBool)ret;
}
static JSBool session_execute(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
}
*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)
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);
switch_safe_free(dup);
if (!ok) {
- ResponseStatus(r, err);
+ ResponseStatus(r, (xmlrpc_uint16_t)err);
}
}
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++;
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);
}
if (v && e) {
- int cplen;
+ size_t cplen;
size_t len = e - v;
if (len > buflen - 1) {
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) {
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;
}
}
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;
}
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)
return -2;
}
- return bytes;
+ return (issize_t)bytes;
}
}
if (!zstr(cursor) && !zstr(line)) {
- pos = (cursor - line);
+ pos = (int)(cursor - line);
}
h.out = console_out;
buf = lp + 1;
}
- h.len = strlen(buf);
+ h.len = (int)strlen(buf);
if (h.out) {
fprintf(h.out, "\n\n");
}
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;
}
switch_mutex_unlock(bug->read_mutex);
} else if (fill_read) {
- frame->datalen = bytes;
+ frame->datalen = (uint32_t)bytes;
memset(frame->data, 255, frame->datalen);
}
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;
}
}
- 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;
}
}
- 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;
{
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);
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);
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);
}
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);
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);
}
}
}
}
- 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);
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;
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;
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. */
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 */
}
*(--bufpt) = x;
}
}
- length = &buf[etBUFSIZE - 1] - bufpt;
+ length = (int)(&buf[etBUFSIZE - 1] - bufpt);
break;
case etFLOAT:
case etEXP:
/* 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
} else if (xtype == etDYNSTRING) {
zExtra = bufpt;
}
- length = strlen(bufpt);
+ length = (int)strlen(bufpt);
if (precision >= 0 && precision < length)
length = precision;
break;
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;
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));
}
//
//}
- 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);
}
}
- 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));
}
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;
}
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);
next = strchr(ptr, ';');
if (!strncasecmp(ptr, param, len) && *e == '=') {
- int mlen;
+ size_t mlen;
ptr = ++e;
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);
}
{
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);