From 304d5004a695650e4328d0b4900f7f03b708e2b3 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 17 Dec 2007 23:19:10 +0000 Subject: [PATCH] varname scope un-masking and fix a check git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6845 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_ivr.c | 5 ++--- src/switch_rtp.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 693f0fb8ef..52a9e6a602 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1063,7 +1063,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit { switch_status_t status = SWITCH_STATUS_FALSE; - if (stream == NULL && stream->digits != NULL) { + if (stream && stream->digits != NULL) { free(stream->digits); stream->digits = NULL; status = SWITCH_STATUS_SUCCESS; @@ -1379,8 +1379,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_ switch_caller_profile_t *cp = NULL; int i_off = 0; for (cp = caller_profile->caller_extension->children; cp; cp = cp->next) { - switch_caller_application_t *ap; - int app_off = 0; + app_off = 0; if (!cp->caller_extension) { continue; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c6a49a5d57..521025a446 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -240,14 +240,14 @@ static void handle_ice(switch_rtp_t *rtp_session, void *data, switch_size_t len) } while (switch_stun_packet_next_attribute(attr)); if ((packet->header.type == SWITCH_STUN_BINDING_REQUEST) && !strcmp(rtp_session->user_ice, username)) { - uint8_t buf[512]; + uint8_t stunbuf[512]; switch_stun_packet_t *rpacket; const char *remote_ip; switch_size_t bytes; char ipbuf[25]; - memset(buf, 0, sizeof(buf)); - rpacket = switch_stun_packet_build_header(SWITCH_STUN_BINDING_RESPONSE, packet->header.id, buf); + memset(stunbuf, 0, sizeof(stunbuf)); + rpacket = switch_stun_packet_build_header(SWITCH_STUN_BINDING_RESPONSE, packet->header.id, stunbuf); switch_stun_packet_attribute_add_username(rpacket, username, 32); remote_ip = switch_get_addr(ipbuf, sizeof(ipbuf), rtp_session->from_addr); switch_stun_packet_attribute_add_binded_address(rpacket, (char *)remote_ip, switch_sockaddr_get_port(rtp_session->from_addr)); @@ -931,10 +931,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTO_CNG) && rtp_session->timer.samplecount >= (rtp_session->last_write_samplecount + (rtp_session->samples_per_interval * 50))) { uint8_t data[2] = { 0 }; - switch_frame_flag_t flags = SFF_NONE; + switch_frame_flag_t frame_flags = SFF_NONE; data[0] = 65; rtp_session->cn++; - rtp_common_write(rtp_session, (void *) data, sizeof(data), rtp_session->cng_pt, &flags); + rtp_common_write(rtp_session, (void *) data, sizeof(data), rtp_session->cng_pt, &frame_flags); } } @@ -1315,7 +1315,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data if (fwd) { bytes = datalen; send_msg = (rtp_msg_t *) data; - if (*flags & SFF_RFC2833) { + if (flags && *flags & SFF_RFC2833) { send_msg->header.pt = rtp_session->te; } } else { @@ -1367,7 +1367,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data int16_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE / sizeof(int16_t)] = {0}; uint32_t rate = 0; - uint32_t flags = 0; + uint32_t codec_flags = 0; uint32_t len = sizeof(decoded); time_t now = time(NULL); send = 0; @@ -1383,7 +1383,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data data, datalen, rtp_session->vad_data.read_codec->implementation->actual_samples_per_second, - decoded, &len, &rate, &flags) == SWITCH_STATUS_SUCCESS) { + decoded, &len, &rate, &codec_flags) == SWITCH_STATUS_SUCCESS) { uint32_t energy = 0;