1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 19:50:34 +00:00

fixing coverity issues

This commit is contained in:
Carles Fernandez 2015-05-15 03:02:45 +02:00
parent 72ced4ac23
commit 4850944e00
13 changed files with 39 additions and 31 deletions

View File

@ -86,7 +86,7 @@ public:
private:
galileo_e1_pvt_cc_sptr pvt_;
bool dump_;
unsigned int fs_in_;
//unsigned int fs_in_;
std::string dump_filename_;
std::string role_;
unsigned int in_streams_;

View File

@ -88,7 +88,6 @@ public:
private:
gps_l1_ca_pvt_cc_sptr pvt_;
bool dump_;
unsigned int fs_in_;
std::string dump_filename_;
std::string role_;
unsigned int in_streams_;

View File

@ -86,7 +86,6 @@ public:
private:
hybrid_pvt_cc_sptr pvt_;
bool dump_;
unsigned int fs_in_;
std::string dump_filename_;
std::string role_;
unsigned int in_streams_;

View File

@ -121,7 +121,7 @@ galileo_e1_pvt_cc::~galileo_e1_pvt_cc()
bool galileo_e1_pvt_cc::pseudoranges_pairCompare_min( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
bool galileo_e1_pvt_cc::pseudoranges_pairCompare_min(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
{
return (a.second.Pseudorange_m) < (b.second.Pseudorange_m);
}

View File

@ -111,7 +111,7 @@ private:
std::shared_ptr<Nmea_Printer> d_nmea_printer;
double d_rx_time;
std::shared_ptr<galileo_e1_ls_pvt> d_ls_pvt;
bool pseudoranges_pairCompare_min(std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b);
bool pseudoranges_pairCompare_min(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b);
public:
~galileo_e1_pvt_cc (); //!< Default destructor

View File

@ -136,7 +136,7 @@ gps_l1_ca_pvt_cc::~gps_l1_ca_pvt_cc()
bool pseudoranges_pairCompare_min( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
bool pseudoranges_pairCompare_min(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
{
return (a.second.Pseudorange_m) < (b.second.Pseudorange_m);
}

View File

@ -93,7 +93,6 @@ hybrid_pvt_cc::hybrid_pvt_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_q
d_ls_pvt->set_averaging_depth(d_averaging_depth);
d_sample_counter = 0;
valid_solution_counter = 0;
d_last_sample_nav_output = 0;
d_rx_time = 0.0;
d_TOW_at_curr_symbol_constellation = 0.0;
@ -127,7 +126,7 @@ hybrid_pvt_cc::~hybrid_pvt_cc()
bool hybrid_pvt_cc::pseudoranges_pairCompare_min( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
bool hybrid_pvt_cc::pseudoranges_pairCompare_min(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
{
return (a.second.Pseudorange_m) < (b.second.Pseudorange_m);
}

View File

@ -110,15 +110,13 @@ private:
int d_output_rate_ms;
int d_display_rate_ms;
long unsigned int d_sample_counter;
long unsigned int valid_solution_counter;
long unsigned int valid_solution_16_sat_counter;
long unsigned int d_last_sample_nav_output;
std::shared_ptr<Kml_Printer> d_kml_dump;
std::shared_ptr<Nmea_Printer> d_nmea_printer;
double d_rx_time;
double d_TOW_at_curr_symbol_constellation;
std::shared_ptr<hybrid_ls_pvt> d_ls_pvt;
bool pseudoranges_pairCompare_min(std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b);
bool pseudoranges_pairCompare_min(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b);
public:
~hybrid_pvt_cc (); //!< Default destructor

View File

@ -173,7 +173,9 @@ Rinex_Printer::Rinex_Printer()
}
else
{
LOG(ERROR) << "Unknown RINEX version " << FLAGS_RINEX_version << " (must be 2.11 or 3.02)" << std::endl;
LOG(WARNING) << "Unknown RINEX version " << FLAGS_RINEX_version << " (must be 2.11 or 3.02). Using 3.02";
version = 3;
stringVersion = "3.02";
}
numberTypesObservations = 4; // Number of available types of observable in the system
@ -197,23 +199,23 @@ Rinex_Printer::~Rinex_Printer()
// If nothing written, erase the files.
if (posn == 0)
{
remove(navfilename.c_str());
if(remove(navfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
}
if (poso == 0)
{
remove(obsfilename.c_str());
if(remove(obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
}
if (poss == 0)
{
remove(sbsfilename.c_str());
if(remove(sbsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
}
if (posng == 0)
{
remove(navGalfilename.c_str());
if(remove(navGalfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
}
if (posmn == 0)
{
remove(navMixfilename.c_str());
if(remove(navMixfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
}
}

View File

@ -117,6 +117,10 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
// LOG(WARNING) << item_type_
// << " unknown acquisition item type";
// }
channel_ = 0;
threshold_ = 0.0;
doppler_max_ = 0;
doppler_step_ = 0;
}

View File

@ -85,6 +85,12 @@ pcps_acquisition_cc::pcps_acquisition_cc(
d_input_power = 0.0;
d_num_doppler_bins = 0;
d_bit_transition_flag = bit_transition_flag;
d_threshold = 0.0;
d_doppler_step = 250;
d_code_phase = 0;
d_test_statistics = 0.0;
d_channel = 0;
d_doppler_freq = 0.0;
d_fft_codes = static_cast<gr_complex*>(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment()));
d_magnitude = static_cast<float*>(volk_malloc(d_fft_size * sizeof(float), volk_get_alignment()));
@ -138,15 +144,7 @@ void pcps_acquisition_cc::init()
d_mag = 0.0;
d_input_power = 0.0;
d_num_doppler_bins=ceil((static_cast<int>(d_doppler_max)-static_cast<int>(-d_doppler_max))/d_doppler_step);
// Count the number of bins
// d_num_doppler_bins = 0;
// for (int doppler = static_cast<int>(-d_doppler_max);
// doppler <= static_cast<int>(d_doppler_max);
// doppler += d_doppler_step)
// {
// d_num_doppler_bins++;
// }
d_num_doppler_bins = ceil( static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step));
// Create the carrier Doppler wipeoff signals
d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins];

View File

@ -105,7 +105,7 @@ private:
long d_freq;
int d_samples_per_ms;
int d_samples_per_code;
unsigned int d_doppler_resolution;
//unsigned int d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
unsigned int d_doppler_max;

View File

@ -153,8 +153,17 @@ concurrent_map<Sbas_Ephemeris> global_sbas_ephemeris_map;
int main(int argc, char **argv)
{
std::cout << "Running GNSS-SDR Tests..." << std::endl;
testing::InitGoogleTest(&argc, argv);
google::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);
return RUN_ALL_TESTS();
try
{
testing::InitGoogleTest(&argc, argv);
google::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);
return RUN_ALL_TESTS();
}
catch(const testing::internal::GoogleTestFailureException& e)
{
std::cout << e.what() << std::endl;
}
catch(...)
{}
}