1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-06-20 07:24:08 +00:00

Fix performance inefficiencies detected by Coverity Scan

This commit is contained in:
Carles Fernandez 2023-11-29 23:45:38 +01:00
parent 1a270281c0
commit 699050baaf
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
11 changed files with 14 additions and 14 deletions

View File

@ -647,7 +647,7 @@ private:
inline void join(const std::shared_ptr<RtcmListener>& participant) inline void join(const std::shared_ptr<RtcmListener>& participant)
{ {
participants_.insert(participant); participants_.insert(participant);
for (auto msg : recent_msgs_) for (const auto& msg : recent_msgs_)
{ {
participant->deliver(msg); participant->deliver(msg);
} }

View File

@ -97,7 +97,7 @@ public:
*/ */
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
{ {
channel_fsm_ = channel_fsm; channel_fsm_ = std::move(channel_fsm);
acquisition_->set_channel_fsm(channel_fsm_); acquisition_->set_channel_fsm(channel_fsm_);
} }

View File

@ -55,7 +55,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
acq_parameters.fs_in = fs_in_; acq_parameters.fs_in = fs_in_;
acq_parameters.samples_per_chip = static_cast<unsigned int>(ceil(GPS_L1_CA_CHIP_PERIOD_S * static_cast<float>(acq_parameters.fs_in))); acq_parameters.samples_per_chip = static_cast<unsigned int>(ceil(GPS_L1_CA_CHIP_PERIOD_S * static_cast<float>(acq_parameters.fs_in)));
acq_parameters.dump = dump_; acq_parameters.dump = dump_;
dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename));
acq_parameters.dump_filename = dump_filename_; acq_parameters.dump_filename = dump_filename_;
if (FLAGS_doppler_max != 0) if (FLAGS_doppler_max != 0)
{ {

View File

@ -46,7 +46,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
{ {
const std::string default_item_type("gr_complex"); const std::string default_item_type("gr_complex");
std::string default_dump_filename = "./data/acquisition.dat"; std::string default_dump_filename = "./data/acquisition.dat";
dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename));
item_type_ = configuration->property(role_ + ".item_type", default_item_type); item_type_ = configuration->property(role_ + ".item_type", default_item_type);
int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);

View File

@ -99,7 +99,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
max_dwells_ = 2; max_dwells_ = 2;
} }
dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename));
bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false); bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false);

View File

@ -61,7 +61,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
item_type_ = configuration_->property(role_ + ".item_type", default_item_type); item_type_ = configuration_->property(role_ + ".item_type", default_item_type);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename));
if (FLAGS_doppler_max != 0) if (FLAGS_doppler_max != 0)
{ {

View File

@ -84,7 +84,7 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
{ {
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1); std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/')); dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/'));
d_dump_filename = dump_filename_; d_dump_filename = std::move(dump_filename_);
} }
else else
{ {

View File

@ -113,7 +113,7 @@ hybrid_observables_gs::hybrid_observables_gs(const Obs_Conf &conf_)
{ {
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1); std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/')); dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/'));
d_dump_filename = dump_filename_; d_dump_filename = std::move(dump_filename_);
} }
else else
{ {

View File

@ -574,7 +574,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_)
{ {
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1); std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/')); dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/'));
d_dump_filename = dump_filename_; d_dump_filename = std::move(dump_filename_);
} }
else else
{ {
@ -1572,7 +1572,7 @@ int32_t dll_pll_veml_tracking::save_matfile() const
// WRITE MAT FILE // WRITE MAT FILE
mat_t *matfp; mat_t *matfp;
matvar_t *matvar; matvar_t *matvar;
std::string filename = dump_filename_; std::string filename = std::move(dump_filename_);
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);

View File

@ -1209,7 +1209,7 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() const
// WRITE MAT FILE // WRITE MAT FILE
mat_t *matfp; mat_t *matfp;
matvar_t *matvar; matvar_t *matvar;
std::string filename = dump_filename_; std::string filename = std::move(dump_filename_);
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);

View File

@ -564,7 +564,7 @@ kf_tracking::kf_tracking(const Kf_Conf &conf_)
{ {
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1); std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/')); dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/'));
d_dump_filename = dump_filename_; d_dump_filename = std::move(dump_filename_);
} }
else else
{ {
@ -911,7 +911,7 @@ void kf_tracking::update_kf_narrow_integration_time()
Qnew += d_F * d_Q * d_F.t(); Qnew += d_F * d_Q * d_F.t();
d_Q = d_F * d_Q * d_F.t(); d_Q = d_F * d_Q * d_F.t();
} }
d_Q = Qnew; d_Q = std::move(Qnew);
// state vector: code_phase_chips, carrier_phase_rads, carrier_freq_hz, carrier_freq_rate_hz // state vector: code_phase_chips, carrier_phase_rads, carrier_freq_hz, carrier_freq_rate_hz
d_F = {{1.0, 0.0, d_beta * Ti, d_beta * TiTi / 2.0}, d_F = {{1.0, 0.0, d_beta * Ti, d_beta * TiTi / 2.0},
@ -1629,7 +1629,7 @@ int32_t kf_tracking::save_matfile() const
// WRITE MAT FILE // WRITE MAT FILE
mat_t *matfp; mat_t *matfp;
matvar_t *matvar; matvar_t *matvar;
std::string filename = dump_filename_; std::string filename = std::move(dump_filename_);
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);