1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-20 17:14:55 +00:00

Fix shadowed variables

This commit is contained in:
Carles Fernandez
2020-02-26 18:16:04 +01:00
parent 57517b44dd
commit 538c1e6182
18 changed files with 77 additions and 89 deletions

View File

@@ -1673,7 +1673,7 @@ int32_t Rtcm::read_MT1019(const std::string& message, Gps_Ephemeris& gps_eph)
gps_eph.d_Cuc = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * C_UC_LSB;
index += 16;
gps_eph.d_e_eccentricity = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 32))) * E_LSB;
gps_eph.d_e_eccentricity = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 32))) * ECCENTRICITY_LSB;
index += 32;
gps_eph.d_Cus = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * C_US_LSB;
@@ -4372,7 +4372,7 @@ int32_t Rtcm::set_DF089(const Gps_Ephemeris& gps_eph)
int32_t Rtcm::set_DF090(const Gps_Ephemeris& gps_eph)
{
auto ecc = static_cast<uint64_t>(std::round(gps_eph.d_e_eccentricity / E_LSB));
auto ecc = static_cast<uint64_t>(std::round(gps_eph.d_e_eccentricity / ECCENTRICITY_LSB));
DF090 = std::bitset<32>(ecc);
return 0;
}

View File

@@ -120,7 +120,7 @@ serial_t *openserial(const char *path, int mode, char *msg)
std::string s_aux = "/dev/" + std::string(port);
s_aux.resize(128, '\0');
int n = s_aux.length();
for (int i = 0; i < n; i++)
for (i = 0; i < n; i++)
{
dev[i] = s_aux[i];
}
@@ -695,7 +695,7 @@ void syncfile(file_t *file1, file_t *file2)
void decodetcppath(const char *path, char *addr, char *port, char *user,
char *passwd, char *mntpnt, char *str)
{
char buff[MAXSTRPATH];
char buff[MAXSTRPATH] = "";
char *p;
char *q;
@@ -1556,7 +1556,7 @@ int rspntrip_s(ntrip_t *ntrip, char *msg)
// strncpy(msg, (char *)ntrip->buff, nb); This line triggers a warning. Replaced by;
std::string s_aux(reinterpret_cast<char *>(ntrip->buff));
s_aux.resize(nb, '\0');
for (int i = 0; i < nb; i++)
for (i = 0; i < nb; i++)
{
msg[i] = s_aux[i];
}
@@ -1815,7 +1815,7 @@ int statentrip(ntrip_t *ntrip)
void decodeftppath(const char *path, char *addr, char *file, char *user,
char *passwd, int *topts)
{
char buff[MAXSTRPATH];
char buff[MAXSTRPATH] = "";
char *p;
char *q;
@@ -2006,9 +2006,9 @@ void *ftpthread(void *arg)
/* download command (ref [2]) */
if (ftp->proto == 0)
{ /* ftp */
std::string s_aux = "--ftp-user=" + std::string(ftp->user) + " --ftp-password=" + std::string(ftp->passwd) +
" --glob=off --passive-ftp " + std::string(proxyopt) + "s-t 1 -T " + std::to_string(FTP_TIMEOUT) +
" -O \"" + std::string(local) + "\"";
s_aux = "--ftp-user=" + std::string(ftp->user) + " --ftp-password=" + std::string(ftp->passwd) +
" --glob=off --passive-ftp " + std::string(proxyopt) + "s-t 1 -T " + std::to_string(FTP_TIMEOUT) +
" -O \"" + std::string(local) + "\"";
int k = s_aux.length();
if (k < 1024)
{
@@ -2018,8 +2018,8 @@ void *ftpthread(void *arg)
}
}
std::string s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"ftp://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"ftp://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
k = s_aux2.length();
for (int i = 0; (i < k) && (i < 1024); i++)
{
@@ -2028,15 +2028,15 @@ void *ftpthread(void *arg)
}
else
{ /* http */
std::string s_aux = std::string(proxyopt) + " -t 1 -T " + std::to_string(FTP_TIMEOUT) + " -O \"" + std::string(local) + "\"";
s_aux = std::string(proxyopt) + " -t 1 -T " + std::to_string(FTP_TIMEOUT) + " -O \"" + std::string(local) + "\"";
int l = s_aux.length();
for (int i = 0; (i < l) && (i < 1024); i++)
{
opt[i] = s_aux[i];
}
std::string s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"http://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"http://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
l = s_aux2.length();
for (int i = 0; (i < l) && (i < 1024); i++)
{
@@ -2680,15 +2680,15 @@ void strsetopt(const int *opt)
/* set timeout time ------------------------------------------------------------
* set timeout time
* args : stream_t *stream I stream (STR_TCPCLI, STR_NTRIPCLI, STR_NTRIPSVR)
* int toinact I inactive timeout (ms) (0: no timeout)
* int inactive_timeout I inactive timeout (ms) (0: no timeout)
* int tirecon I reconnect interval (ms) (0: no reconnect)
* return : none
*-----------------------------------------------------------------------------*/
void strsettimeout(stream_t *stream, int toinact, int tirecon)
void strsettimeout(stream_t *stream, int inactive_timeout, int tirecon)
{
tcpcli_t *tcpcli;
tracet(3, "strsettimeout: toinact=%d tirecon=%d\n", toinact, tirecon);
tracet(3, "strsettimeout: toinact=%d tirecon=%d\n", inactive_timeout, tirecon);
if (stream->type == STR_TCPCLI)
{
@@ -2703,7 +2703,7 @@ void strsettimeout(stream_t *stream, int toinact, int tirecon)
return;
}
tcpcli->toinact = toinact;
tcpcli->toinact = inactive_timeout;
tcpcli->tirecon = tirecon;
}

View File

@@ -133,8 +133,6 @@ void signal_generator_c::init()
}
}
}
std::uniform_int_distribution<int> uniform_dist(0, RAND_MAX);
}

View File

@@ -579,20 +579,14 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
{
for (uint32_t i = 0; i < d_frame_length_symbols; i++)
{
for (uint32_t i = 0; i < d_frame_length_symbols; i++)
{
d_page_part_symbols[i] = d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now!
}
d_page_part_symbols[i] = d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now!
}
}
else // 180 deg. inverted carrier phase PLL lock
{
for (uint32_t i = 0; i < d_frame_length_symbols; i++)
{
for (uint32_t i = 0; i < d_frame_length_symbols; i++)
{
d_page_part_symbols[i] = -d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now!
}
d_page_part_symbols[i] = -d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now!
}
}
decode_FNAV_word(d_page_part_symbols.data(), d_frame_length_symbols);

View File

@@ -442,12 +442,12 @@ Viterbi_Decoder::Prev::Prev(int states, int t)
this->t = t;
num_states = states;
state.reserve(num_states);
bit.reserve(num_states);
metric.reserve(num_states);
v_bit.reserve(num_states);
v_metric.reserve(num_states);
refcount = 1;
std::fill_n(state.begin(), num_states, 0);
std::fill_n(bit.begin(), num_states, 0);
std::fill_n(metric.begin(), num_states, 0.0F);
std::fill_n(v_bit.begin(), num_states, 0);
std::fill_n(v_metric.begin(), num_states, 0.0F);
}
@@ -459,8 +459,8 @@ Viterbi_Decoder::Prev::Prev(const Prev& prev)
t = prev.t;
state = prev.state;
num_states = prev.num_states;
bit = prev.bit;
metric = prev.metric;
v_bit = prev.v_bit;
v_metric = prev.v_metric;
VLOG(LMORE) << "Prev("
<< "?"
<< ", " << t << ")"
@@ -490,8 +490,8 @@ Viterbi_Decoder::Prev& Viterbi_Decoder::Prev::operator=(const Prev& other)
// take over resources
t = other.t;
state = other.state;
bit = other.bit;
metric = other.metric;
v_bit = other.v_bit;
v_metric = other.v_metric;
VLOG(LMORE) << "Prev("
<< "?"
@@ -532,7 +532,7 @@ int Viterbi_Decoder::Prev::get_bit_of_current_state(int current_state)
// std::cout << "get prev bit : for state " << current_state << " at time " << t << ", the send bit is " << bit[current_state] << std::endl;
if (num_states > current_state)
{
return bit[current_state];
return v_bit[current_state];
}
return 0;
}
@@ -542,7 +542,7 @@ float Viterbi_Decoder::Prev::get_metric_of_current_state(int current_state)
{
if (num_states > current_state)
{
return metric[current_state];
return v_metric[current_state];
}
return 0;
}
@@ -567,7 +567,7 @@ void Viterbi_Decoder::Prev::set_decoded_bit_for_next_state(int next_state, int b
{
if (num_states > next_state)
{
this->bit[next_state] = bit;
this->v_bit[next_state] = bit;
}
}
@@ -576,6 +576,6 @@ void Viterbi_Decoder::Prev::set_survivor_branch_metric_of_next_state(int next_st
{
if (num_states > next_state)
{
this->metric[next_state] = metric;
this->v_metric[next_state] = metric;
}
}

View File

@@ -69,8 +69,8 @@ private:
private:
int t;
std::vector<int> state;
std::vector<int> bit;
std::vector<float> metric;
std::vector<int> v_bit;
std::vector<float> v_metric;
int refcount;
};