mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 03:30:33 +00:00
fixing coverity issues
This commit is contained in:
commit
2b30d1df85
@ -153,7 +153,7 @@ void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signa
|
||||
const int _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; //Hz
|
||||
unsigned int _codeLength = Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||
int primary_code_E1_chips[(int)Galileo_E1_B_CODE_LENGTH_CHIPS];
|
||||
_samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength));
|
||||
_samplesPerCode = static_cast<unsigned int>( static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis )/ static_cast<double>(_codeLength)));
|
||||
const int _samplesPerChip = (_cboc == true) ? 12 : 2;
|
||||
|
||||
const unsigned int delay = (((int)Galileo_E1_B_CODE_LENGTH_CHIPS - _chip_shift)
|
||||
|
@ -109,7 +109,7 @@ void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, char _Sig
|
||||
|
||||
galileo_e5_a_code_gen_complex_primary(_code , _prn , _Signal);
|
||||
|
||||
_samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength));
|
||||
_samplesPerCode = static_cast<unsigned int>(static_cast<double>(_fs) / ( static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
||||
|
||||
delay = ((_codeLength - _chip_shift) % _codeLength) * _samplesPerCode / _codeLength;
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
int32_t gps_l2c_m_shift(int32_t x)
|
||||
{
|
||||
return (int32_t)((x>>1)^((x&1)*0445112474));
|
||||
return static_cast<int32_t>((x >> 1)^((x & 1) * 0445112474));
|
||||
}
|
||||
|
||||
void gps_l2c_m_code(int32_t * _dest, unsigned int _prn)
|
||||
@ -56,17 +56,19 @@ void gps_l2c_m_code(int32_t * _dest, unsigned int _prn)
|
||||
|
||||
void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
||||
{
|
||||
int32_t _code[GPS_L2_M_CODE_LENGTH_CHIPS];
|
||||
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
|
||||
|
||||
if (_prn>0 and _prn<51)
|
||||
{
|
||||
gps_l2c_m_code(_code, _prn);
|
||||
}
|
||||
if (_prn > 0 and _prn < 51)
|
||||
{
|
||||
gps_l2c_m_code(_code, _prn);
|
||||
}
|
||||
|
||||
for (signed int i = 0; i < GPS_L2_M_CODE_LENGTH_CHIPS; i++)
|
||||
{
|
||||
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[i], 0);
|
||||
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[i], 0.0);
|
||||
}
|
||||
|
||||
delete[] _code;
|
||||
}
|
||||
|
||||
|
||||
@ -75,12 +77,11 @@ void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, unsigned int _prn)
|
||||
*/
|
||||
void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs)
|
||||
{
|
||||
int32_t _code[GPS_L2_M_CODE_LENGTH_CHIPS];
|
||||
|
||||
if (_prn > 0 and _prn < 51)
|
||||
{
|
||||
gps_l2c_m_code(_code, _prn);
|
||||
}
|
||||
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
|
||||
if (_prn > 0 and _prn < 51)
|
||||
{
|
||||
gps_l2c_m_code(_code, _prn);
|
||||
}
|
||||
|
||||
signed int _samplesPerCode, _codeValueIndex;
|
||||
float _ts;
|
||||
@ -89,11 +90,11 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int
|
||||
const signed int _codeLength = GPS_L2_M_CODE_LENGTH_CHIPS;
|
||||
|
||||
//--- Find number of samples per spreading code ----------------------------
|
||||
_samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength));
|
||||
_samplesPerCode = static_cast<int>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
||||
|
||||
//--- Find time constants --------------------------------------------------
|
||||
_ts = 1/(float)_fs; // Sampling period in sec
|
||||
_tc = 1/(float)_codeFreqBasis; // C/A chip period in sec
|
||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
|
||||
|
||||
float aux;
|
||||
|
||||
@ -105,7 +106,7 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int
|
||||
// The length of the index array depends on the sampling frequency -
|
||||
// number of samples per millisecond (because one C/A code period is one
|
||||
// millisecond).
|
||||
//TODO: Check this formula! Seems to start with an extra sample
|
||||
//TODO: Check this formula! Seems to start with an extra sample
|
||||
|
||||
// _codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1;
|
||||
aux = (_ts * (i + 1)) / _tc;
|
||||
@ -125,6 +126,7 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int
|
||||
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeValueIndex], 0);; //repeat the chip -> upsample
|
||||
}
|
||||
}
|
||||
delete[] _code;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ void volk_gnsssdr_get_config_path(char *path)
|
||||
path[0] = 0;
|
||||
return;
|
||||
}
|
||||
strcpy(path, home);
|
||||
strncpy(path, home, 512);
|
||||
strcat(path, suffix);
|
||||
}
|
||||
|
||||
|
@ -93,14 +93,14 @@ galileo_e1_observables_cc::~galileo_e1_observables_cc()
|
||||
|
||||
|
||||
|
||||
bool Galileo_pairCompare_gnss_synchro_Prn_delay_ms( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
|
||||
bool Galileo_pairCompare_gnss_synchro_Prn_delay_ms(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
||||
{
|
||||
return (a.second.Prn_timestamp_ms) < (b.second.Prn_timestamp_ms);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Galileo_pairCompare_gnss_synchro_d_TOW_at_current_symbol( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
|
||||
bool Galileo_pairCompare_gnss_synchro_d_TOW_at_current_symbol(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
||||
{
|
||||
return (a.second.d_TOW_at_current_symbol) < (b.second.d_TOW_at_current_symbol);
|
||||
}
|
||||
|
@ -90,13 +90,13 @@ gps_l1_ca_observables_cc::~gps_l1_ca_observables_cc()
|
||||
}
|
||||
|
||||
|
||||
bool pairCompare_gnss_synchro_Prn_delay_ms( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
|
||||
bool pairCompare_gnss_synchro_Prn_delay_ms(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
||||
{
|
||||
return (a.second.Prn_timestamp_ms) < (b.second.Prn_timestamp_ms);
|
||||
}
|
||||
|
||||
|
||||
bool pairCompare_gnss_synchro_d_TOW_at_current_symbol( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
|
||||
bool pairCompare_gnss_synchro_d_TOW_at_current_symbol(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
||||
{
|
||||
return (a.second.d_TOW_at_current_symbol) < (b.second.d_TOW_at_current_symbol);
|
||||
}
|
||||
|
@ -93,18 +93,18 @@ hybrid_observables_cc::~hybrid_observables_cc()
|
||||
|
||||
|
||||
|
||||
bool Hybrid_pairCompare_gnss_synchro_Prn_delay_ms( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
|
||||
bool Hybrid_pairCompare_gnss_synchro_Prn_delay_ms(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
||||
{
|
||||
return (a.second.Prn_timestamp_ms) < (b.second.Prn_timestamp_ms);
|
||||
}
|
||||
|
||||
|
||||
bool Hybrid_pairCompare_gnss_synchro_d_TOW_hybrid_at_current_symbol( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
|
||||
bool Hybrid_pairCompare_gnss_synchro_d_TOW_hybrid_at_current_symbol(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
||||
{
|
||||
return (a.second.d_TOW_hybrid_at_current_symbol) < (b.second.d_TOW_hybrid_at_current_symbol);
|
||||
}
|
||||
|
||||
bool Hybrid_pairCompare_gnss_synchro_d_TOW_at_current_symbol( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
|
||||
bool Hybrid_pairCompare_gnss_synchro_d_TOW_at_current_symbol(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
||||
{
|
||||
return (a.second.d_TOW_at_current_symbol) < (b.second.d_TOW_at_current_symbol);
|
||||
}
|
||||
|
@ -100,6 +100,9 @@ public:
|
||||
Sbas_Time()
|
||||
{
|
||||
e_state = UNDEFINED;
|
||||
i_gps_week = 0;
|
||||
d_gps_sec = 0;
|
||||
d_time_stamp_sec = 0;
|
||||
}
|
||||
|
||||
Sbas_Time(double time_stamp_sec)
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include <ctime>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <boost/chrono.hpp>
|
||||
#include <gnuradio/top_block.h>
|
||||
@ -98,7 +99,9 @@ void GpsL2MPcpsAcquisitionTest::init()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "2S";
|
||||
strncpy(gnss_synchro.Signal, signal.c_str(), 3);
|
||||
//strncpy(gnss_synchro.Signal, signal.c_str(), 3);
|
||||
std::memcpy((void*)gnss_synchro.Signal, signal.c_str(), 3); // copy string into synchro char array: 2 char + null
|
||||
gnss_synchro.Signal[2] = 0; // make sure that string length is only two characters
|
||||
gnss_synchro.PRN = 7;
|
||||
|
||||
sampling_freqeuncy_hz = 5000000;
|
||||
|
Loading…
Reference in New Issue
Block a user