cleanup msvc code analysis tagging and warnings

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13280 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris committed 2009-05-11 22:28:02 +00:00
1 parent c1d643900d
commit 4441606b17
11 files changed
+81 -71

No files matched your search

@@ -1672,6 +1672,11 @@ static void conference_loop_fn_exec_app(conference_member_t *member, caller_cont
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate memory to duplicate execute_app data.\n");
goto done;
}
if (!app) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to find application.\n");
goto done;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Execute app: %s, %s\n", app, arg);
channel = switch_core_session_get_channel(member->session);
@@ -2541,10 +2546,10 @@ static void conference_send_all_dtmf(conference_member_t *member, conference_obj
if (imember->session) {
const char *p;
for (p = dtmf; p && *p; p++) {
switch_dtmf_t dtmf = { *p, SWITCH_DEFAULT_DTMF_DURATION};
switch_dtmf_t digit = { *p, SWITCH_DEFAULT_DTMF_DURATION};
switch_mutex_lock(imember->control_mutex);
switch_core_session_kill_channel(imember->session, SWITCH_SIG_BREAK);
switch_core_session_send_dtmf(imember->session, &dtmf);
switch_core_session_send_dtmf(imember->session, &digit);
switch_mutex_unlock(imember->control_mutex);
}
}
@@ -4562,7 +4567,7 @@ static void set_mflags(char *flags, member_flag_t *f)
argc = switch_separate_string(dup, '|', argv, (sizeof(argv) / sizeof(argv[0])));
for(i = 0; i < argc; i++) {
for(i = 0; i < argc && argv[i]; i++) {
if (!strcasecmp(argv[i], "mute")) {
*f &= ~MFLAG_CAN_SPEAK;
} else if (!strcasecmp(argv[i], "deaf")) {
+25 -25
View File
@@ -2352,54 +2352,54 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
if ((x_params = switch_xml_child(x_domain, "params"))) {
for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
const char *var = switch_xml_attr(x_param, "name");
const char *pvar = switch_xml_attr(x_param, "name");
const char *val = switch_xml_attr(x_param, "value");
if (!strcasecmp(var, "dial-string")) {
if (!strcasecmp(pvar, "dial-string")) {
dest = val;
} else if (!strncasecmp(var, "dial-var-", 9)) {
if (!var_event) {
switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
} else {
switch_event_del_header(var_event, var + 9);
switch_event_del_header(var_event, pvar + 9);
}
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, var + 9, val);
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
}
}
}
if ((x_params = switch_xml_child(x_group, "params"))) {
for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
const char *var = switch_xml_attr(x_param, "name");
const char *pvar = switch_xml_attr(x_param, "name");
const char *val = switch_xml_attr(x_param, "value");
if (!strcasecmp(var, "dial-string")) {
if (!strcasecmp(pvar, "dial-string")) {
dest = val;
} else if (!strncasecmp(var, "dial-var-", 9)) {
} else if (!strncasecmp(pvar, "dial-var-", 9)) {
if (!var_event) {
switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
} else {
switch_event_del_header(var_event, var + 9);
switch_event_del_header(var_event, pvar + 9);
}
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, var + 9, val);
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
}
}
}
if ((x_params = switch_xml_child(x_user, "params"))) {
for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
const char *var = switch_xml_attr(x_param, "name");
const char *pvar = switch_xml_attr(x_param, "name");
const char *val = switch_xml_attr(x_param, "value");
if (!strcasecmp(var, "dial-string")) {
if (!strcasecmp(pvar, "dial-string")) {
dest = val;
} else if (!strncasecmp(var, "dial-var-", 9)) {
} else if (!strncasecmp(pvar, "dial-var-", 9)) {
if (!var_event) {
switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
} else {
switch_event_del_header(var_event, var + 9);
switch_event_del_header(var_event, pvar + 9);
}
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, var + 9, val);
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
}
}
}
@@ -2408,7 +2408,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No dial-string available, please check your user directory.\n");
cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
} else {
const char *var;
const char *varval;
char *d_dest = NULL;
switch_channel_t *channel;
switch_originate_flag_t myflags = SOF_NONE;
@@ -2422,9 +2422,9 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
if (session) {
channel = switch_core_session_get_channel(session);
if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))
|| (var = switch_event_get_header(var_event, "leg_timeout"))) {
timelimit = atoi(var);
if ((varval = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))
|| (varval = switch_event_get_header(var_event, "leg_timeout"))) {
timelimit = atoi(varval);
}
switch_channel_set_variable(channel, "dialed_user", user);
@@ -2439,9 +2439,9 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
switch_event_dup(&event, var_event);
switch_event_del_header(event, "dialed_user");
switch_event_del_header(event, "dialed_domain");
if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
(var = switch_event_get_header(var_event, "leg_timeout"))) {
timelimit = atoi(var);
if ((varval = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
(varval = switch_event_get_header(var_event, "leg_timeout"))) {
timelimit = atoi(varval);
}
} else {
switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS);
@@ -2485,17 +2485,17 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
if (new_channel && xml) {
if ((x_params = switch_xml_child(x_domain, "variables"))) {
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
const char *var = switch_xml_attr(x_param, "name");
const char *pvar = switch_xml_attr(x_param, "name");
const char *val = switch_xml_attr(x_param, "value");
switch_channel_set_variable(new_channel, var, val);
switch_channel_set_variable(new_channel, pvar, val);
}
}
if ((x_params = switch_xml_child(x_user, "variables"))) {
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
const char *var = switch_xml_attr(x_param, "name");
const char *pvar = switch_xml_attr(x_param, "name");
const char *val = switch_xml_attr(x_param, "value");
switch_channel_set_variable(new_channel, var, val);
switch_channel_set_variable(new_channel, pvar, val);
}
}
}
+2 -3
View File
@@ -2168,8 +2168,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
stop_node_thread();
}
top:
for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_first(NULL, globals.fifo_hash)) {
int x = 0;
switch_hash_this(hi, NULL, NULL, &val);
node = (fifo_node_t *) val;
@@ -2186,8 +2185,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
switch_core_hash_destroy(&node->consumer_hash);
switch_thread_rwlock_unlock(node->rwlock);
switch_core_destroy_memory_pool(&node->pool);
goto top;
}
switch_core_hash_destroy(&globals.fifo_hash);
memset(&globals, 0, sizeof(globals));
switch_mutex_unlock(mutex);
@@ -2858,15 +2858,15 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
if (id) {
int ok = 1;
switch_event_t *params = NULL;
switch_event_t *locate_params = NULL;
const char *email_addr = NULL;
switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
switch_assert(params);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", id);
switch_event_create(&locate_params, SWITCH_EVENT_REQUEST_PARAMS);
switch_assert(locate_params);
switch_event_add_header_string(locate_params, SWITCH_STACK_BOTTOM, "mailbox", id);
if (switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"),
&x_domain_root, &x_domain, &x_user, NULL, params) == SWITCH_STATUS_SUCCESS) {
&x_domain_root, &x_domain, &x_user, NULL, locate_params) == SWITCH_STATUS_SUCCESS) {
if ((x_params = switch_xml_child(x_user, "params"))) {
for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
const char *var = switch_xml_attr_soft(x_param, "name");
@@ -2925,7 +2925,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
ok = 0;
}
switch_event_destroy(&params);
switch_event_destroy(&locate_params);
if (!ok) {
goto end;
@@ -3904,13 +3904,13 @@ SWITCH_STANDARD_API(voicemail_api_function)
}
if (!profile) {
switch_hash_index_t *hi;
void *val;
switch_hash_index_t *index;
void *value;
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (vm_profile_t *) val;
for (index = switch_hash_first(NULL, globals.profile_hash); index; index = switch_hash_next(index)) {
switch_hash_this(index, NULL, NULL, &value);
profile = (vm_profile_t *) value;
if (profile) {
switch_thread_rwlock_rdlock(profile->rwlock);
break;
@@ -565,7 +565,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE];
uint32_t flag = 0;
switch_status_t status;
switch_status_t encode_status;
uint32_t rate = tech_pvt->read_codec.implementation->actual_samples_per_second;
*frame = &tech_pvt->cng_frame;
@@ -575,7 +575,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
memset(&data, 0, sizeof(data));
if (strcasecmp(tech_pvt->read_codec.implementation->iananame, "L16")) {
status = switch_core_codec_encode(&tech_pvt->read_codec,
encode_status = switch_core_codec_encode(&tech_pvt->read_codec,
NULL,
data,
sizeof(data),
@@ -585,7 +585,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
&tech_pvt->cng_frame.datalen,
&rate,
&flag);
if (status != SWITCH_STATUS_SUCCESS) {
if (encode_status != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
@@ -664,7 +664,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
}
}
if (switch_test_flag(tech_pvt, TFLAG_LINKED)) {
if (switch_test_flag(tech_pvt, TFLAG_LINKED) && tech_pvt->other_tech_pvt) {
switch_frame_t *clone;
if (frame->codec->implementation != tech_pvt->write_codec.implementation) {
+1 -1
View File
@@ -4096,7 +4096,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
end:
if (switch_event_create(&event, SWITCH_EVENT_RECV_INFO) == SWITCH_STATUS_SUCCESS) {
if (sip && switch_event_create(&event, SWITCH_EVENT_RECV_INFO) == SWITCH_STATUS_SUCCESS) {
sip_alert_info_t *alert_info = sip_alert_info(sip);
if (sip && sip->sip_content_type) {
@@ -1177,8 +1177,8 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
if (listener->session) {
switch_channel_t *channel = switch_core_session_get_channel(listener->session);
if (switch_channel_get_state(channel) < CS_HANGUP && switch_channel_test_flag(channel, CF_DIVERT_EVENTS)) {
switch_channel_t *chan = switch_core_session_get_channel(listener->session);
if (switch_channel_get_state(chan) < CS_HANGUP && switch_channel_test_flag(chan, CF_DIVERT_EVENTS)) {
switch_event_t *e = NULL;
while (switch_core_session_dequeue_event(listener->session, &e, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
if (switch_queue_trypush(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) {
@@ -1480,8 +1480,10 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
switch_set_flag_locked(listener, LFLAG_CONNECTED);
switch_event_create(&call_event, SWITCH_EVENT_CHANNEL_DATA);
switch_caller_profile_event_set_data(switch_channel_get_caller_profile(channel), "Channel", call_event);
switch_channel_event_set_data(channel, call_event);
if (channel) {
switch_caller_profile_event_set_data(switch_channel_get_caller_profile(channel), "Channel", call_event);
switch_channel_event_set_data(channel, call_event);
}
switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Content-Type", "command/reply");
switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Reply-Text", "+OK\n");
switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Socket-Mode", switch_test_flag(listener, LFLAG_ASYNC) ? "async" : "static");
@@ -597,6 +597,10 @@ SWITCH_STANDARD_API(show_local_stream_function)
}
}
if (!local_stream_name) {
goto usage;
}
source = switch_core_hash_find(globals.source_hash, local_stream_name);
if (source) {
if (xml) {
+1 -1
View File
@@ -712,7 +712,7 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
context->stream_url = switch_core_sprintf(context->memory_pool, "http://%s", path);
context->prebuf = handle->prebuf;
launch_read_stream_thread(context);
while((switch_buffer_inuse(context->audio_buffer) < 1*2*context->samplerate) && ++sanity < 10) {
while((switch_buffer_inuse(context->audio_buffer) < (switch_size_t)(2 * context->samplerate)) && ++sanity < 10) {
/* at least 1s of audio and up to 5s initialize */
switch_yield(500000);
}