From d95a28cea7ac0b7a82bee0f3fbe0262ca053d3c1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 15 May 2015 10:55:46 +0200 Subject: [PATCH] fixing coverity issues --- .../adapters/beamformer_filter.cc | 1 + .../adapters/freq_xlating_fir_filter.cc | 1 + src/core/system_parameters/galileo_almanac.cc | 14 +++---- ...8ms_ambiguous_acquisition_gsoc2013_test.cc | 15 +++---- ...cps_ambiguous_acquisition_gsoc2013_test.cc | 34 +++++++-------- ...wsr_ambiguous_acquisition_gsoc2013_test.cc | 15 +++---- ...ync_ambiguous_acquisition_gsoc2014_test.cc | 19 +++++---- ...ong_ambiguous_acquisition_gsoc2013_test.cc | 15 +++---- ...cps_acquisition_gsoc2014_gensource_test.cc | 41 ++++++++++--------- ...a_pcps_opencl_acquisition_gsoc2013_test.cc | 15 +++---- ..._ca_pcps_tong_acquisition_gsoc2013_test.cc | 34 +++++++-------- 11 files changed, 106 insertions(+), 98 deletions(-) diff --git a/src/algorithms/input_filter/adapters/beamformer_filter.cc b/src/algorithms/input_filter/adapters/beamformer_filter.cc index 5700669a8..8b1797f0e 100644 --- a/src/algorithms/input_filter/adapters/beamformer_filter.cc +++ b/src/algorithms/input_filter/adapters/beamformer_filter.cc @@ -69,6 +69,7 @@ BeamformerFilter::BeamformerFilter( file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } + samples_ = 0; } diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index 631f55a72..65d845085 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -109,6 +109,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration { LOG(ERROR) << " Unknown input filter input/output item type conversion"; item_size = sizeof(gr_complex); //avoids uninitialization + input_size_ = sizeof(gr_complex); //avoids uninitialization } if (dump_) diff --git a/src/core/system_parameters/galileo_almanac.cc b/src/core/system_parameters/galileo_almanac.cc index 42ce37b1e..9e387f04c 100644 --- a/src/core/system_parameters/galileo_almanac.cc +++ b/src/core/system_parameters/galileo_almanac.cc @@ -33,10 +33,10 @@ Galileo_Almanac::Galileo_Almanac() { /*Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number*/ - int IOD_a_7 = 0; + IOD_a_7 = 0; WN_a_7 = 0.0; t0a_7 = 0.0; - int SVID1_7 = 0; + SVID1_7 = 0; DELTA_A_7 = 0.0; e_7 = 0.0; omega_7 = 0.0; @@ -46,13 +46,13 @@ Galileo_Almanac::Galileo_Almanac() M0_7 = 0.0; /*Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)*/ - int IOD_a_8 = 0; + IOD_a_8 = 0; af0_8 = 0.0; af1_8 = 0.0; E5b_HS_8 = 0.0; E1B_HS_8 = 0.0; E5a_HS_8 = 0.0; - int SVID2_8; + SVID2_8 = 0; DELTA_A_8 = 0.0; e_8 = 0.0; omega_8 = 0.0; @@ -61,7 +61,7 @@ Galileo_Almanac::Galileo_Almanac() Omega_dot_8 = 0.0; /*Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)*/ - int IOD_a_9 = 0; + IOD_a_9 = 0; WN_a_9 = 0.0; t0a_9 = 0.0; M0_9 = 0.0; @@ -70,14 +70,14 @@ Galileo_Almanac::Galileo_Almanac() E5b_HS_9 = 0.0; E1B_HS_9 = 0.0; E5a_HS_9 = 0.0; - int SVID3_9; + SVID3_9 = 0; DELTA_A_9 = 0.0; e_9 = 0.0; omega_9 = 0.0; delta_i_9 = 0.0; /*Word type 10: Almanac for SVID3 (2/2)*/ - int IOD_a_10 = 0; + IOD_a_10 = 0; Omega0_10 = 0.0; Omega_dot_10 = 0.0; M0_10 = 0.0; diff --git a/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc index 02d5854c0..2030cc874 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc @@ -62,6 +62,7 @@ protected: message = 0; factory = std::make_shared(); gnss_synchro = {0}; + init(); } ~GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test() @@ -87,15 +88,15 @@ protected: int message; boost::thread ch_thread; - unsigned int integration_time_ms; - unsigned int fs_in; + unsigned int integration_time_ms = 0; + unsigned int fs_in = 0; - double expected_delay_chips; - double expected_doppler_hz; - float max_doppler_error_hz; - float max_delay_error_chips; + double expected_delay_chips = 0.0; + double expected_doppler_hz = 0.0; + float max_doppler_error_hz = 0; + float max_delay_error_chips = 0; - unsigned int num_of_realizations; + unsigned int num_of_realizations = 0; unsigned int realization_counter; unsigned int detection_counter; unsigned int correct_estimation_counter; diff --git a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc index 7cb8cb496..5c8963ad0 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc @@ -88,27 +88,27 @@ protected: int message; boost::thread ch_thread; - unsigned int integration_time_ms; - unsigned int fs_in; + unsigned int integration_time_ms = 0; + unsigned int fs_in = 0; - double expected_delay_chips; - double expected_doppler_hz; - float max_doppler_error_hz; - float max_delay_error_chips; + double expected_delay_chips = 0.0; + double expected_doppler_hz = 0.0; + float max_doppler_error_hz = 0; + float max_delay_error_chips = 0; - unsigned int num_of_realizations; - unsigned int realization_counter; - unsigned int detection_counter; - unsigned int correct_estimation_counter; - unsigned int acquired_samples; - unsigned int mean_acq_time_us; + unsigned int num_of_realizations = 0; + unsigned int realization_counter = 0; + unsigned int detection_counter = 0; + unsigned int correct_estimation_counter = 0; + unsigned int acquired_samples = 0; + unsigned int mean_acq_time_us = 0; - double mse_doppler; - double mse_delay; + double mse_doppler = 0.0; + double mse_delay = 0.0; - double Pd; - double Pfa_p; - double Pfa_a; + double Pd = 0.0; + double Pfa_p = 0.0; + double Pfa_a = 0.0; }; diff --git a/src/tests/gnss_block/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc index 76f4d60ea..bb02a14a2 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc @@ -62,6 +62,7 @@ protected: stop = false; message = 0; gnss_synchro = {0}; + init(); } ~GalileoE1PcpsCccwsrAmbiguousAcquisitionTest() @@ -88,15 +89,15 @@ protected: int message; boost::thread ch_thread; - unsigned int integration_time_ms; - unsigned int fs_in; + unsigned int integration_time_ms = 0; + unsigned int fs_in = 0; - double expected_delay_chips; - double expected_doppler_hz; - float max_doppler_error_hz; - float max_delay_error_chips; + double expected_delay_chips = 0.0; + double expected_doppler_hz = 0.0; + float max_doppler_error_hz = 0; + float max_delay_error_chips = 0; - unsigned int num_of_realizations; + unsigned int num_of_realizations = 0; unsigned int realization_counter; unsigned int detection_counter; unsigned int correct_estimation_counter; diff --git a/src/tests/gnss_block/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/src/tests/gnss_block/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index d63e389e3..d86f055f7 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -68,6 +68,7 @@ protected: stop = false; message = 0; gnss_synchro = {0}; + init(); } ~GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test() @@ -95,16 +96,16 @@ protected: int message; boost::thread ch_thread; - unsigned int integration_time_ms; - unsigned int fs_in; - unsigned int folding_factor; + unsigned int integration_time_ms = 0; + unsigned int fs_in = 0; + unsigned int folding_factor = 0; - double expected_delay_chips; - double expected_doppler_hz; - float max_doppler_error_hz; - float max_delay_error_chips; + double expected_delay_chips = 0.0; + double expected_doppler_hz = 0.0; + float max_doppler_error_hz = 0.0; + float max_delay_error_chips = 0.0; - unsigned int num_of_realizations; + unsigned int num_of_realizations = 0; unsigned int realization_counter; unsigned int detection_counter; unsigned int correct_estimation_counter; @@ -121,7 +122,7 @@ protected: std::ofstream pdpfafile; unsigned int miss_detection_counter; - bool dump_test_results; + bool dump_test_results = false; }; diff --git a/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc index eba137ac9..14933c665 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc @@ -68,6 +68,7 @@ protected: stop = false; message = 0; gnss_synchro = {0}; + init(); } ~GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test() @@ -94,15 +95,15 @@ protected: int message; boost::thread ch_thread; - unsigned int integration_time_ms; - unsigned int fs_in; + unsigned int integration_time_ms = 0; + unsigned int fs_in = 0; - double expected_delay_chips; - double expected_doppler_hz; - float max_doppler_error_hz; - float max_delay_error_chips; + double expected_delay_chips = 0.0; + double expected_doppler_hz = 0.0; + float max_doppler_error_hz = 0; + float max_delay_error_chips = 0; - unsigned int num_of_realizations; + unsigned int num_of_realizations = 0; unsigned int realization_counter; unsigned int detection_counter; unsigned int correct_estimation_counter; diff --git a/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index bace632f6..85e5eb7a2 100644 --- a/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -63,6 +63,7 @@ protected: stop = false; message = 0; gnss_synchro = {0}; + init(); } ~GalileoE5aPcpsAcquisitionGSoC2014GensourceTest() @@ -91,27 +92,27 @@ protected: int message; boost::thread ch_thread; - unsigned int integration_time_ms; - unsigned int fs_in; + unsigned int integration_time_ms = 0; + unsigned int fs_in = 0; - double expected_delay_chips; - double expected_delay_sec; - double expected_doppler_hz; - double expected_delay_chips1; - double expected_delay_sec1; - double expected_doppler_hz1; - double expected_delay_chips2; - double expected_delay_sec2; - double expected_doppler_hz2; - double expected_delay_chips3; - double expected_delay_sec3; - double expected_doppler_hz3; - float max_doppler_error_hz; - float max_delay_error_chips; - int CAF_window_hz; - int Zero_padding; + double expected_delay_chips = 0.0; + double expected_delay_sec = 0.0; + double expected_doppler_hz = 0.0; + double expected_delay_chips1 = 0.0; + double expected_delay_sec1 = 0.0; + double expected_doppler_hz1 = 0.0; + double expected_delay_chips2 = 0.0; + double expected_delay_sec2 = 0.0; + double expected_doppler_hz2 = 0.0; + double expected_delay_chips3 = 0.0; + double expected_delay_sec3 = 0.0; + double expected_doppler_hz3 = 0.0; + float max_doppler_error_hz = 0.0; + float max_delay_error_chips = 0.0; + int CAF_window_hz = 0; + int Zero_padding = 0; - unsigned int num_of_realizations; + unsigned int num_of_realizations = 0; unsigned int realization_counter; unsigned int detection_counter; unsigned int correct_estimation_counter; @@ -125,7 +126,7 @@ protected: double Pfa_p; double Pfa_a; - int sat; + int sat = 0; }; void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::init() diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc index 5a15cc369..2fbc826a0 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc @@ -63,6 +63,7 @@ protected: stop = false; message = 0; gnss_synchro = {0}; + init(); } ~GpsL1CaPcpsOpenClAcquisitionGSoC2013Test() @@ -87,15 +88,15 @@ protected: int message; boost::thread ch_thread; - unsigned int integration_time_ms; - unsigned int fs_in; + unsigned int integration_time_ms = 0; + unsigned int fs_in = 0; - double expected_delay_chips; - double expected_doppler_hz; - float max_doppler_error_hz; - float max_delay_error_chips; + double expected_delay_chips = 0.0; + double expected_doppler_hz = 0.0; + float max_doppler_error_hz = 0; + float max_delay_error_chips = 0; - unsigned int num_of_realizations; + unsigned int num_of_realizations = 0; unsigned int realization_counter; unsigned int detection_counter; unsigned int correct_estimation_counter; diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc index ca7d46276..9d749bbc9 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc @@ -89,27 +89,27 @@ protected: int message; boost::thread ch_thread; - unsigned int integration_time_ms; - unsigned int fs_in; + unsigned int integration_time_ms = 0; + unsigned int fs_in = 0; - double expected_delay_chips; - double expected_doppler_hz; - float max_doppler_error_hz; - float max_delay_error_chips; + double expected_delay_chips = 0.0; + double expected_doppler_hz = 0.0; + float max_doppler_error_hz = 0.0; + float max_delay_error_chips = 0.0; - unsigned int num_of_realizations; - unsigned int realization_counter; - unsigned int detection_counter; - unsigned int correct_estimation_counter; - unsigned int acquired_samples; - unsigned int mean_acq_time_us; + unsigned int num_of_realizations = 0; + unsigned int realization_counter = 0; + unsigned int detection_counter = 0; + unsigned int correct_estimation_counter = 0; + unsigned int acquired_samples = 0; + unsigned int mean_acq_time_us = 0; - double mse_doppler; - double mse_delay; + double mse_doppler = 0.0; + double mse_delay = 0.0; - double Pd; - double Pfa_p; - double Pfa_a; + double Pd = 0.0; + double Pfa_p = 0.0; + double Pfa_a = 0.0; }; void GpsL1CaPcpsTongAcquisitionGSoC2013Test::init()