mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 19:50:34 +00:00
fixing coverity issues
This commit is contained in:
parent
2613bc30e4
commit
b8ed6fc7f1
@ -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)
|
||||
|
@ -127,4 +127,4 @@ void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, char _Sig
|
||||
}
|
||||
|
||||
free(_code);
|
||||
}
|
||||
|
||||
|
@ -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,7 +56,7 @@ 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)
|
||||
{
|
||||
@ -65,8 +65,10 @@ void gps_l2c_m_code_gen_complex(std::complex<float>* _dest, unsigned int _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,8 +77,7 @@ 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];
|
||||
|
||||
int32_t* _code = new int32_t[GPS_L2_M_CODE_LENGTH_CHIPS];
|
||||
if (_prn > 0 and _prn < 51)
|
||||
{
|
||||
gps_l2c_m_code(_code, _prn);
|
||||
@ -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;
|
||||
|
||||
@ -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,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