diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index 8c9d581be..8e1e9fbe0 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -447,7 +447,7 @@ bool RtklibPvt::save_assistance_to_XML() ofs.close(); LOG(INFO) << "Saved GPS L1 Ephemeris map data"; } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << e.what(); return false; diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc index df4caef92..618ae7385 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc @@ -335,7 +335,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc() msgctl(sysv_msqid, IPC_RMID, NULL); //save GPS L2CM ephemeris to XML file - std::string file_name="eph_GPS_L2CM.xml"; + std::string file_name = "eph_GPS_L2CM.xml"; if (d_ls_pvt->gps_cnav_ephemeris_map.size() > 0) { @@ -347,7 +347,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc() ofs.close(); LOG(INFO) << "Saved GPS L2CM Ephemeris map data"; } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << e.what(); } @@ -370,7 +370,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc() ofs.close(); LOG(INFO) << "Saved GPS L1 CA Ephemeris map data"; } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << e.what(); } @@ -393,7 +393,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc() ofs.close(); LOG(INFO) << "Saved Galileo E1 Ephemeris map data"; } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << e.what(); } @@ -403,6 +403,17 @@ rtklib_pvt_cc::~rtklib_pvt_cc() LOG(WARNING) << "Failed to save Galileo E1 Ephemeris, map is empty"; } + if (d_dump_file.is_open() == true) + { + try + { + d_dump_file.close(); + } + catch(const std::exception & ex) + { + LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); + } + } } diff --git a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc index 20add847b..545854d6b 100644 --- a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc +++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc @@ -69,7 +69,17 @@ hybrid_ls_pvt::hybrid_ls_pvt(int nchannels, std::string dump_filename, bool flag hybrid_ls_pvt::~hybrid_ls_pvt() { - d_dump_file.close(); + if (d_dump_file.is_open() == true) + { + try + { + d_dump_file.close(); + } + catch(const std::exception & ex) + { + LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); + } + } } diff --git a/src/algorithms/PVT/libs/nmea_printer.cc b/src/algorithms/PVT/libs/nmea_printer.cc index e502dab75..f0b4daec8 100644 --- a/src/algorithms/PVT/libs/nmea_printer.cc +++ b/src/algorithms/PVT/libs/nmea_printer.cc @@ -167,7 +167,7 @@ bool Nmea_Printer::Print_Nmea_Line(const std::shared_ptr& pvt_data //GPGSV nmea_file_descriptor << GPGSV; } - catch(std::exception ex) + catch(const std::exception & ex) { DLOG(INFO) << "NMEA printer can not write on output file" << nmea_filename.c_str();; } diff --git a/src/algorithms/PVT/libs/pvt_solution.cc b/src/algorithms/PVT/libs/pvt_solution.cc index 9901ab878..d3cbbe14f 100644 --- a/src/algorithms/PVT/libs/pvt_solution.cc +++ b/src/algorithms/PVT/libs/pvt_solution.cc @@ -364,6 +364,7 @@ int Pvt_Solution::tropo(double *ddr_m, double sinel, double hsta_km, double p_mb return 0; } + int Pvt_Solution::topocent(double *Az, double *El, double *D, const arma::vec & x, const arma::vec & dx) { /* Transformation of vector dx into topocentric coordinate @@ -474,7 +475,7 @@ int Pvt_Solution::compute_DOP() d_VDOP = sqrt(DOP_ENU(2, 2)); // VDOP d_TDOP = sqrt(d_Q(3, 3)); // TDOP } - catch(std::exception& ex) + catch(const std::exception & ex) { d_GDOP = -1; // Geometric DOP d_PDOP = -1; // PDOP @@ -483,12 +484,9 @@ int Pvt_Solution::compute_DOP() d_TDOP = -1; // TDOP } return 0; - } - - int Pvt_Solution::set_averaging_depth(int depth) { d_averaging_depth = depth; diff --git a/src/algorithms/PVT/libs/rtcm_printer.cc b/src/algorithms/PVT/libs/rtcm_printer.cc index c522b90af..aa80318ed 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.cc +++ b/src/algorithms/PVT/libs/rtcm_printer.cc @@ -131,11 +131,11 @@ Rtcm_Printer::~Rtcm_Printer() { rtcm->stop_server(); } - catch( boost::exception & e ) + catch(const boost::exception & e) { LOG(WARNING) << "Boost exception: " << boost::diagnostic_information(e); } - catch(std::exception const& ex) + catch(const std::exception & ex) { LOG(WARNING) << "STD exception: " << ex.what(); } @@ -305,9 +305,9 @@ bool Rtcm_Printer::Print_Message(const std::string & message) { rtcm_file_descriptor << message << std::endl; } - catch(std::exception ex) + catch(const std::exception & ex) { - DLOG(INFO) << "RTCM printer can not write on output file" << rtcm_filename.c_str(); + DLOG(INFO) << "RTCM printer cannot write on the output file " << rtcm_filename.c_str(); return false; } @@ -316,8 +316,8 @@ bool Rtcm_Printer::Print_Message(const std::string & message) { if(write(rtcm_dev_descriptor, message.c_str(), message.length()) == -1) { - DLOG(INFO) << "RTCM printer cannot write on serial device" << rtcm_devname.c_str(); - std::cout << "RTCM printer cannot write on serial device" << rtcm_devname.c_str() << std::endl; + DLOG(INFO) << "RTCM printer cannot write on serial device " << rtcm_devname.c_str(); + std::cout << "RTCM printer cannot write on serial device " << rtcm_devname.c_str() << std::endl; return false; } } diff --git a/src/algorithms/channel/libs/channel_msg_receiver_cc.cc b/src/algorithms/channel/libs/channel_msg_receiver_cc.cc index 61b409c5c..573c1aa84 100644 --- a/src/algorithms/channel/libs/channel_msg_receiver_cc.cc +++ b/src/algorithms/channel/libs/channel_msg_receiver_cc.cc @@ -94,4 +94,3 @@ channel_msg_receiver_cc::channel_msg_receiver_cc(ChannelFsm* channel_fsm, bool r channel_msg_receiver_cc::~channel_msg_receiver_cc() {} - diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index 4365b1bbc..dca59c36b 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -79,12 +79,12 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, { if (!osmosdr_args_.empty()) { - std::cout << "OsmoSdr arguments: " << osmosdr_args_ << std::endl; - LOG(INFO) << "OsmoSdr arguments: " << osmosdr_args_; + std::cout << "OsmoSdr arguments: " << osmosdr_args_ << std::endl; + LOG(INFO) << "OsmoSdr arguments: " << osmosdr_args_; } osmosdr_source_ = osmosdr::source::make(osmosdr_args_); } - catch( boost::exception & e ) + catch( const boost::exception & e ) { DLOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e); } diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc index bfa5da504..2365e2116 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc @@ -84,7 +84,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration, LOG (INFO) << "Connecting to " << address_ << ":" << port_; signal_source_ = rtl_tcp_make_signal_source_c (address_, port_, flip_iq_); } - catch( boost::exception & e ) + catch( const boost::exception & e ) { DLOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e); } diff --git a/src/algorithms/tracking/libs/tcp_communication.cc b/src/algorithms/tracking/libs/tcp_communication.cc index be9022f53..757562d30 100644 --- a/src/algorithms/tracking/libs/tcp_communication.cc +++ b/src/algorithms/tracking/libs/tcp_communication.cc @@ -67,7 +67,7 @@ int tcp_communication::listen_tcp_connection(size_t d_port_, size_t d_port_ch0_) std::cout << "Socket accepted on port " << d_port_ << std::endl; } - catch(std::exception& e) + catch(const std::exception& e) { std::cerr << "Exception: " << e.what() << std::endl; } @@ -102,7 +102,7 @@ void tcp_communication::send_receive_tcp_packet_galileo_e1(boost::arrayproc_pack_carrier_doppler_hz = readbuf.data()[3]; } - catch(std::exception& e) + catch(const std::exception& e) { std::cerr << "Exception: " << e.what() << ". Please press Ctrl+C to end the program." << std::endl; std::cin >> controlc; @@ -137,7 +137,7 @@ void tcp_communication::send_receive_tcp_packet_gps_l1_ca(boost::arrayproc_pack_carrier_doppler_hz = readbuf.data()[3]; } - catch(std::exception& e) + catch(const std::exception& e) { std::cerr << "Exception: " << e.what() << ". Please press Ctrl+C to end the program." << std::endl; std::cin >> controlc; diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index d0a21d68d..e0e845bc5 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -33,7 +33,6 @@ */ #include "control_thread.h" -#include #include #include #include diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index f57f3ca04..a529e6318 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -33,8 +33,6 @@ */ #include "gnss_flowgraph.h" -#include "unistd.h" - #include #include #include @@ -80,7 +78,7 @@ void GNSSFlowgraph::start() { top_block_->start(); } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << "Unable to start flowgraph"; LOG(ERROR) << e.what(); @@ -123,7 +121,7 @@ void GNSSFlowgraph::connect() { sig_source_.at(i)->connect(top_block_); } - catch (std::exception& e) + catch (const std::exception & e) { LOG(INFO) << "Can't connect signal source block " << i << " internally"; LOG(ERROR) << e.what(); @@ -139,7 +137,7 @@ void GNSSFlowgraph::connect() { sig_conditioner_.at(i)->connect(top_block_); } - catch (std::exception& e) + catch (const std::exception & e) { LOG(INFO) << "Can't connect signal conditioner block " << i << " internally"; LOG(ERROR) << e.what(); @@ -154,7 +152,7 @@ void GNSSFlowgraph::connect() { channels_.at(i)->connect(top_block_); } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << "Can't connect channel " << i << " internally"; LOG(ERROR) << e.what(); @@ -167,7 +165,7 @@ void GNSSFlowgraph::connect() { observables_->connect(top_block_); } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << "Can't connect observables block internally"; LOG(ERROR) << e.what(); @@ -180,7 +178,7 @@ void GNSSFlowgraph::connect() { pvt_->connect(top_block_); } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << "Can't connect PVT block internally"; LOG(ERROR) << e.what(); @@ -248,7 +246,7 @@ void GNSSFlowgraph::connect() } } } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << "Can't connect signal source " << i << " to signal conditioner " << i; LOG(ERROR) << e.what(); @@ -268,7 +266,7 @@ void GNSSFlowgraph::connect() top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, channels_.at(i)->get_left_block(), 0); } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << "Can't connect signal conditioner " << selected_signal_conditioner_ID << " to channel " << i; LOG(ERROR) << e.what(); @@ -284,7 +282,7 @@ void GNSSFlowgraph::connect() top_block_->connect(channels_.at(i)->get_right_block(), 0, observables_->get_left_block(), i); } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << "Can't connect channel " << i << " to observables"; LOG(ERROR) << e.what(); @@ -331,7 +329,7 @@ void GNSSFlowgraph::connect() top_block_->msg_connect(channels_.at(i)->get_right_block(), pmt::mp("telemetry"), pvt_->get_left_block(), pmt::mp("telemetry")); } } - catch (std::exception& e) + catch (const std::exception & e) { LOG(WARNING) << "Can't connect observables to PVT"; LOG(ERROR) << e.what(); diff --git a/src/core/system_parameters/rtcm.cc b/src/core/system_parameters/rtcm.cc index 7f1eaa8ad..35e378520 100644 --- a/src/core/system_parameters/rtcm.cc +++ b/src/core/system_parameters/rtcm.cc @@ -65,11 +65,11 @@ Rtcm::~Rtcm() { stop_server(); } - catch( boost::exception & e ) + catch(const boost::exception & e) { LOG(WARNING) << "Boost exception: " << boost::diagnostic_information(e); } - catch(std::exception const& ex) + catch(const std::exception & ex) { LOG(WARNING) << "STD exception: " << ex.what(); } @@ -95,7 +95,7 @@ void Rtcm::run_server() server_is_running = true; t.detach(); } - catch (std::exception& e) + catch (const std::exception & e) { std::cerr << "Exception: " << e.what() << "\n"; } diff --git a/src/main/main.cc b/src/main/main.cc index cd552bd71..a641ae92f 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -101,7 +101,7 @@ int main(int argc, char** argv) google::InitGoogleLogging(argv[0]); if (FLAGS_log_dir.empty()) { - std::cout << "Logging will be done at " + std::cout << "Logging will be written at " << boost::filesystem::temp_directory_path() << std::endl << "Use gnss-sdr --log_dir=/path/to/log to change that." @@ -124,7 +124,7 @@ int main(int argc, char** argv) return 1; } } - std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl; + std::cout << "Logging will be written at " << FLAGS_log_dir << std::endl; } } @@ -138,11 +138,11 @@ int main(int argc, char** argv) { control_thread->run(); } - catch( boost::exception & e ) + catch(const boost::exception & e) { LOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e); } - catch(std::exception const& ex) + catch(const std::exception & ex) { LOG(FATAL) << "STD exception: " << ex.what(); } diff --git a/src/tests/system-tests/obs_gps_l1_system_test.cc b/src/tests/system-tests/obs_gps_l1_system_test.cc index b0b15103d..bfef41098 100644 --- a/src/tests/system-tests/obs_gps_l1_system_test.cc +++ b/src/tests/system-tests/obs_gps_l1_system_test.cc @@ -329,11 +329,11 @@ int ObsGpsL1SystemTest::run_receiver() { control_thread->run(); } - catch( boost::exception & e ) + catch(const boost::exception & e) { std::cout << "Boost exception: " << boost::diagnostic_information(e); } - catch(std::exception const& ex) + catch(const std::exception & ex) { std::cout << "STD exception: " << ex.what(); } @@ -413,12 +413,12 @@ void ObsGpsL1SystemTest::check_results() } // end for } // end while } // End of 'try' block - catch(gpstk::FFStreamError& e) + catch(const gpstk::FFStreamError& e) { std::cout << e; exit(1); } - catch(gpstk::Exception& e) + catch(const gpstk::Exception& e) { std::cout << e; exit(1); @@ -473,12 +473,12 @@ void ObsGpsL1SystemTest::check_results() } // end for } // end while } // End of 'try' block - catch(gpstk::FFStreamError& e) + catch(const gpstk::FFStreamError& e) { std::cout << e; exit(1); } - catch(gpstk::Exception& e) + catch(const gpstk::Exception& e) { std::cout << e; exit(1); diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 51182b8d7..5f83e6514 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -417,11 +417,11 @@ int StaticPositionSystemTest::run_receiver() { control_thread->run(); } - catch( boost::exception & e ) + catch(const boost::exception & e) { std::cout << "Boost exception: " << boost::diagnostic_information(e); } - catch(std::exception const& ex) + catch(const std::exception & ex) { std::cout << "STD exception: " << ex.what(); } diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc index 7fa1b1178..323c5776a 100644 --- a/src/tests/system-tests/ttff_gps_l1.cc +++ b/src/tests/system-tests/ttff_gps_l1.cc @@ -489,11 +489,11 @@ TEST_F(TfttGpsL1CATest, ColdStart) { control_thread->run(); } - catch( boost::exception & e ) + catch(const boost::exception & e) { std::cout << "Boost exception: " << boost::diagnostic_information(e); } - catch(std::exception const& ex) + catch(const std::exception & ex) { std::cout << "STD exception: " << ex.what(); } @@ -572,11 +572,11 @@ TEST_F(TfttGpsL1CATest, HotStart) { control_thread->run(); } - catch( boost::exception & e ) + catch(const boost::exception & e) { std::cout << "Boost exception: " << boost::diagnostic_information(e); } - catch(std::exception const& ex) + catch(const std::exception & ex) { std::cout << "STD exception: " << ex.what(); } diff --git a/src/tests/unit-tests/control-plane/control_thread_test.cc b/src/tests/unit-tests/control-plane/control_thread_test.cc index 686c2dc15..ac3f00bff 100644 --- a/src/tests/unit-tests/control-plane/control_thread_test.cc +++ b/src/tests/unit-tests/control-plane/control_thread_test.cc @@ -130,11 +130,11 @@ TEST_F(ControlThreadTest, InstantiateRunControlMessages) { control_thread->run(); } - catch( boost::exception & e ) + catch(const boost::exception & e) { std::cout << "Boost exception: " << boost::diagnostic_information(e); } - catch(std::exception const& ex) + catch(const std::exception & ex) { std::cout << "STD exception: " << ex.what(); } @@ -193,11 +193,11 @@ TEST_F(ControlThreadTest, InstantiateRunControlMessages2) { control_thread2->run(); } - catch( boost::exception & e ) + catch(const boost::exception & e) { std::cout << "Boost exception: " << boost::diagnostic_information(e); } - catch(std::exception const& ex) + catch(const std::exception & ex) { std::cout << "STD exception: " << ex.what(); } @@ -249,11 +249,11 @@ TEST_F(ControlThreadTest, StopReceiverProgrammatically) { control_thread->run(); } - catch( boost::exception & e ) + catch(const boost::exception & e) { std::cout << "Boost exception: " << boost::diagnostic_information(e); } - catch(std::exception const& ex) + catch(const std::exception & ex) { std::cout << "STD exception: " << ex.what(); } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc index fafa14140..b80a48b65 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc @@ -357,7 +357,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::wait_message() { channel_internal_queue.wait_and_pop(message); } - catch( boost::exception & e ) + catch( const boost::exception & e ) { DLOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e); } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc index 0bda37561..ee6e197ec 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -187,7 +187,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::wait_message() channel_internal_queue.wait_and_pop(message); stop_queue(); } - catch( boost::exception & e ) + catch( const boost::exception & e ) { DLOG(WARNING) << "Boost exception: " << boost::diagnostic_information(e); } diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc index e550e1fa3..13c28d711 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc @@ -61,7 +61,7 @@ TEST(RtcmPrinterTest, Run) // xml >> boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", gps_ephemeris_map); // ifs.close(); // } - // catch (std::exception& e) + // catch (const std::exception& e) // { // //LOG(WARNING) << e.what() << "File: " << file_name; // //std::cout << "File not found" << std::endl;