]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Fix dead nested assignments
authorAndrey Volk <andywolk@gmail.com>
Tue, 11 Jan 2022 16:16:53 +0000 (19:16 +0300)
committerAndrey Volk <andywolk@gmail.com>
Tue, 9 Aug 2022 20:29:31 +0000 (23:29 +0300)
21 files changed:
src/switch.c
src/switch_core.c
src/switch_core_file.c
src/switch_core_media.c
src/switch_core_media_bug.c
src/switch_core_session.c
src/switch_core_sqldb.c
src/switch_core_state_machine.c
src/switch_event.c
src/switch_ivr.c
src/switch_ivr_async.c
src/switch_ivr_bridge.c
src/switch_ivr_originate.c
src/switch_ivr_play_say.c
src/switch_loadable_module.c
src/switch_msrp.c
src/switch_rtp.c
src/switch_stun.c
src/switch_time.c
src/switch_utils.c
src/switch_xml.c

index 2f5274099e7c52def203df1fe0267f4f4e5d1a75..3ace9fb7cf55616ec9261332fcaf33eaf3ce9ea2 100644 (file)
@@ -230,7 +230,7 @@ void WINAPI service_main(DWORD numArgs, char **args)
 static int check_fd(int fd, int ms)
 {
        struct pollfd pfds[2] = { { 0 } };
-       int s, r = 0, i = 0;
+       int s, r = 0;
 
        pfds[0].fd = fd;
        pfds[0].events = POLLIN | POLLERR;
@@ -242,7 +242,7 @@ static int check_fd(int fd, int ms)
                r = -1;
 
                if ((pfds[0].revents & POLLIN)) {
-                       if ((i = read(fd, &r, sizeof(r))) > -1) {
+                       if (read(fd, &r, sizeof(r)) > -1) {
                                (void)write(fd, &r, sizeof(r));
                        }
                }
@@ -1206,9 +1206,9 @@ int main(int argc, char *argv[])
 #ifndef WIN32
        if (do_wait) {
                if (fds[1] > -1) {
-                       int i, v = 1;
+                       int v = 1;
 
-                       if ((i = write(fds[1], &v, sizeof(v))) < 0) {
+                       if (write(fds[1], &v, sizeof(v)) < 0) {
                                fprintf(stderr, "System Error [%s]\n", strerror(errno));
                        } else {
                                (void)read(fds[1], &v, sizeof(v));
index 48903eee958ecf9ea04072997d46eedbb3a07143..d1bba3fa3e49380c3b6fc9abc84fd9ad5945885c 100644 (file)
@@ -3425,7 +3425,7 @@ SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t shell, sw
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "posix_spawn is unsupported on current platform\n");
        return 1;
 #else
-       int status = 0, rval;
+       int status = 0;
        char buffer[1024];
        pid_t pid;
        char *pdata = NULL, *argv[64];
@@ -3521,7 +3521,7 @@ SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t shell, sw
                                        .revents = 0
                        };
 
-                       while ((rval = poll(pfds, 2, /*timeout*/-1)) > 0) {
+                       while (poll(pfds, 2, /*timeout*/-1) > 0) {
                                if (pfds[0].revents & POLLIN) {
                                        int bytes_read = read(cout_pipe[0], buffer, sizeof(buffer));
                                        stream->raw_write_function(stream, (unsigned char *)buffer, bytes_read);
index bc99a451ef7e2f676ad12028d31e40b009d78c34..84e6acb3c0640735973ec6a5f0dc356bb74f7071 100644 (file)
@@ -949,10 +949,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_pre_close(switch_file_handle_t
 
        if (fh->pre_buffer) {
                if (switch_test_flag(fh, SWITCH_FILE_FLAG_WRITE)) {
-                       switch_size_t rlen, blen;
+                       switch_size_t blen;
                        int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE);
 
-                       while ((rlen = switch_buffer_inuse(fh->pre_buffer))) {
+                       while (switch_buffer_inuse(fh->pre_buffer)) {
                                if ((blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen))) {
                                        if (!asis)
                                                blen /= 2;
index 347735cf1b3c78a8fefbf67eadc36fb3a15d265f..d1397a833e83cc0b3edf8c4ff4bd27b0fd621547 100644 (file)
@@ -6667,7 +6667,6 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
 
                if (switch_channel_test_flag(session->channel, CF_PROTO_HOLD)) {
                        int media_on_hold_a = switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1));
-                       int media_on_hold_b = 0;
                        int bypass_after_hold_a = 0;
                        int bypass_after_hold_b = 0;
 
@@ -6676,7 +6675,7 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
                        }
 
                        if (b_channel) {
-                               if ((media_on_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1)))) {
+                               if (switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1))) {
                                        bypass_after_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_after_hold", SWITCH_FALSE, -1));
                                }
                        }
@@ -13622,16 +13621,12 @@ SWITCH_DECLARE(void) switch_core_media_set_sdp_codec_string(switch_core_session_
 SWITCH_DECLARE(void) switch_core_media_merge_sdp_codec_string(switch_core_session_t *session, const char *r_sdp,
                                                                                                                          switch_sdp_type_t sdp_type, const char *codec_string)
 {
-
-       
-
        sdp_parser_t *parser;
        sdp_session_t *sdp;
-       switch_media_handle_t *smh;
 
        switch_assert(session);
 
-       if (!(smh = session->media_handle)) {
+       if (!session->media_handle) {
                return;
        }
 
@@ -13652,7 +13647,6 @@ SWITCH_DECLARE(void) switch_core_media_merge_sdp_codec_string(switch_core_sessio
 
                sdp_parser_free(parser);
        }
-
 }
 
 
index eca4c495d2bd34342328edc825ea2ab1f1556685..7aabceb7b784111d98e6cb6490ab94e08135ece7 100644 (file)
@@ -466,7 +466,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_patch_spy_frame(switch_med
 {
        switch_queue_t *spy_q = NULL;
        int w = 0, h = 0;
-       switch_status_t status;
        void *pop;
        int i;
 
@@ -479,7 +478,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_patch_spy_frame(switch_med
        spy_q = bug->spy_video_queue[rw];
 
        while(switch_queue_size(spy_q) > 0) {
-               if ((status = switch_queue_trypop(spy_q, &pop)) == SWITCH_STATUS_SUCCESS) {
+               if (switch_queue_trypop(spy_q, &pop) == SWITCH_STATUS_SUCCESS) {
                        switch_img_free(&bug->spy_img[rw]);
                        if (!(bug->spy_img[rw] = (switch_image_t *) pop)) {
                                break;
@@ -641,7 +640,6 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void *
        switch_core_timer_init(&timer, "soft", fps_data.ms, fps_data.samples, NULL);
 
        while (bug->ready) {
-               switch_status_t status;
                int w = 0, h = 0, ok = 1, new_main = 0, new_other = 0, new_canvas = 0;
                
                switch_core_timer_next(&timer);
@@ -657,7 +655,7 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void *
                w = vw / 2;
                h = vh;
 
-               if ((status = switch_queue_trypop(main_q, &pop)) == SWITCH_STATUS_SUCCESS) {
+               if (switch_queue_trypop(main_q, &pop) == SWITCH_STATUS_SUCCESS) {
                        switch_img_free(&img);
 
                        if (!pop) {
@@ -678,7 +676,7 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void *
                if (other_q) {
                        flush_video_queue(other_q, 1);
 
-                       if ((status = switch_queue_trypop(other_q, &other_pop)) == SWITCH_STATUS_SUCCESS) {
+                       if (switch_queue_trypop(other_q, &other_pop) == SWITCH_STATUS_SUCCESS) {
                                switch_img_free(&other_img);
                                other_img = (switch_image_t *) other_pop;
 
index 32139ac98a4f556007c159a53e62d4594b4dbae8..a590f7467c4c8ca926bb783cc60b7addeb8bcdb3 100644 (file)
@@ -526,7 +526,6 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
                                                                                                                                                 switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
 {
        switch_io_event_hook_outgoing_channel_t *ptr;
-       switch_status_t status = SWITCH_STATUS_FALSE;
        switch_endpoint_interface_t *endpoint_interface;
        switch_channel_t *channel = NULL;
        switch_caller_profile_t *outgoing_profile = caller_profile;
@@ -608,7 +607,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
 
        if (session) {
                for (ptr = session->event_hooks.outgoing_channel; ptr; ptr = ptr->next) {
-                       if ((status = ptr->outgoing_channel(session, var_event, caller_profile, *new_session, flags)) != SWITCH_STATUS_SUCCESS) {
+                       if (ptr->outgoing_channel(session, var_event, caller_profile, *new_session, flags) != SWITCH_STATUS_SUCCESS) {
                                break;
                        }
                }
@@ -1116,15 +1115,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(switch_core_
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(switch_core_session_t *session)
 {
-       switch_status_t status = SWITCH_STATUS_FALSE;
        void *pop;
        switch_core_session_message_t *message;
 
        switch_assert(session != NULL);
 
-
        if (session->message_queue) {
-               while ((status = (switch_status_t) switch_queue_trypop(session->message_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
+               while (switch_queue_trypop(session->message_queue, &pop) == SWITCH_STATUS_SUCCESS) {
                        message = (switch_core_session_message_t *) pop;
                        switch_ivr_process_indications(session, message);
                        switch_core_session_free_message(&message);
@@ -1353,19 +1350,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch
 
 SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_session_t *session)
 {
-       switch_status_t status = SWITCH_STATUS_FALSE;
        int x = 0;
        void *pop;
 
        if (session->private_event_queue) {
-               while ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue_pri, &pop)) == SWITCH_STATUS_SUCCESS) {
+               while (switch_queue_trypop(session->private_event_queue_pri, &pop) == SWITCH_STATUS_SUCCESS) {
                        if (pop) {
                                switch_event_t *event = (switch_event_t *) pop;
                                switch_event_destroy(&event);
                        }
                        x++;
                }
-               while ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
+               while (switch_queue_trypop(session->private_event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
                        if (pop) {
                                switch_event_t *event = (switch_event_t *) pop;
                                switch_event_destroy(&event);
@@ -1398,7 +1394,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_try_reset(switch_core_sessio
 SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
-       switch_size_t has;
 
        if (reset_read_codec) {
                switch_core_session_set_read_codec(session, NULL);
@@ -1425,7 +1420,7 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, s
        switch_mutex_unlock(session->codec_read_mutex);
 
        if (flush_dtmf) {
-               while ((has = switch_channel_has_dtmf(channel))) {
+               while (switch_channel_has_dtmf(channel)) {
                        switch_channel_flush_dtmf(channel);
                }
        }
@@ -1496,7 +1491,7 @@ SWITCH_DECLARE(void) switch_core_session_signal_state_change(switch_core_session
 
        if (status == SWITCH_STATUS_SUCCESS) {
                for (ptr = session->event_hooks.state_change; ptr; ptr = ptr->next) {
-                       if ((status = ptr->state_change(session)) != SWITCH_STATUS_SUCCESS) {
+                       if (ptr->state_change(session) != SWITCH_STATUS_SUCCESS) {
                                break;
                        }
                }
@@ -1608,9 +1603,8 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t *
        }
 
        if ((*session)->event_queue) {
-               switch_status_t status;
                void *pop;
-               while ((status = (switch_status_t) switch_queue_trypop((*session)->event_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
+               while (switch_queue_trypop((*session)->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
                        if (pop) {
                                switch_event_t *event = (switch_event_t *) pop;
                                switch_event_destroy(&event);
index 0f6ecd584178686b7069e9cd68d331f7aa63b157..702ee6a79c3656e03411ff3ead8468df8cc7bc9a 100644 (file)
@@ -744,7 +744,6 @@ 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;
-       switch_size_t chunk_count;
        switch_size_t len;
 
        switch_assert(chunk_size);
@@ -758,7 +757,7 @@ static switch_status_t switch_cache_db_execute_sql_chunked(switch_cache_db_handl
                return switch_cache_db_execute_sql_real(dbh, sql, err);
        }
 
-       if (!(chunk_count = strlen(sql) / chunk_size)) {
+       if (!(strlen(sql) / chunk_size)) {
                return SWITCH_STATUS_FALSE;
        }
 
@@ -878,14 +877,13 @@ SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t
                                goto end;
                        } else {
                                int running = 1;
-                               int colcount;
 
                                while (running < 5000) {
                                        int result = switch_core_db_step(stmt);
                                        const unsigned char *txt;
 
                                        if (result == SWITCH_CORE_DB_ROW) {
-                                               if ((colcount = switch_core_db_column_count(stmt)) > 0) {
+                                               if (switch_core_db_column_count(stmt) > 0) {
                                                        if ((txt = switch_core_db_column_text(stmt, 0))) {
                                                                switch_copy_string(str, (char *) txt, len);
                                                                status = SWITCH_STATUS_SUCCESS;
@@ -2244,7 +2242,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
        qm->thread_running = 1;
 
        while (qm->thread_running == 1) {
-               uint32_t i, lc;
+               uint32_t i;
                uint32_t written = 0, iterations = 0;
 
                if (qm->paused) {
@@ -2286,7 +2284,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
 
        check:
 
-               if ((lc = qm_ttl(qm)) == 0) {
+               if (qm_ttl(qm) == 0) {
                        switch_mutex_lock(qm->cond2_mutex);
                        if (qm->skip_wait > 0) {
                                qm->skip_wait--;
@@ -2299,7 +2297,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
 
                i = 40;
 
-               while (--i > 0 && (lc = qm_ttl(qm)) < 500) {
+               while (--i > 0 && qm_ttl(qm) < 500) {
                        switch_yield(5000);
                }
 
index ce47a6cd68b38ce448c9fdea1303a0241fce3ff6..b2bc14a1df697d54e6922ab802e8ea8c986a8302 100644 (file)
@@ -589,7 +589,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
 
                        if (rstatus == SWITCH_STATUS_SUCCESS) {
                                for (ptr = session->event_hooks.state_run; ptr; ptr = ptr->next) {
-                                       if ((rstatus = ptr->state_run(session)) != SWITCH_STATUS_SUCCESS) {
+                                       if (ptr->state_run(session) != SWITCH_STATUS_SUCCESS) {
                                                break;
                                        }
                                }
index a24bee012685e0a80c4b495827ddc98fd2120459..4cc60fa60c0f6cc9e85a93588952701f490427b1 100644 (file)
@@ -1723,10 +1723,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a,
                        int x = 0;
                        for (x = 0; x < var_count; x++) {
                                char *inner_var_array[2] = { 0 };
-                               int inner_var_count;
 
-                               if ((inner_var_count = switch_separate_string(var_array[x], '=',
-                                                                                                                         inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) {
+                               if (switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0]))) == 2) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Parsing variable [%s]=[%s]\n", inner_var_array[0], inner_var_array[1]);
                                        switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]);
                                }
index ddd3a8e529734073523d51c6d61bc49cacb1ad4f..77d957fb7c4b46cc3e65311cd8ae98504289c293 100644 (file)
@@ -2135,10 +2135,9 @@ SWITCH_DECLARE(void) switch_ivr_bg_media(const char *uuid, switch_media_flag_t f
 SWITCH_DECLARE(void) switch_ivr_check_hold(switch_core_session_t *session)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
-       switch_media_flow_t flow;
 
        if (switch_channel_test_flag(channel, CF_ANSWERED) && switch_channel_test_cap(channel, CC_MUTE_VIA_MEDIA_STREAM) &&
-               (flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO)) != SWITCH_MEDIA_FLOW_SENDRECV) {
+               switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO) != SWITCH_MEDIA_FLOW_SENDRECV) {
                switch_core_session_message_t msg = { 0 };
 
                msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA_RENEG;
index 707f8672ddaf17e1393b1fd72f016ebe4df6a9f3..6dfdcf7248a94b76fc97e54cb095d6fdec97caea 100644 (file)
@@ -1020,7 +1020,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_
                return SWITCH_STATUS_FALSE;
        }
 
-       if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
+       if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_FALSE;
        }
 
@@ -2944,7 +2944,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess
                hangup_on_error = switch_true(p);
        }
 
-       if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
+       if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_FALSE;
        }
 
@@ -3803,7 +3803,6 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da
        switch_inband_dtmf_t *pvt = (switch_inband_dtmf_t *) user_data;
        switch_frame_t *frame = NULL;
        switch_channel_t *channel = switch_core_session_get_channel(pvt->session);
-       teletone_hit_type_t hit;
 
        switch (type) {
        case SWITCH_ABC_TYPE_INIT:
@@ -3812,7 +3811,7 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da
                break;
        case SWITCH_ABC_TYPE_READ_REPLACE:
                if ((frame = switch_core_media_bug_get_read_replace_frame(bug))) {
-                       if ((hit = teletone_dtmf_detect(&pvt->dtmf_detect, frame->data, frame->samples)) == TT_HIT_END) {
+                       if (teletone_dtmf_detect(&pvt->dtmf_detect, frame->data, frame->samples) == TT_HIT_END) {
                                switch_dtmf_t dtmf = {0};
 
                                teletone_dtmf_get(&pvt->dtmf_detect, &dtmf.digit, &dtmf.duration);
@@ -5457,7 +5456,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
                                                                                                                 const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
-       switch_status_t status;
        struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
        const char *p;
        int resume = 0;
@@ -5465,7 +5463,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
 
        if (!sth) {
                /* No speech thread handle available yet, init speech detection first. */
-               if ((status = switch_ivr_detect_speech_init(session, mod_name, dest, ah)) != SWITCH_STATUS_SUCCESS) {
+               if (switch_ivr_detect_speech_init(session, mod_name, dest, ah) != SWITCH_STATUS_SUCCESS) {
                        return SWITCH_STATUS_NOT_INITALIZED;
                }
 
index 3e5e2145be510f2a4b7a14d73c8f0e57d55a0f86..f91fc2c69f3ff49107d6d21920c42fd2856770e8 100644 (file)
@@ -507,7 +507,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
 
 
        for (;;) {
-               switch_channel_state_t b_state;
                switch_status_t status;
                switch_event_t *event;
 
@@ -543,7 +542,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
                        goto end_of_bridge_loop;
                }
 
-               if ((b_state = switch_channel_down_nosig(chan_b))) {
+               if (switch_channel_down_nosig(chan_b)) {
                        goto end_of_bridge_loop;
                }
 
@@ -953,14 +952,13 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
 
 static void transfer_after_bridge(switch_core_session_t *session, const char *where)
 {
-       int argc;
        char *argv[4] = { 0 };
        char *mydata;
 
        switch_channel_set_variable(switch_core_session_get_channel(session), SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, NULL);
 
        if (!zstr(where) && (mydata = switch_core_session_strdup(session, where))) {
-               if ((argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
+               if (switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) {
                        switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
                } else {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No extension specified.\n");
index 627f43ead695d3104c41129f4d600578c193c910..c4f4bfa2b240698c3aeee831db54346ecedfa6e0 100644 (file)
@@ -2532,12 +2532,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                oglobals.ignore_ring_ready = 1;
        }
 
-       if ((var_val = switch_event_get_header(var_event, "monitor_early_media_ring"))) {
+       if ((var_val = switch_event_get_header(var_event, "monitor_early_media_ring")) && switch_true(var_val)) {
                oglobals.early_ok = 0;
                oglobals.monitor_early_media_ring = 1;
        }
 
-       if ((var_val = switch_event_get_header(var_event, "monitor_early_media_fail"))) {
+       if ((var_val = switch_event_get_header(var_event, "monitor_early_media_fail")) && switch_true(var_val)) {
                oglobals.early_ok = 0;
                oglobals.monitor_early_media_fail = 1;
        }
index 1cd4c623df15f0ab4e55296ed9ed5444804dcbd8..25486eee7fe4a1bc4d87c07e087df9f02232176b 100644 (file)
@@ -1375,7 +1375,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
 
                status = SWITCH_STATUS_SUCCESS;
 
-               if ((alt = strchr(file, ':'))) {
+               if (strchr(file, ':')) {
                        char *dup;
 
                        if (!strncasecmp(file, "phrase:", 7)) {
index 5442cca03a0416c5216183c327ca2fc4f0714649..439b8d0c19b2c62ec094942695b35be0486c4865 100644 (file)
@@ -3191,12 +3191,11 @@ SWITCH_DECLARE(switch_status_t) switch_say_file_handle_create(switch_say_file_ha
 SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *fmt, ...)
 {
        char buf[256] = "";
-       int ret;
        va_list ap;
 
        va_start(ap, fmt);
 
-       if ((ret = switch_vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) {
+       if (switch_vsnprintf(buf, sizeof(buf), fmt, ap) > 0) {
                if (!sh->cnt++) {
                        sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext);
                } else if (strstr(buf, "://")) {
@@ -3204,7 +3203,6 @@ SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *f
                } else {
                        sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext);
                }
-
        }
 
        va_end(ap);
index b76a043261959c57c13f8d6c219acc23c2aefbd8..1f5db7ac2012e3b6f4c43ea287c3a9d3771fe23b 100644 (file)
@@ -1425,7 +1425,6 @@ end:
 static void *SWITCH_THREAD_FUNC msrp_listener(switch_thread_t *thread, void *obj)
 {
        switch_msrp_socket_t *msock = (switch_msrp_socket_t *)obj;
-       switch_status_t rv;
        switch_memory_pool_t *pool = NULL;
        switch_threadattr_t *thd_attr = NULL;
        switch_socket_t *sock = NULL;
@@ -1440,7 +1439,7 @@ static void *SWITCH_THREAD_FUNC msrp_listener(switch_thread_t *thread, void *obj
        switch_socket_opt_set(msock->sock, SWITCH_SO_TCP_NODELAY, TRUE);
        // switch_socket_opt_set(msock->sock, SWITCH_SO_NONBLOCK, TRUE);
 
-       while (globals.running && (rv = switch_socket_accept(&sock, msock->sock, pool)) == SWITCH_STATUS_SUCCESS) {
+       while (globals.running && switch_socket_accept(&sock, msock->sock, pool) == SWITCH_STATUS_SUCCESS) {
                switch_memory_pool_t *worker_pool;
                worker_helper_t *helper;
 
index 5f4ce0f738f29db15e1c015510140bc35b1a77ec..f0be8db97bd13be56a6f6912bb2ea087cf3cb797 100644 (file)
@@ -8780,8 +8780,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
                                switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET);
                                srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]);
                                rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL;
-                               if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp],
-                                                                               &rtp_session->send_policy[rtp_session->srtp_idx_rtp])) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) {
+                               if (srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp],
+                                                                               &rtp_session->send_policy[rtp_session->srtp_idx_rtp]) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR,
                                                                          "Error! RE-Activating %s Secure RTP SEND\n", rtp_type(rtp_session));
                                        rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND] = 0;
@@ -9376,8 +9376,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session,
                                switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET);
                                srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]);
                                rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL;
-                               if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp],
-                                                                               &rtp_session->send_policy[rtp_session->srtp_idx_rtp])) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) {
+                               if (srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp],
+                                                                               &rtp_session->send_policy[rtp_session->srtp_idx_rtp]) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP SEND\n");
                                        rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND] = 0;
                                        status = SWITCH_STATUS_FALSE;
index 6149ac3dc3ea27dd0c807f2bdb9ff6c729377a3f..b0ff45b3dcf696a411232933e494959c3821929b 100644 (file)
@@ -717,7 +717,6 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
        char rip[50] = { 0 };
        uint16_t rport = 0;
        switch_time_t started = 0;
-       unsigned int elapsed = 0;
        int funny = 0;
        int size = sizeof(buf);
        int xlen = sizeof(switch_stun_packet_header_t);
@@ -787,7 +786,7 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
                        break;
                }
 
-               if ((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > 5000) {
+               if (((unsigned int)((switch_micro_time_now() - started) / 1000)) > 5000) {
                        *err = "Timeout";
                        switch_socket_shutdown(sock, SWITCH_SHUTDOWN_READWRITE);
                        switch_socket_close(sock);
index 182d9ad6bdf6d1e0e332f199e794f035e5e09e97..39ad4bb597d8b8cbf7c6290fb54beffc15d70474 100644 (file)
@@ -413,7 +413,7 @@ typedef struct interval_timer interval_timer_t;
 static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval)
 {
        struct itimerspec val;
-       int fd, r;
+       int fd;
        uint64_t exp;
 
        fd = timerfd_create(CLOCK_MONOTONIC, 0);
@@ -432,7 +432,7 @@ static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval
                return SWITCH_STATUS_GENERR;
        }
 
-       if ((r = read(fd, &exp, sizeof(exp))) < 0) {
+       if (read(fd, &exp, sizeof(exp)) < 0) {
                close(fd);
                return SWITCH_STATUS_GENERR;
        }
index 1a9341148974cd508f2bbd833470bdd00dfb3dc5..d8b830943a9cf9a15733019da88570febcdfc520 100644 (file)
@@ -1142,7 +1142,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
        }
 
        if (!zstr(file) && !zstr(convert_cmd) && !zstr(convert_ext)) {
-               if ((ext = strrchr(file, '.'))) {
+               if (strrchr(file, '.')) {
                        dupfile = strdup(file);
                        if ((ext = strrchr(dupfile, '.'))) {
                                *ext++ = '\0';
@@ -1820,9 +1820,8 @@ SWITCH_DECLARE(switch_status_t) switch_resolve_host(const char *host, char *buf,
 {
 
        struct addrinfo *ai;
-       int err;
 
-       if ((err = getaddrinfo(host, 0, 0, &ai))) {
+       if (getaddrinfo(host, 0, 0, &ai)) {
                return SWITCH_STATUS_FALSE;
        }
 
index 6467758b7232d14be91c5de716022f1ab42b95f9..1a3ecef9b6dd08b168f97d87f15a56c1ac2db184 100644 (file)
@@ -1257,7 +1257,7 @@ static char *expand_vars(char *buf, char *ebuf, switch_size_t elen, switch_size_
        char *wp = ebuf;
        char *ep = ebuf + elen - 1;
 
-       if (!(var = strstr(rp, "$${"))) {
+       if (!strstr(rp, "$${")) {
                *newlen = strlen(buf);
                return buf;
        }