mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-09-03 11:27:59 +00:00
Fix defects detected by Coverity Scan
This commit is contained in:
@@ -40,7 +40,7 @@ uint32_t flags_from_config(const ConfigurationInterface* configuration)
|
||||
for (const auto& pair_aux : signal_flag_to_prop)
|
||||
{
|
||||
auto flag = pair_aux.first;
|
||||
auto prop = pair_aux.second;
|
||||
const auto& prop = pair_aux.second;
|
||||
const auto enabled = configuration->property(prop, 0) > 0;
|
||||
|
||||
if (enabled)
|
||||
|
@@ -108,7 +108,7 @@ void beidou_b3i_code_gen_int(own::span<int> dest, int32_t prn, uint32_t chip_shi
|
||||
std::bitset<13>(std::string("0010001001110"))};
|
||||
|
||||
// A simple error check
|
||||
if ((prn_idx < 0) || (prn_idx > 63))
|
||||
if ((prn_idx < 0) || (prn_idx > 62))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "sensor_data_aggregator.h"
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <utility>
|
||||
|
||||
SensorDataAggregator::SensorDataAggregator(const SensorDataSourceConfiguration& configuration, const std::vector<SensorIdentifier::value_type>& required_sensors)
|
||||
{
|
||||
@@ -123,7 +123,7 @@ void SensorDataAggregator::append_data(const pmt::pmt_t& data_dict)
|
||||
pmt::pmt_t key = pmt::car(pair);
|
||||
pmt::pmt_t val = pmt::cdr(pair);
|
||||
|
||||
std::string key_str = pmt::write_string(key);
|
||||
std::string key_str = pmt::write_string(std::move(key));
|
||||
SensorIdentifier::value_type sensor_id = SensorIdentifier::from_string(key_str);
|
||||
|
||||
if (sensor_id != SensorIdentifier::SAMPLE_STAMP and sensor_id != SensorIdentifier::CHUNK_COUNT)
|
||||
@@ -133,7 +133,7 @@ void SensorDataAggregator::append_data(const pmt::pmt_t& data_dict)
|
||||
case SensorDataType::F32:
|
||||
if (f32_data_.find(sensor_id) != f32_data_.end())
|
||||
{
|
||||
f32_data_.at(sensor_id).emplace_back(sample_stamp, pmt::to_float(val));
|
||||
f32_data_.at(sensor_id).emplace_back(sample_stamp, pmt::to_float(std::move(val)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -55,6 +55,7 @@ NTLabFileSignalSource::NTLabFileSignalSource(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::tuple<size_t, bool> NTLabFileSignalSource::itemTypeToSize()
|
||||
{
|
||||
auto is_complex_t = false;
|
||||
@@ -81,22 +82,26 @@ std::tuple<size_t, bool> NTLabFileSignalSource::itemTypeToSize()
|
||||
return std::make_tuple(item_size, is_complex_t);
|
||||
}
|
||||
|
||||
|
||||
double NTLabFileSignalSource::packetsPerSample() const
|
||||
{
|
||||
return 4 / n_channels_; // sampling instants in one byte depend on channel count
|
||||
return 4.0 / n_channels_; // sampling instants in one byte depend on channel count
|
||||
}
|
||||
|
||||
|
||||
gnss_shared_ptr<gr::block> NTLabFileSignalSource::source() const
|
||||
{
|
||||
return unpack_samples_;
|
||||
}
|
||||
|
||||
|
||||
void NTLabFileSignalSource::create_file_source_hook()
|
||||
{
|
||||
unpack_samples_ = make_unpack_ntlab_2bit_samples(item_size(), n_channels_);
|
||||
DLOG(INFO) << "unpack_byte_2bit_samples(" << unpack_samples_->unique_id() << ")";
|
||||
}
|
||||
|
||||
|
||||
void NTLabFileSignalSource::pre_connect_hook(gr::top_block_sptr top_block)
|
||||
{
|
||||
top_block->connect(file_source(), 0, unpack_samples_, 0);
|
||||
@@ -109,6 +114,7 @@ void NTLabFileSignalSource::pre_connect_hook(gr::top_block_sptr top_block)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NTLabFileSignalSource::pre_disconnect_hook(gr::top_block_sptr top_block)
|
||||
{
|
||||
top_block->disconnect(file_source(), 0, unpack_samples_, 0);
|
||||
@@ -121,12 +127,14 @@ void NTLabFileSignalSource::pre_disconnect_hook(gr::top_block_sptr top_block)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr NTLabFileSignalSource::get_left_block()
|
||||
{
|
||||
LOG(WARNING) << "Left block of a signal source should not be retrieved";
|
||||
return gr::block_sptr();
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr NTLabFileSignalSource::get_right_block()
|
||||
{
|
||||
return valve();
|
||||
|
Reference in New Issue
Block a user