From ba7dc9fde83d12b534288f407fea120fe89ddccb Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 22:49:41 -0400 Subject: [PATCH] Fix for -Wunused-but-set-variable required compiler. : mod_freetdm mod_avmd mod_cidlookup mod_ladspa mod_lcr mod_nibblebill mod_rss mod_vdm mod_dahdi_codec mod_skinny mod_cdr_pg_csv --- libs/freetdm/mod_freetdm/mod_freetdm.c | 3 +-- src/mod/applications/mod_avmd/mod_avmd.c | 4 ++-- .../applications/mod_cidlookup/mod_cidlookup.c | 3 +++ src/mod/applications/mod_ladspa/mod_ladspa.c | 3 +-- src/mod/applications/mod_lcr/mod_lcr.c | 10 ++++------ .../applications/mod_nibblebill/mod_nibblebill.c | 8 +++----- src/mod/applications/mod_rss/mod_rss.c | 4 ++-- src/mod/applications/mod_vmd/mod_vmd.c | 3 +-- src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c | 2 -- src/mod/endpoints/mod_portaudio/pablio.c | 4 +++- src/mod/endpoints/mod_skinny/mod_skinny.c | 6 ++---- src/mod/endpoints/mod_skinny/skinny_server.c | 15 +-------------- .../mod_cdr_pg_csv/mod_cdr_pg_csv.c | 2 -- 13 files changed, 23 insertions(+), 44 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 8739c4c0bf..d1a5871b09 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -720,7 +720,6 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc ftdm_size_t len; unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; ftdm_wait_flag_t wflags = FTDM_WRITE; - ftdm_status_t status; channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -755,7 +754,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc wflags = FTDM_WRITE; - status = ftdm_channel_wait(tech_pvt->ftdmchan, &wflags, ftdm_channel_get_io_interval(tech_pvt->ftdmchan) * 10); + ftdm_channel_wait(tech_pvt->ftdmchan, &wflags, ftdm_channel_get_io_interval(tech_pvt->ftdmchan) * 10); if (!(wflags & FTDM_WRITE)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Dropping frame! (write not ready)\n"); diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index 8e6f2e124d..d0c9f6e419 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -479,7 +479,7 @@ static void avmd_process(avmd_session_t *session, switch_frame_t *frame) double success = 0.0; double amp = 0.0; double s_rate; - double e_rate; +// double e_rate; double avg_a; double sine_len; uint32_t sine_len_i; @@ -523,7 +523,7 @@ static void avmd_process(avmd_session_t *session, switch_frame_t *frame) /*! Every once in a while we evaluate the desa2 and amplitude results */ if(((pos + 1) % sine_len_i) == 0){ s_rate = success / (error + success); - e_rate = error / (error + success); +// e_rate = error / (error + success); avg_a = amp / sine_len; /*! Results out of these ranges are considered invalid */ diff --git a/src/mod/applications/mod_cidlookup/mod_cidlookup.c b/src/mod/applications/mod_cidlookup/mod_cidlookup.c index 2ec41f19e4..06bf615ce5 100755 --- a/src/mod/applications/mod_cidlookup/mod_cidlookup.c +++ b/src/mod/applications/mod_cidlookup/mod_cidlookup.c @@ -729,6 +729,9 @@ SWITCH_STANDARD_APP(cidlookup_app_function) if (!session && pool) { switch_core_destroy_memory_pool(&pool); } + /* This is so compile doesn't failed because status is never used */ + if (status) { + } } SWITCH_STANDARD_API(cidlookup_function) diff --git a/src/mod/applications/mod_ladspa/mod_ladspa.c b/src/mod/applications/mod_ladspa/mod_ladspa.c index 43ea87a3ca..bab6ff5216 100644 --- a/src/mod/applications/mod_ladspa/mod_ladspa.c +++ b/src/mod/applications/mod_ladspa/mod_ladspa.c @@ -565,12 +565,11 @@ switch_status_t ladspa_session(switch_core_session_t *session, const char *flags static void ladspa_parse(switch_core_session_t *session, const char *data) { char *argv[5] = { 0 }; - int argc; char *lbuf; if (data) { lbuf = strdup(data); - argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0]))); ladspa_session(session, argv[0], argv[1], argv[2], argv[3]); free(lbuf); } diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index ac5d90871e..fcb75ef4d5 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -248,14 +248,13 @@ static char *get_bridge_data(switch_memory_pool_t *pool, char *dialed_number, ch size_t tstrip; char *data = NULL; char *destination_number = NULL; - char *orig_destination_number = NULL; char *codec = NULL; char *cid = NULL; char *header = NULL; char *user_rate = NULL; char *export_fields = NULL; - orig_destination_number = destination_number = switch_core_strdup(pool, dialed_number); + destination_number = switch_core_strdup(pool, dialed_number); tstrip = ((cur_route->digit_len - cur_route->tstrip) + 1); lstrip = cur_route->lstrip; @@ -1263,7 +1262,6 @@ static switch_call_cause_t lcr_outgoing_channel(switch_core_session_t *session, const char *intralata = NULL; switch_core_session_t *mysession = NULL; switch_channel_t *channel = NULL; - switch_caller_profile_t *caller_profile = NULL; dest = strdup(outbound_profile->destination_number); @@ -1290,7 +1288,6 @@ static switch_call_cause_t lcr_outgoing_channel(switch_core_session_t *session, timelimit = atoi(var); } routes.session = session; - caller_profile = switch_channel_get_caller_profile(channel); intrastate = switch_channel_get_variable(channel, "intrastate"); intralata = switch_channel_get_variable(channel, "intralata"); cid_name_override = switch_channel_get_variable(channel, "origination_caller_id_name"); @@ -1670,7 +1667,7 @@ SWITCH_STANDARD_API(dialplan_lcr_function) char *argv[4] = { 0 }; int argc; char *mydata = NULL; - char *dialstring = NULL; + //char *dialstring = NULL; char *lcr_profile = NULL; lcr_route current = NULL; max_obj_t maximum_lengths = { 0 }; @@ -1792,7 +1789,8 @@ SWITCH_STANDARD_API(dialplan_lcr_function) current = cb_struct.head; while (current) { - dialstring = get_bridge_data(pool, cb_struct.lookup_number, cb_struct.cid, current, cb_struct.profile, cb_struct.session); + //dialstring = + get_bridge_data(pool, cb_struct.lookup_number, cb_struct.cid, current, cb_struct.profile, cb_struct.session); rowcount++; if (as_xml) { diff --git a/src/mod/applications/mod_nibblebill/mod_nibblebill.c b/src/mod/applications/mod_nibblebill/mod_nibblebill.c index 8487d0be62..068a31f5f3 100755 --- a/src/mod/applications/mod_nibblebill/mod_nibblebill.c +++ b/src/mod/applications/mod_nibblebill/mod_nibblebill.c @@ -399,7 +399,7 @@ static switch_status_t do_billing(switch_core_session_t *session) const char *billrate; const char *billaccount; float nobal_amt = globals.nobal_amt; - float lowbal_amt = globals.lowbal_amt; + //float lowbal_amt = globals.lowbal_amt; float balance; if (!session) { @@ -421,10 +421,11 @@ static switch_status_t do_billing(switch_core_session_t *session) if (!zstr(switch_channel_get_variable(channel, "nobal_amt"))) { nobal_amt = (float)atof(switch_channel_get_variable(channel, "nobal_amt")); } + /* if (!zstr(switch_channel_get_variable(channel, "lowbal_amt"))) { lowbal_amt = (float)atof(switch_channel_get_variable(channel, "lowbal_amt")); } - + */ /* Return if there's no billing information on this session */ if (!billrate || !billaccount) { return SWITCH_STATUS_SUCCESS; @@ -802,9 +803,6 @@ SWITCH_STANDARD_API(nibblebill_api_function) if ((argc == 2 || argc == 3) && !zstr(argv[0])) { char *uuid = argv[0]; if ((psession = switch_core_session_locate(uuid))) { - switch_channel_t *channel; - channel = switch_core_session_get_channel(psession); - if (!strcasecmp(argv[1], "adjust") && argc == 3) { nibblebill_adjust(psession, (float) atof(argv[2])); } else if (!strcasecmp(argv[1], "flush")) { diff --git a/src/mod/applications/mod_rss/mod_rss.c b/src/mod/applications/mod_rss/mod_rss.c index b85d86bb99..073b471bb4 100644 --- a/src/mod/applications/mod_rss/mod_rss.c +++ b/src/mod/applications/mod_rss/mod_rss.c @@ -175,7 +175,7 @@ SWITCH_STANDARD_APP(rss_function) char *filename = NULL; char *argv[3], *feed_list[TTS_MAX_ENTRIES] = { 0 }, *feed_names[TTS_MAX_ENTRIES] = { 0}; - int argc, feed_index = 0; + int feed_index = 0; const char *cf = "rss.conf"; switch_xml_t cfg, cxml, feeds, feed; char buf[1024] = ""; @@ -236,7 +236,7 @@ SWITCH_STANDARD_APP(rss_function) if (!zstr(data)) { if ((mydata = switch_core_session_strdup(session, data))) { - argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0])); + switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0])); if (argv[0]) { engine = argv[0]; diff --git a/src/mod/applications/mod_vmd/mod_vmd.c b/src/mod/applications/mod_vmd/mod_vmd.c index 4a20df8183..3bb1e6b16e 100644 --- a/src/mod/applications/mod_vmd/mod_vmd.c +++ b/src/mod/applications/mod_vmd/mod_vmd.c @@ -237,9 +237,8 @@ static switch_bool_t process_data(vmd_session_info_t *vmd_info, switch_frame_t * double pts[P]; int16_t *data; int16_t max; - switch_ssize_t len; - len = frame->samples * sizeof(int16_t); + //len = frame->samples * sizeof(int16_t); data = (int16_t *) frame->data; for (max = (int16_t) abs(data[0]), i = 1; i < frame->samples; i++) { diff --git a/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c b/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c index 0553607bfe..a5bf1ecad7 100644 --- a/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c +++ b/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c @@ -250,7 +250,6 @@ static switch_status_t switch_dahdi_encode(switch_codec_t *codec, { int32_t res; short *dbuf_linear; - unsigned char *ebuf_g729; unsigned char ebuf_ulaw[decoded_data_len / 2]; uint32_t i; struct dahdi_context *context = NULL; @@ -268,7 +267,6 @@ static switch_status_t switch_dahdi_encode(switch_codec_t *codec, } dbuf_linear = decoded_data; - ebuf_g729 = encoded_data; for (i = 0; i < decoded_data_len / sizeof(short); i++) { ebuf_ulaw[i] = linear_to_ulaw(dbuf_linear[i]); } diff --git a/src/mod/endpoints/mod_portaudio/pablio.c b/src/mod/endpoints/mod_portaudio/pablio.c index b994d21c2a..05fdf0f280 100644 --- a/src/mod/endpoints/mod_portaudio/pablio.c +++ b/src/mod/endpoints/mod_portaudio/pablio.c @@ -251,7 +251,7 @@ PaError OpenAudioStream(PABLIO_Stream ** rwblPtr, PABLIO_Stream *aStream; long numFrames; //long numBytes; - int channels = 1; + //int channels = 1; if (!(inputParameters || outputParameters)) { return -1; @@ -262,11 +262,13 @@ PaError OpenAudioStream(PABLIO_Stream ** rwblPtr, switch_assert(aStream); memset(aStream, 0, sizeof(PABLIO_Stream)); + /* if (inputParameters) { channels = inputParameters->channelCount; } else if (outputParameters) { channels = outputParameters->channelCount; } + */ numFrames = RoundUpToNextPowerOf2(samples_per_packet * 5); aStream->bytesPerFrame = bytesPerSample; diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 38ab78553a..3879cca7d4 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -462,7 +462,6 @@ uint32_t skinny_line_get_state(listener_t *listener, uint32_t line_instance, uin switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force) { - int ms; switch_status_t status = SWITCH_STATUS_SUCCESS; int resetting = 0; @@ -542,7 +541,7 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force) } tech_pvt->read_frame.rate = tech_pvt->rm_rate; - ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000; + //ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000; if (!switch_core_codec_ready(&tech_pvt->read_codec)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n"); @@ -880,7 +879,6 @@ switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_ { switch_channel_t *channel = switch_core_session_get_channel(session); private_t *tech_pvt = switch_core_session_get_private(session); - int payload = 0; while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) { if (switch_channel_ready(channel)) { @@ -908,7 +906,7 @@ switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_ return SWITCH_STATUS_FALSE; } - payload = tech_pvt->read_frame.payload; + //payload = tech_pvt->read_frame.payload; if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) { switch_dtmf_t dtmf = { 0 }; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 35cb74adb5..f6887060fc 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -588,14 +588,12 @@ switch_call_cause_t skinny_ring_lines(private_t *tech_pvt, switch_core_session_t switch_status_t skinny_session_ring_out(switch_core_session_t *session, listener_t *listener, uint32_t line_instance) { - switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; switch_assert(session); switch_assert(listener); switch_assert(listener->profile); - channel = switch_core_session_get_channel(session); tech_pvt = switch_core_session_get_private(session); send_start_tone(listener, SKINNY_TONE_ALERT, 0, line_instance, tech_pvt->call_id); @@ -732,14 +730,12 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste switch_status_t skinny_session_hold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance) { - switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; switch_assert(session); switch_assert(listener); switch_assert(listener->profile); - channel = switch_core_session_get_channel(session); tech_pvt = switch_core_session_get_private(session); skinny_session_stop_media(session, listener, line_instance); @@ -760,17 +756,15 @@ switch_status_t skinny_session_hold_line(switch_core_session_t *session, listene switch_status_t skinny_session_unhold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance) { - switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; switch_assert(session); switch_assert(listener); switch_assert(listener->profile); - channel = switch_core_session_get_channel(session); tech_pvt = switch_core_session_get_private(session); - skinny_hold_active_calls(listener); + skinny_hold_active_calls(listener); send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id); send_set_speaker_mode(listener, SKINNY_SPEAKER_ON); send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_RING_OUT, 0xffff); @@ -825,14 +819,12 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener switch_status_t skinny_session_stop_media(switch_core_session_t *session, listener_t *listener, uint32_t line_instance) { - switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; switch_assert(session); switch_assert(listener); switch_assert(listener->profile); - channel = switch_core_session_get_channel(session); tech_pvt = switch_core_session_get_private(session); switch_clear_flag_locked(tech_pvt, TFLAG_IO); @@ -1773,7 +1765,6 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn uint32_t call_id = 0; switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; - private_t *tech_pvt = NULL; skinny_check_data_length(request, sizeof(request->data.soft_key_event.event)); @@ -1790,7 +1781,6 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn break; case SOFTKEY_NEWCALL: status = skinny_create_incoming_session(listener, &line_instance, &session); - tech_pvt = switch_core_session_get_private(session); skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0); break; @@ -1874,13 +1864,10 @@ switch_status_t skinny_handle_unregister(listener_t *listener, skinny_message_t switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, skinny_message_t *request) { skinny_message_t *message; - skinny_profile_t *profile; switch_assert(listener->profile); switch_assert(listener->device_name); - profile = listener->profile; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.soft_key_template)); message->type = SOFT_KEY_TEMPLATE_RES_MESSAGE; message->length = 4 + sizeof(message->data.soft_key_template); diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 0b96db82a1..7f2a7e8b3c 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -160,7 +160,6 @@ static void do_rotate(cdr_fd_t *fd) char date[80] = ""; switch_size_t retsize; char *p; - size_t len; close(fd->fd); fd->fd = -1; @@ -169,7 +168,6 @@ static void do_rotate(cdr_fd_t *fd) switch_time_exp_lt(&tm, switch_micro_time_now()); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm); - len = strlen(fd->path) + strlen(date) + 2; p = switch_mprintf("%s.%s", fd->path, date); assert(p); switch_file_rename(fd->path, p, globals.pool);