1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

Fix defects detected by Coverity Scan

This commit is contained in:
Carles Fernandez 2019-03-19 07:53:21 +01:00
parent 7fae75380f
commit 3cd1e70706
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 48 additions and 43 deletions

View File

@ -136,7 +136,8 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
d_stat = 0;
d_preamble_index = 0;
d_flag_frame_sync = false;
d_TOW_at_current_symbol_ms = 0;
d_TOW_at_current_symbol_ms = 0U;
d_TOW_at_Preamble_ms = 0U;
Flag_valid_word = false;
d_CRC_error_counter = 0;
d_flag_preamble = false;

View File

@ -74,45 +74,6 @@ dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_)
}
void dll_pll_veml_tracking::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
if (noutput_items != 0)
{
ninput_items_required[0] = static_cast<int32_t>(trk_parameters.vector_length) * 2;
}
}
void dll_pll_veml_tracking::msg_handler_telemetry_to_trk(const pmt::pmt_t &msg)
{
try
{
if (pmt::any_ref(msg).type() == typeid(int))
{
int tlm_event;
tlm_event = boost::any_cast<int>(pmt::any_ref(msg));
switch (tlm_event)
{
case 1: //tlm fault in current channel
{
DLOG(INFO) << "Telemetry fault received in ch " << this->d_channel;
gr::thread::scoped_lock lock(d_setlock);
d_carrier_lock_fail_counter = 10000; //force loss-of-lock condition
break;
}
default:
{
break;
}
}
}
}
catch (boost::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_telemetry_to_trk Bad any cast!";
}
}
dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::block("dll_pll_veml_tracking", gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
{
@ -468,6 +429,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
d_acq_sample_stamp = 0ULL;
d_current_prn_length_samples = static_cast<int32_t>(trk_parameters.vector_length);
d_current_correlation_time_s = 0.0;
// CN0 estimation and lock detector buffers
d_cn0_estimation_counter = 0;
@ -542,6 +504,48 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
}
void dll_pll_veml_tracking::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
if (noutput_items != 0)
{
ninput_items_required[0] = static_cast<int32_t>(trk_parameters.vector_length) * 2;
}
}
void dll_pll_veml_tracking::msg_handler_telemetry_to_trk(const pmt::pmt_t &msg)
{
try
{
if (pmt::any_ref(msg).type() == typeid(int))
{
int tlm_event;
tlm_event = boost::any_cast<int>(pmt::any_ref(msg));
switch (tlm_event)
{
case 1: //tlm fault in current channel
{
DLOG(INFO) << "Telemetry fault received in ch " << this->d_channel;
gr::thread::scoped_lock lock(d_setlock);
d_carrier_lock_fail_counter = 10000; //force loss-of-lock condition
break;
}
default:
{
break;
}
}
}
}
catch (boost::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_telemetry_to_trk Bad any cast!";
}
}
void dll_pll_veml_tracking::start_tracking()
{
gr::thread::scoped_lock l(d_setlock);

View File

@ -830,7 +830,7 @@ int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& s
d_eccentricity_msb = static_cast<double>(read_navigation_unsigned(subframe_bits, D2_E_MSB));
d_eccentricity_msb_bits = (read_navigation_unsigned(subframe_bits, D2_E_MSB));
// Adjust for lsb in next page (shift number of lsb to the left)
d_eccentricity_msb = static_cast<double>((static_cast<int>(d_eccentricity_msb) << 22));
d_eccentricity_msb = static_cast<uint64_t>((static_cast<int>(d_eccentricity_msb) << 22));
d_eccentricity_msb_bits = d_eccentricity_msb_bits << 22;
// Set system flags for message reception
@ -996,7 +996,7 @@ Beidou_Dnav_Ephemeris Beidou_Dnav_Navigation_Message::get_ephemeris()
eph.i_SV_accuracy = i_SV_accuracy;
eph.i_SV_health = i_SV_health;
eph.i_BEIDOU_week = i_BEIDOU_week;
eph.i_sig_type = i_signal_type;
eph.i_sig_type = i_signal_type;
eph.i_nav_type = 2;
eph.d_TOW = d_SOW;
@ -1043,7 +1043,7 @@ Beidou_Dnav_Ephemeris Beidou_Dnav_Navigation_Message::get_ephemeris()
eph.i_SV_accuracy = i_SV_accuracy;
eph.i_SV_health = i_SV_health;
eph.i_BEIDOU_week = i_BEIDOU_week;
eph.i_sig_type = i_signal_type;
eph.i_sig_type = i_signal_type;
eph.i_nav_type = 1; // MEO/IGSO
eph.d_TOW = d_SOW;