From 07259159afd4ac54d3a1056b2076e5581f53a882 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 22 Feb 2019 21:34:15 +0000 Subject: [PATCH] Apply clang-tidy checks --- src/algorithms/libs/rtklib/rtklib_rtkpos.cc | 5 +-- .../adapters/ad9361_fpga_signal_source.cc | 2 +- .../adapters/ad9361_fpga_signal_source.h | 2 +- .../adapters/custom_udp_signal_source.cc | 2 +- .../adapters/custom_udp_signal_source.h | 2 +- .../gr_complex_ip_packet_source.cc | 32 +++++++++---------- .../gr_complex_ip_packet_source.h | 8 ++--- .../signal_source/libs/fpga_switch.cc | 12 +++---- .../signal_source/libs/fpga_switch.h | 6 ++-- 9 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc index 40645f9a0..e59327680 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc @@ -57,6 +57,7 @@ #include "rtklib_pntpos.h" #include "rtklib_ppp.h" #include "rtklib_tides.h" +#include #include static int resamb_WLNL(rtk_t *rtk __attribute((unused)), const obsd_t *obs __attribute((unused)), const int *sat __attribute((unused)), @@ -2672,7 +2673,7 @@ int rtkpos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav) } rtk->sol.age = static_cast(timediff(rtk->sol.time, solb.time)); - if (fabs(rtk->sol.age) > TTOL_MOVEB) + if (std::fabs(rtk->sol.age) > TTOL_MOVEB) { errmsg(rtk, "time sync error for moving-base (age=%.1f)\n", rtk->sol.age); return 0; @@ -2692,7 +2693,7 @@ int rtkpos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav) { rtk->sol.age = static_cast(timediff(obs[0].time, obs[nu].time)); - if (fabs(rtk->sol.age) > opt->maxtdiff) + if (std::fabs(rtk->sol.age) > opt->maxtdiff) { errmsg(rtk, "age of differential error (age=%.1f)\n", rtk->sol.age); outsolstat(rtk); diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index a9cade7c5..5d989b956 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -110,7 +110,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configura std::string default_device_name = "/dev/uio13"; std::string device_name = configuration->property(role + ".devicename", default_device_name); int switch_position = configuration->property(role + ".switch_position", 0); - switch_fpga = std::make_shared(device_name); + switch_fpga = std::make_shared(device_name); switch_fpga->set_switch_position(switch_position); if (in_stream_ > 0) { diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index 79ebeff3e..9277c4c2b 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -114,7 +114,7 @@ private: boost::shared_ptr queue_; - std::shared_ptr switch_fpga; + std::shared_ptr switch_fpga; }; #endif /*GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc index 2f2e76ef3..2b4714bca 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -72,7 +72,7 @@ CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configurati // output item size is always gr_complex item_size_ = sizeof(gr_complex); - udp_gnss_rx_source_ = gr_complex_ip_packet_source::make(capture_device, + udp_gnss_rx_source_ = Gr_Complex_Ip_Packet_Source::make(capture_device, address, port, payload_bytes, diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h index bec7c3d73..18cc21c9e 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h @@ -97,7 +97,7 @@ private: bool dump_; std::string dump_filename_; std::vector> null_sinks_; - gr_complex_ip_packet_source::sptr udp_gnss_rx_source_; + Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_; std::vector> file_sink_; boost::shared_ptr queue_; }; diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index ba6a8ec3e..8085e9e81 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -75,8 +75,8 @@ typedef struct gr_udp_header } gr_udp_header; -gr_complex_ip_packet_source::sptr -gr_complex_ip_packet_source::make(std::string src_device, +Gr_Complex_Ip_Packet_Source::sptr +Gr_Complex_Ip_Packet_Source::make(std::string src_device, const std::string &origin_address, int udp_port, int udp_packet_size, @@ -85,7 +85,7 @@ gr_complex_ip_packet_source::make(std::string src_device, size_t item_size, bool IQ_swap_) { - return gnuradio::get_initial_sptr(new gr_complex_ip_packet_source(std::move(src_device), + return gnuradio::get_initial_sptr(new Gr_Complex_Ip_Packet_Source(std::move(src_device), origin_address, udp_port, udp_packet_size, @@ -99,7 +99,7 @@ gr_complex_ip_packet_source::make(std::string src_device, /* * The private constructor */ -gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device, +Gr_Complex_Ip_Packet_Source::Gr_Complex_Ip_Packet_Source(std::string src_device, __attribute__((unused)) const std::string &origin_address, int udp_port, int udp_packet_size, @@ -151,14 +151,14 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device, // Called by gnuradio to enable drivers, etc for i/o devices. -bool gr_complex_ip_packet_source::start() +bool Gr_Complex_Ip_Packet_Source::start() { std::cout << "gr_complex_ip_packet_source START\n"; // open the ethernet device if (open() == true) { // start pcap capture thread - d_pcap_thread = new boost::thread(boost::bind(&gr_complex_ip_packet_source::my_pcap_loop_thread, this, descr)); + d_pcap_thread = new boost::thread(boost::bind(&Gr_Complex_Ip_Packet_Source::my_pcap_loop_thread, this, descr)); return true; } else @@ -169,7 +169,7 @@ bool gr_complex_ip_packet_source::start() // Called by gnuradio to disable drivers, etc for i/o devices. -bool gr_complex_ip_packet_source::stop() +bool Gr_Complex_Ip_Packet_Source::stop() { std::cout << "gr_complex_ip_packet_source STOP\n"; if (descr != nullptr) @@ -182,7 +182,7 @@ bool gr_complex_ip_packet_source::stop() } -bool gr_complex_ip_packet_source::open() +bool Gr_Complex_Ip_Packet_Source::open() { char errbuf[PCAP_ERRBUF_SIZE]; boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function @@ -219,7 +219,7 @@ bool gr_complex_ip_packet_source::open() } -gr_complex_ip_packet_source::~gr_complex_ip_packet_source() +Gr_Complex_Ip_Packet_Source::~Gr_Complex_Ip_Packet_Source() { if (d_pcap_thread != nullptr) { @@ -230,15 +230,15 @@ gr_complex_ip_packet_source::~gr_complex_ip_packet_source() } -void gr_complex_ip_packet_source::static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, +void Gr_Complex_Ip_Packet_Source::static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet) { - auto *bridge = reinterpret_cast(args); + auto *bridge = reinterpret_cast(args); bridge->pcap_callback(args, pkthdr, packet); } -void gr_complex_ip_packet_source::pcap_callback(__attribute__((unused)) u_char *args, __attribute__((unused)) const struct pcap_pkthdr *pkthdr, +void Gr_Complex_Ip_Packet_Source::pcap_callback(__attribute__((unused)) u_char *args, __attribute__((unused)) const struct pcap_pkthdr *pkthdr, const u_char *packet) { boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function @@ -312,13 +312,13 @@ void gr_complex_ip_packet_source::pcap_callback(__attribute__((unused)) u_char * } -void gr_complex_ip_packet_source::my_pcap_loop_thread(pcap_t *pcap_handle) +void Gr_Complex_Ip_Packet_Source::my_pcap_loop_thread(pcap_t *pcap_handle) { - pcap_loop(pcap_handle, -1, gr_complex_ip_packet_source::static_pcap_callback, reinterpret_cast(this)); + pcap_loop(pcap_handle, -1, Gr_Complex_Ip_Packet_Source::static_pcap_callback, reinterpret_cast(this)); } -void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items, int num_samples_readed) +void Gr_Complex_Ip_Packet_Source::demux_samples(gr_vector_void_star output_items, int num_samples_readed) { int8_t real; int8_t imag; @@ -383,7 +383,7 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items } -int gr_complex_ip_packet_source::work(int noutput_items, +int Gr_Complex_Ip_Packet_Source::work(int noutput_items, __attribute__((unused)) gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h index d008e1314..8807be5bb 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h @@ -43,7 +43,7 @@ #include #include -class gr_complex_ip_packet_source : virtual public gr::sync_block +class Gr_Complex_Ip_Packet_Source : virtual public gr::sync_block { private: boost::mutex d_mutex; @@ -82,7 +82,7 @@ private: static void static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet); public: - typedef boost::shared_ptr sptr; + typedef boost::shared_ptr sptr; static sptr make(std::string src_device, const std::string &origin_address, int udp_port, @@ -91,7 +91,7 @@ public: const std::string &wire_sample_type, size_t item_size, bool IQ_swap_); - gr_complex_ip_packet_source(std::string src_device, + Gr_Complex_Ip_Packet_Source(std::string src_device, const std::string &origin_address, int udp_port, int udp_packet_size, @@ -99,7 +99,7 @@ public: const std::string &wire_sample_type, size_t item_size, bool IQ_swap_); - ~gr_complex_ip_packet_source(); + ~Gr_Complex_Ip_Packet_Source(); // Where all the action really happens int work(int noutput_items, diff --git a/src/algorithms/signal_source/libs/fpga_switch.cc b/src/algorithms/signal_source/libs/fpga_switch.cc index 71fd26eba..3f1caec12 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.cc +++ b/src/algorithms/signal_source/libs/fpga_switch.cc @@ -45,7 +45,7 @@ const size_t PAGE_SIZE = 0x10000; const unsigned int TEST_REGISTER_TRACK_WRITEVAL = 0x55AA; -fpga_switch::fpga_switch(const std::string &device_name) +Fpga_Switch::Fpga_Switch(const std::string &device_name) { if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) { @@ -67,7 +67,7 @@ fpga_switch::fpga_switch(const std::string &device_name) // sanity check : check test register unsigned writeval = TEST_REGISTER_TRACK_WRITEVAL; unsigned readval; - readval = fpga_switch::fpga_switch_test_register(writeval); + readval = Fpga_Switch::fpga_switch_test_register(writeval); if (writeval != readval) { LOG(WARNING) << "Test register sanity check failed"; @@ -81,19 +81,19 @@ fpga_switch::fpga_switch(const std::string &device_name) } -fpga_switch::~fpga_switch() +Fpga_Switch::~Fpga_Switch() { close_device(); } -void fpga_switch::set_switch_position(int switch_position) +void Fpga_Switch::set_switch_position(int switch_position) { d_map_base[0] = switch_position; } -unsigned fpga_switch::fpga_switch_test_register( +unsigned Fpga_Switch::fpga_switch_test_register( unsigned writeval) { unsigned readval; @@ -106,7 +106,7 @@ unsigned fpga_switch::fpga_switch_test_register( } -void fpga_switch::close_device() +void Fpga_Switch::close_device() { auto *aux = const_cast(d_map_base); if (munmap(static_cast(aux), PAGE_SIZE) == -1) diff --git a/src/algorithms/signal_source/libs/fpga_switch.h b/src/algorithms/signal_source/libs/fpga_switch.h index 2ab67dbef..f535bce7d 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.h +++ b/src/algorithms/signal_source/libs/fpga_switch.h @@ -41,11 +41,11 @@ #define MAX_LENGTH_DEVICEIO_NAME 50 -class fpga_switch +class Fpga_Switch { public: - fpga_switch(const std::string& device_name); - ~fpga_switch(); + Fpga_Switch(const std::string& device_name); + ~Fpga_Switch(); void set_switch_position(int switch_position); private: