]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core,miniupnpc,modules] Fix not used variables 2140/head
authorJakub Karolczyk <jakub.karolczyk@signalwire.com>
Tue, 4 Jul 2023 09:12:44 +0000 (10:12 +0100)
committerJakub Karolczyk <jakub.karolczyk@signalwire.com>
Tue, 4 Jul 2023 09:18:16 +0000 (10:18 +0100)
16 files changed:
libs/miniupnpc/miniupnpc.c
src/mod/applications/mod_conference/conference_api.c
src/mod/applications/mod_conference/conference_cdr.c
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/endpoints/mod_verto/mod_verto.c
src/mod/event_handlers/mod_event_socket/mod_event_socket.c
src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
src/switch_core_media.c
src/switch_event.c
src/switch_ivr_play_say.c
src/switch_loadable_module.c
src/switch_rtp.c
src/switch_time.c
src/switch_utils.c

index 88faea1c3793046db2a5d5d483a394b931a1aa1d..a72ef892b6cc8fd80d3b7856ea79410c932740a4 100644 (file)
@@ -679,7 +679,6 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
        char * descXML;
        int descXMLsize = 0;
        struct UPNPDev * dev;
-       int ndev = 0;
        int state; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */
        if(!devlist)
        {
@@ -698,7 +697,6 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
                                                        lanaddr, lanaddrlen);
                        if(descXML)
                        {
-                               ndev++;
                                memset(data, 0, sizeof(struct IGDdatas));
                                memset(urls, 0, sizeof(struct UPNPUrls));
                                parserootdesc(descXML, descXMLsize, data);
index 8bcfc5862fb860c002a3d9f27e1829fb237dee0b..7e566367fbaa424f8bc04e1956ad5e9d33c8e593 100644 (file)
@@ -4087,7 +4087,6 @@ switch_status_t conference_api_sub_set(conference_obj_t *conference,
 
 switch_status_t conference_api_sub_xml_list(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
 {
-       int count = 0;
        switch_hash_index_t *hi;
        void *val;
        switch_xml_t x_conference, x_conferences;
@@ -4106,7 +4105,6 @@ switch_status_t conference_api_sub_xml_list(conference_obj_t *conference, switch
                        x_conference = switch_xml_add_child_d(x_conferences, "conference", off++);
                        switch_assert(conference);
 
-                       count++;
                        conference_xlist(conference, x_conference, off);
 
                }
@@ -4114,7 +4112,7 @@ switch_status_t conference_api_sub_xml_list(conference_obj_t *conference, switch
        } else {
                x_conference = switch_xml_add_child_d(x_conferences, "conference", off++);
                switch_assert(conference);
-               count++;
+
                conference_xlist(conference, x_conference, off);
        }
 
index f7ed7ddf27eb90aebf27a27aaa1c710062ef4e70..9f2ccba63cb92da5ba606365a2a233c3ecd95dfa 100644 (file)
@@ -740,7 +740,7 @@ void conference_cdr_render(conference_obj_t *conference)
 #endif
                                int wrote;
                                wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
-                               wrote++;
+                               (void)wrote;
                                close(fd);
                        } else {
                                char ebuf[512] = { 0 };
index e91ec53d47de18ecd40309d10e166a2f3b2f3024..f52b1184e565831f79c1c024f64cd95439f1cbc9 100644 (file)
@@ -161,7 +161,6 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
        char *string = NULL;
        switch_channel_t *channel;
        switch_core_session_t *use_session = act->session;
-       int x = 0;
        char *flags = "";
 
        if (act->target == DIGIT_TARGET_PEER || act->target == DIGIT_TARGET_BOTH) {
@@ -171,7 +170,6 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
        }
 
  top:
-       x++;
 
        string = switch_core_session_strdup(use_session, act->string);
        exec = 0;
index 2fdf0063a9f117b53c4a43fe9c49b7fccf589d78..9cd447ef71a01d64d2cb9b626d6ab9a85e4c1efd 100644 (file)
@@ -3255,8 +3255,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
        switch_hash_index_t *hi;
        void *val;
        const void *vvar;
-       int c = 0;
-       int ac = 0;
        const char *header = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
 
        if (argc > 0) {
@@ -3466,7 +3464,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
                if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
 
                        if (strcmp(vvar, profile->name)) {
-                               ac++;
                                stream->write_function(stream, "<alias>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</alias>\n", vvar, "alias",
                                                                           profile->name, "ALIASED");
                        } else {
@@ -3492,8 +3489,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
                                                                           profile->inuse);
                                }
 
-                               c++;
-
                                for (gp = profile->gateways; gp; gp = gp->next) {
                                        switch_assert(gp->state < REG_STATE_LAST);
                                        stream->write_function(stream, "<gateway>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</gateway>\n",
index b8576ae7f563410080d40b38d3de7b82b1193911..579cea83e28971f57ab026fedc9de6a3504ed418 100644 (file)
@@ -1621,7 +1621,6 @@ void *SWITCH_THREAD_FUNC sofia_presence_event_thread_run(switch_thread_t *thread
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Event Thread Started\n");
 
        while (mod_sofia_globals.running == 1) {
-               int count = 0;
 
                if (switch_queue_pop(mod_sofia_globals.presence_queue, &pop) == SWITCH_STATUS_SUCCESS) {
                        switch_event_t *event = (switch_event_t *) pop;
@@ -1656,7 +1655,6 @@ void *SWITCH_THREAD_FUNC sofia_presence_event_thread_run(switch_thread_t *thread
                        }
 
                        switch_event_destroy(&event);
-                       count++;
                }
        }
 
index 8920de7e02cb5312ab9d5ed3ccdcb9a708f975a1..6d49fc022b0df5048c9a0e60aaba2bca08c5ff1a 100644 (file)
@@ -823,7 +823,6 @@ static void set_perm(const char *str, switch_event_t **event, switch_bool_t add)
 {
        char delim = ',';
        char *cur, *next;
-       int count = 0;
        char *edup;
 
        if (!zstr(str)) {
@@ -844,7 +843,7 @@ static void set_perm(const char *str, switch_event_t **event, switch_bool_t add)
                        delim = ' ';
                }
 
-               for (cur = edup; cur; count++) {
+               for (cur = edup; cur;) {
                        if ((next = strchr(cur, delim))) {
                                *next++ = '\0';
                        }
@@ -5579,8 +5578,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
 {
        verto_profile_t *profile = NULL;
        jsock_t *jsock;
-       int cp = 0;
-       int cc = 0;
        const char *header = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
        int i;
 
@@ -5594,14 +5591,12 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
                        stream->write_function(stream, "<profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</profile>\n", profile->name, "profile", tmpurl, (profile->running) ? "RUNNING" : "DOWN");
                        switch_safe_free(tmpurl);
                }
-               cp++;
 
                switch_mutex_lock(profile->mutex);
                for(jsock = profile->jsock_head; jsock; jsock = jsock->next) {
                        char *tmpname = switch_mprintf("%s@%s", jsock->id, jsock->domain);
                        stream->write_function(stream, "<client>\n<profile>%s</profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s (%s)</state>\n</client>\n", profile->name, tmpname, "client", jsock->name,
                                                                         (!zstr(jsock->uid)) ? "CONN_REG" : "CONN_NO_REG",  (jsock->ptype & PTYPE_CLIENT_SSL) ? "WSS": "WS");
-                       cc++;
                        switch_safe_free(tmpname);
                }
                switch_mutex_unlock(profile->mutex);
index 70331a95e288a3d4d8942c8359525d7dddda1131..520bd92ac7ab87f9201e7a45ccb8dd620b6e018c 100644 (file)
@@ -866,7 +866,7 @@ SWITCH_STANDARD_API(event_sink_function)
                char *loglevel = switch_event_get_header(stream->param_event, "loglevel");
                switch_memory_pool_t *pool;
                char *next, *cur;
-               uint32_t count = 0, key_count = 0;
+               uint32_t key_count = 0;
                uint8_t custom = 0;
                char *edup;
 
@@ -925,7 +925,7 @@ SWITCH_STANDARD_API(event_sink_function)
                                delim = ' ';
                        }
 
-                       for (cur = edup; cur; count++) {
+                       for (cur = edup; cur;) {
                                switch_event_types_t type;
 
                                if ((next = strchr(cur, delim))) {
@@ -1846,7 +1846,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                                if (allowed_events) {
                                        char delim = ',';
                                        char *cur, *next;
-                                       int count = 0, custom = 0, key_count = 0;
+                                       int custom = 0;
 
                                        switch_set_flag(listener, LFLAG_AUTH_EVENTS);
 
@@ -1862,7 +1862,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                                                delim = ' ';
                                        }
 
-                                       for (cur = edup; cur; count++) {
+                                       for (cur = edup; cur;) {
                                                switch_event_types_t type;
 
                                                if ((next = strchr(cur, delim))) {
@@ -1872,7 +1872,6 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                                                if (custom) {
                                                        switch_core_hash_insert(listener->allowed_event_hash, cur, MARKER);
                                                } else if (switch_name_event(cur, &type) == SWITCH_STATUS_SUCCESS) {
-                                                       key_count++;
                                                        if (type == SWITCH_EVENT_ALL) {
                                                                uint32_t x = 0;
                                                                switch_set_flag(listener, LFLAG_ALL_EVENTS_AUTHED);
@@ -1904,7 +1903,6 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                                if (allowed_api) {
                                        char delim = ',';
                                        char *cur, *next;
-                                       int count = 0;
 
                                        switch_snprintf(api_reply, sizeof(api_reply), "Allowed-API: %s\n", allowed_api);
 
@@ -1916,7 +1914,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                                                delim = ' ';
                                        }
 
-                                       for (cur = edup; cur; count++) {
+                                       for (cur = edup; cur;) {
                                                if ((next = strchr(cur, delim))) {
                                                        *next++ = '\0';
                                                }
@@ -2540,14 +2538,14 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
 
        } else if (!strncasecmp(cmd, "nixevent", 8)) {
                char *next, *cur;
-               uint32_t count = 0, key_count = 0;
+               uint32_t key_count = 0;
                uint8_t custom = 0;
 
                strip_cr(cmd);
                cur = cmd + 8;
 
                if ((cur = strchr(cur, ' '))) {
-                       for (cur++; cur; count++) {
+                       for (cur++; cur;) {
                                switch_event_types_t type;
 
                                if ((next = strchr(cur, ' '))) {
index 4e3bd81f784de7f82d22ea2821ff4ad1768e5806..f8c98f63923ab675a0a1461c55ba775f98628840 100644 (file)
@@ -254,7 +254,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
 #endif
                                int wrote;
                                wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
-                               wrote++;
+                               (void)wrote;
                                close(fd);
                        } else {
                                char ebuf[512] = { 0 };
@@ -427,7 +427,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
 #endif
                                int wrote;
                                wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
-                               wrote++;
+                               (void)wrote;
                                close(fd);
                        } else {
                                char ebuf[512] = { 0 };
index 60cc3d531c27322d04367850f19c6e0ab3ecc8d0..e75387581d0ef4113a181b62c67bb0f59cb98d6c 100644 (file)
@@ -4762,7 +4762,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
        switch_channel_t *channel = switch_core_session_get_channel(session);
        const char *val;
        const char *crypto = NULL;
-       int got_crypto = 0, got_video_crypto = 0, got_audio = 0, saw_audio = 0, saw_video = 0, got_avp = 0, got_video_avp = 0, got_video_savp = 0, got_savp = 0, got_udptl = 0, got_webrtc = 0, got_text = 0, got_text_crypto = 0, got_msrp = 0;
+       int got_crypto = 0, got_video_crypto = 0, got_audio = 0, saw_audio = 0, saw_video = 0, got_avp = 0, got_savp = 0, got_udptl = 0, got_webrtc = 0, got_text = 0, got_text_crypto = 0, got_msrp = 0;
        int scrooge = 0;
        sdp_parser_t *parser = NULL;
        sdp_session_t *sdp;
@@ -4958,14 +4958,10 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                if (m->m_proto == sdp_proto_srtp || m->m_proto == sdp_proto_extended_srtp) {
                        if (m->m_type == sdp_media_audio) {
                                got_savp++;
-                       } else {
-                               got_video_savp++;
                        }
                } else if (m->m_proto == sdp_proto_rtp) {
                        if (m->m_type == sdp_media_audio) {
                                got_avp++;
-                       } else {
-                               got_video_avp++;
                        }
                } else if (m->m_proto == sdp_proto_udptl) {
                        got_udptl++;
@@ -7406,7 +7402,7 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
        switch_status_t status;
        switch_frame_t *read_frame = NULL;
        switch_media_handle_t *smh;
-       uint32_t loops = 0, xloops = 0, vloops = 0;
+       uint32_t loops = 0, xloops = 0;
        switch_image_t *blank_img = NULL;
        switch_frame_t fr = { 0 };
        unsigned char *buf = NULL;
@@ -7531,8 +7527,6 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
                        continue;
                }
 
-               vloops++;
-
                send_blank = blank_enabled || switch_channel_test_flag(channel, CF_VIDEO_ECHO);
 
                if (switch_channel_test_flag(channel, CF_VIDEO_READY) && !switch_test_flag(read_frame, SFF_CNG)) {
@@ -14243,7 +14237,7 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
        switch_size_t len;
        const char *i;
        char *o;
-       int in_m = 0, m_tally = 0, slash = 0;
+       int in_m = 0, slash = 0;
        int number = 0, skip = 0;
        int remove = !strcasecmp(cmd, "remove");
        int only = !strcasecmp(cmd, "only");
@@ -14277,7 +14271,6 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
 
                if (*i == 'm' && *(i+1) == '=') {
                        in_m = 1;
-                       m_tally++;
                }
 
                if (in_m) {
@@ -14981,7 +14974,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
 {
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_io_event_hook_video_read_frame_t *ptr;
-       uint32_t loops = 0;
        switch_media_handle_t *smh;
        int is_keyframe = 0;
 
@@ -14993,8 +14985,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
 
  top:
 
-       loops++;
-
        if (switch_channel_down_nosig(session->channel)) {
                return SWITCH_STATUS_FALSE;
        }
index be49f2fc14579b575f430f5caa50f0854ce7ea44..272255d31c41e5873f9389a581b8a4d8ea81ea84 100644 (file)
@@ -651,7 +651,6 @@ SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max)
 {
        switch_threadattr_t *thd_attr;
        uint32_t index = 0;
-       int launched = 0;
        uint32_t sanity = 200;
 
        switch_memory_pool_t *pool = RUNTIME_POOL;
@@ -682,7 +681,6 @@ SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max)
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Create additional event dispatch thread %d\n", index);
                }
-               launched++;
        }
 
        SOFT_MAX_DISPATCH = index;
index 25486eee7fe4a1bc4d87c07e087df9f02232176b..33f3a4e51abbb989c9619cbb2e8054eaea947cca 100644 (file)
@@ -1271,7 +1271,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
        int sleep_val_i = 250;
        int eof = 0;
        switch_size_t bread = 0;
-       int l16 = 0;
        switch_codec_implementation_t read_impl = { 0 };
        char *file_dup;
        char *argv[128] = { 0 };
@@ -1334,10 +1333,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
 
        arg_recursion_check_start(args);
 
-       if (!zstr(read_impl.iananame) && !strcasecmp(read_impl.iananame, "l16")) {
-               l16++;
-       }
-
        if (play_delimiter) {
                file_dup = switch_core_session_strdup(session, file);
                argc = switch_separate_string(file_dup, play_delimiter, argv, (sizeof(argv) / sizeof(argv[0])));
index f782e89f6ebc3915078cd7e57235e9e5ec98f693..bacd2f012afad9ae8f4894f5752c318840a6fe3d 100644 (file)
@@ -115,12 +115,11 @@ static void *SWITCH_THREAD_FUNC switch_loadable_module_exec(switch_thread_t *thr
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        switch_core_thread_session_t *ts = obj;
        switch_loadable_module_t *module = ts->objs[0];
-       int restarts;
 
        switch_assert(thread != NULL);
        switch_assert(module != NULL);
 
-       for (restarts = 0; status != SWITCH_STATUS_TERM && !module->shutting_down; restarts++) {
+       while (status != SWITCH_STATUS_TERM && !module->shutting_down) {
                status = module->switch_module_runtime();
        }
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Thread ended for %s\n", module->module_interface->module_name);
index 05b0858313fc468a48843aef6adb003a938166a2..40c913e2b98925511520fda3ffb35f1c5e4c7016 100644 (file)
@@ -5494,7 +5494,6 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
 {
        int was_blocking = 0;
        switch_size_t bytes;
-       uint32_t flushed = 0;
        switch_size_t bytes_out = 0;
 
        if (!switch_rtp_ready(rtp_session)) {
@@ -5576,8 +5575,6 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
 #endif
                                        }
 
-                                       flushed++;
-
                                        rtp_session->stats.inbound.raw_bytes += bytes;
                                        rtp_session->stats.inbound.flush_packet_count++;
                                        rtp_session->stats.inbound.packet_count++;
index 445e698f9b71899fa3fa1527fc1710422ae11920..a56c5e96f1fc44895d754ef95827f134a8c41b1b 100644 (file)
@@ -1173,9 +1173,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
                        } else {
                                if (tfd > -1 && globals.RUNNING == 1) {
                                        uint64_t exp;
-                                       int r;
-                                       r = read(tfd, &exp, sizeof(exp));
-                                       r++;
+                                       read(tfd, &exp, sizeof(exp));
+                                       (void)exp;
                                } else {
                                        switch_time_t timediff = runtime.reference - ts;
 
index d8b830943a9cf9a15733019da88570febcdfc520..332137ebdae0ebe1060652ae2e457b0e7d682ef2 100644 (file)
@@ -139,13 +139,10 @@ struct switch_frame_buffer_s {
 static switch_frame_t *find_free_frame(switch_frame_buffer_t *fb, switch_frame_t *orig)
 {
        switch_frame_node_t *np;
-       int x = 0;
 
        switch_mutex_lock(fb->mutex);
 
        for (np = fb->head; np; np = np->next) {
-               x++;
-
                if (!np->inuse && ((orig->packet && np->frame->packet) || (!orig->packet && !np->frame->packet))) {
 
                        if (np == fb->head) {