1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-31 23:26:22 +00:00

Fix performance inefficiencies detected by Coverity Scan

This commit is contained in:
Carles Fernandez 2023-11-30 09:48:04 +01:00
parent 9c4090f71a
commit bd1f9e5ad9
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
7 changed files with 12 additions and 12 deletions

View File

@ -227,7 +227,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
{ {
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

@ -73,7 +73,7 @@ void ArraySignalConditioner::disconnect(gr::top_block_sptr top_block)
// data_type_adapt_->disconnect(top_block); // data_type_adapt_->disconnect(top_block);
in_filt_->disconnect(top_block); in_filt_->disconnect(top_block);
res_->disconnect(top_block); res_->disconnect(std::move(top_block));
connected_ = false; connected_ = false;
} }

View File

@ -101,7 +101,7 @@ void SignalConditioner::disconnect(gr::top_block_sptr top_block)
data_type_adapt_->disconnect(top_block); data_type_adapt_->disconnect(top_block);
in_filt_->disconnect(top_block); in_filt_->disconnect(top_block);
res_->disconnect(top_block); res_->disconnect(std::move(top_block));
connected_ = false; connected_ = false;
} }

View File

@ -186,11 +186,11 @@ void FileSourceBase::connect(gr::top_block_sptr top_block)
// DUMP // DUMP
if (sink()) if (sink())
{ {
top_block->connect(output, 0, sink(), 0); top_block->connect(std::move(output), 0, sink(), 0);
DLOG(INFO) << "connected output to file sink"; DLOG(INFO) << "connected output to file sink";
} }
post_connect_hook(top_block); post_connect_hook(std::move(top_block));
} }
@ -219,7 +219,7 @@ void FileSourceBase::disconnect(gr::top_block_sptr top_block)
// VALVE // VALVE
if (valve()) if (valve())
{ {
top_block->disconnect(input, 0, valve(), 0); top_block->disconnect(std::move(input), 0, valve(), 0);
DLOG(INFO) << "disconnected source to valve"; DLOG(INFO) << "disconnected source to valve";
output = valve(); output = valve();
@ -234,11 +234,11 @@ void FileSourceBase::disconnect(gr::top_block_sptr top_block)
// DUMP // DUMP
if (sink()) if (sink())
{ {
top_block->disconnect(output, 0, sink(), 0); top_block->disconnect(std::move(output), 0, sink(), 0);
DLOG(INFO) << "disconnected output to file sink"; DLOG(INFO) << "disconnected output to file sink";
} }
post_disconnect_hook(top_block); post_disconnect_hook(std::move(top_block));
} }

View File

@ -70,7 +70,7 @@ void GenSignalSource::disconnect(gr::top_block_sptr top_block)
filter_->get_left_block(), 0); filter_->get_left_block(), 0);
signal_generator_->disconnect(top_block); signal_generator_->disconnect(top_block);
filter_->disconnect(top_block); filter_->disconnect(std::move(top_block));
connected_ = false; connected_ = false;
} }

View File

@ -393,7 +393,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
if (page_part_bits[0] == 1) if (page_part_bits[0] == 1)
{ {
// DECODE COMPLETE WORD (even + odd) and TEST CRC // DECODE COMPLETE WORD (even + odd) and TEST CRC
d_inav_nav.split_page(page_String, d_flag_even_word_arrived); d_inav_nav.split_page(std::move(page_String), d_flag_even_word_arrived);
if (d_inav_nav.get_flag_CRC_test() == true) if (d_inav_nav.get_flag_CRC_test() == true)
{ {
if (d_band == '1') if (d_band == '1')
@ -421,7 +421,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
else else
{ {
// STORE HALF WORD (even page) // STORE HALF WORD (even page)
d_inav_nav.split_page(page_String, d_flag_even_word_arrived); d_inav_nav.split_page(std::move(page_String), d_flag_even_word_arrived);
d_flag_even_word_arrived = 1; d_flag_even_word_arrived = 1;
} }

View File

@ -209,7 +209,7 @@ Acquisition_Dump_Reader::Acquisition_Dump_Reader(const std::string& basename,
} }
d_num_doppler_bins = static_cast<unsigned int>(ceil(static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step))); d_num_doppler_bins = static_cast<unsigned int>(ceil(static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step)));
std::vector<std::vector<float> > mag_aux(d_num_doppler_bins, std::vector<float>(d_samples_per_code)); std::vector<std::vector<float> > mag_aux(d_num_doppler_bins, std::vector<float>(d_samples_per_code));
mag = mag_aux; mag = std::move(mag_aux);
d_dump_filename = d_basename + "_ch_" + std::to_string(channel) + "_" + std::to_string(execution) + "_sat_" + std::to_string(d_sat) + ".mat"; d_dump_filename = d_basename + "_ch_" + std::to_string(channel) + "_" + std::to_string(execution) + "_sat_" + std::to_string(d_sat) + ".mat";
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{ {