[mod_sofia] Fix dead nested assignments

This commit is contained in:
Andrey Volk 2022-01-08 12:09:53 +03:00
parent 884917cb11
commit 19a7debc1b
5 changed files with 14 additions and 20 deletions

View File

@ -918,7 +918,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
}
if (sofia_test_flag(tech_pvt, TFLAG_NAT) ||
(val = switch_channel_get_variable(channel, "sip-force-contact")) ||
switch_channel_get_variable(channel, "sip-force-contact") ||
((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
sticky = tech_pvt->record_route;
session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
@ -2615,7 +2615,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
if (sofia_test_flag(tech_pvt, TFLAG_NAT) ||
(val = switch_channel_get_variable(channel, "sip-force-contact")) ||
switch_channel_get_variable(channel, "sip-force-contact") ||
((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
sticky = tech_pvt->record_route;
switch_channel_set_variable(channel, "sip_nat_detected", "true");
@ -4389,7 +4389,6 @@ SWITCH_STANDARD_API(sofia_gateway_data_function)
{
char *argv[4];
char *mydata;
int argc;
sofia_gateway_t *gateway;
char *gwname, *param, *varname;
const char *val = NULL;
@ -4402,7 +4401,7 @@ SWITCH_STANDARD_API(sofia_gateway_data_function)
return SWITCH_STATUS_FALSE;
}
if (!(argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || !argv[0]) {
if (!switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) || !argv[0]) {
goto end;
}
@ -4679,7 +4678,7 @@ static int protect_dest_uri(switch_caller_profile_t *cp)
switch_size_t enclen = 0;
int mod = 0;
if (!(e = strchr(p, '@'))) {
if (!strchr(p, '@')) {
return 0;
}

View File

@ -949,11 +949,11 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
if (switch_channel_test_flag(tech_pvt->channel, CF_SLA_BARGING)) {
const char *bargee_uuid = switch_channel_get_variable(channel, "sip_barging_uuid");
switch_core_session_t *bargee_session;
uint32_t ttl = 0;
if ((bargee_session = switch_core_session_locate(bargee_uuid))) {
//switch_channel_t *bargee_channel = switch_core_session_get_channel(bargee_session);
if ((ttl = switch_core_media_bug_count(bargee_session, "eavesdrop")) == 1) {
/* Checking ttl */
if (switch_core_media_bug_count(bargee_session, "eavesdrop") == 1) {
if (switch_core_session_check_interface(bargee_session, sofia_endpoint_interface)) {
switch_channel_clear_flag(switch_core_session_get_channel(bargee_session), CF_SLA_BARGE);
}
@ -3784,7 +3784,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag,
}
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if ((gp = switch_core_hash_find(mod_sofia_globals.gateway_hash, name)) && (gp = switch_core_hash_find(mod_sofia_globals.gateway_hash, pkey)) && !gp->deleted) {
if (switch_core_hash_find(mod_sofia_globals.gateway_hash, name) && (gp = switch_core_hash_find(mod_sofia_globals.gateway_hash, pkey)) && !gp->deleted) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring duplicate gateway '%s'\n", name);
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
free(pkey);
@ -6950,7 +6950,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
}
if (sofia_test_pflag(profile, PFLAG_MANUAL_REDIRECT)) {
if (!(v = switch_channel_get_variable(channel, "outbound_redirect_info"))) {
if (!switch_channel_get_variable(channel, "outbound_redirect_info")) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirect: Transfering to %s %s %s\n",
p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context);
@ -9928,7 +9928,6 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
char *cmd = strdup(sip->sip_payload->pl_data);
char *arg;
switch_stream_handle_t stream = { 0 };
switch_status_t status;
switch_assert(cmd);
SWITCH_STANDARD_STREAM(stream);
@ -9938,7 +9937,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
*arg++ = '\0';
}
if ((status = switch_api_execute(cmd, arg, NULL, &stream)) == SWITCH_STATUS_SUCCESS) {
if (switch_api_execute(cmd, arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
nua_respond(nh, SIP_200_OK, SIPTAG_CONTENT_TYPE_STR("freeswitch/api-response"),
SIPTAG_PAYLOAD_STR(stream.data), NUTAG_WITH_THIS_MSG(de->data->e_msg),
TAG_IF(!zstr(session_id_header), SIPTAG_HEADER_STR(session_id_header)),
@ -10959,9 +10958,8 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
if (x1 == 0) {
switch_channel_set_variable(channel, "sip_req_user", argv1[0]);
} else {
int argc2 = 0;
char *argv2[2] = { 0 };
if ((argc2 = switch_separate_string(argv1[x1], '=', argv2, (sizeof(argv2) / sizeof(argv2[0])))) == 2) {
if (switch_separate_string(argv1[x1], '=', argv2, (sizeof(argv2) / sizeof(argv2[0]))) == 2) {
char *var_name = NULL;
var_name = switch_mprintf("sip_invite_%s", argv2[0]);
switch_channel_set_variable(channel, var_name, argv2[1]);

View File

@ -908,7 +908,6 @@ char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix
const char *exclude_regex = NULL;
switch_regex_t *re = NULL;
int ovector[30] = {0};
int proceed;
exclude_regex = switch_channel_get_variable(channel, "exclude_outgoing_extra_header");
SWITCH_STANDARD_STREAM(stream);
@ -922,7 +921,7 @@ char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix
}
if (!strncasecmp(name, prefix, strlen(prefix))) {
if ( !exclude_regex || !(proceed = switch_regex_perform(name, exclude_regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
if ( !exclude_regex || !(/*proceed*/ switch_regex_perform(name, exclude_regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
const char *hname = name + strlen(prefix);
stream.write_function(&stream, "%s: %s\r\n", hname, value);
switch_regex_safe_free(re);

View File

@ -71,8 +71,6 @@ switch_status_t sofia_media_activate_rtp(private_object_t *tech_pvt)
switch_status_t sofia_media_tech_media(private_object_t *tech_pvt, const char *r_sdp, switch_sdp_type_t type)
{
uint8_t match = 0;
switch_assert(tech_pvt != NULL);
switch_assert(r_sdp != NULL);
@ -80,7 +78,7 @@ switch_status_t sofia_media_tech_media(private_object_t *tech_pvt, const char *r
return SWITCH_STATUS_FALSE;
}
if ((match = sofia_media_negotiate_sdp(tech_pvt->session, r_sdp, type))) {
if (sofia_media_negotiate_sdp(tech_pvt->session, r_sdp, type)) {
if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
}

View File

@ -482,7 +482,7 @@ struct mwi_helper {
static void actual_sofia_presence_mwi_event_handler(switch_event_t *event)
{
char *account, *dup_account, *yn, *host = NULL, *user;
char *account, *dup_account, *host = NULL, *user;
char *sql;
sofia_profile_t *profile = NULL;
switch_stream_handle_t stream = { 0 };
@ -500,7 +500,7 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event)
return;
}
if (!(yn = switch_event_get_header(event, "mwi-messages-waiting"))) {
if (!switch_event_get_header(event, "mwi-messages-waiting")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required Header 'MWI-Messages-Waiting'\n");
return;
}