1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 22:43:14 +00:00

Apply readability-redundant-control-flow check

This commit is contained in:
Carles Fernandez 2019-08-12 22:54:27 +02:00
parent 1c67a10936
commit b16ee3d919
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
8 changed files with 149 additions and 153 deletions

View File

@ -373,7 +373,6 @@ void beidou_b1i_telemetry_decoder_gs::reset()
d_sent_tlm_failed_msg = false; d_sent_tlm_failed_msg = false;
d_flag_valid_word = false; d_flag_valid_word = false;
DLOG(INFO) << "Beidou B1I Telemetry decoder reset for satellite " << d_satellite; DLOG(INFO) << "Beidou B1I Telemetry decoder reset for satellite " << d_satellite;
return;
} }
int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),

View File

@ -395,7 +395,6 @@ void beidou_b3i_telemetry_decoder_gs::reset()
d_sent_tlm_failed_msg = false; d_sent_tlm_failed_msg = false;
d_flag_valid_word = false; d_flag_valid_word = false;
DLOG(INFO) << "Beidou B3I Telemetry decoder reset for satellite " << d_satellite; DLOG(INFO) << "Beidou B3I Telemetry decoder reset for satellite " << d_satellite;
return;
} }

View File

@ -374,9 +374,9 @@ void Viterbi_Decoder::nsc_transit(int output_p[], int trans_p[], int input, cons
output_p[state] = nsc_enc_bit(nextstate, input, state, g, KK, nn); output_p[state] = nsc_enc_bit(nextstate, input, state, g, KK, nn);
trans_p[state] = nextstate[0]; trans_p[state] = nextstate[0];
} }
return;
} }
/* Function nsc_enc_bit() /* Function nsc_enc_bit()
Description: Convolutionally encodes a single bit using a rate 1/n encoder. Description: Convolutionally encodes a single bit using a rate 1/n encoder.
@ -395,7 +395,6 @@ void Viterbi_Decoder::nsc_transit(int output_p[], int trans_p[], int input, cons
(i.e. the state after encoding this bit) (i.e. the state after encoding this bit)
This function is used by rsc_encode(), nsc_transit(), rsc_transit(), and nsc_transit() */ This function is used by rsc_encode(), nsc_transit(), rsc_transit(), and nsc_transit() */
int Viterbi_Decoder::nsc_enc_bit(int state_out_p[], int input, int state_in, int Viterbi_Decoder::nsc_enc_bit(int state_out_p[], int input, int state_in,
const int g[], int KK, int nn) const int g[], int KK, int nn)
{ {

View File

@ -102,8 +102,7 @@ void Tcp_Communication::send_receive_tcp_packet_galileo_e1(boost::array<float, N
std::cerr << "Exception: " << e.what() << ". Please press Ctrl+C to end the program." << std::endl; std::cerr << "Exception: " << e.what() << ". Please press Ctrl+C to end the program." << std::endl;
std::cin >> controlc; std::cin >> controlc;
} }
return; }
}
void Tcp_Communication::send_receive_tcp_packet_gps_l1_ca(boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> buf, Tcp_Packet_Data* tcp_data_) void Tcp_Communication::send_receive_tcp_packet_gps_l1_ca(boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> buf, Tcp_Packet_Data* tcp_data_)
@ -137,8 +136,7 @@ void Tcp_Communication::send_receive_tcp_packet_gps_l1_ca(boost::array<float, NU
std::cerr << "Exception: " << e.what() << ". Please press Ctrl+C to end the program." << std::endl; std::cerr << "Exception: " << e.what() << ". Please press Ctrl+C to end the program." << std::endl;
std::cin >> controlc; std::cin >> controlc;
} }
return; }
}
void Tcp_Communication::close_tcp_connection(size_t d_port_) void Tcp_Communication::close_tcp_connection(size_t d_port_)
@ -146,5 +144,4 @@ void Tcp_Communication::close_tcp_connection(size_t d_port_)
// Close the TCP connection // Close the TCP connection
tcp_socket_.close(); tcp_socket_.close();
std::cout << "Socket closed on port " << d_port_ << std::endl; std::cout << "Socket closed on port " << d_port_ << std::endl;
return;
} }

View File

@ -1,93 +1,95 @@
#include "asn_internal.h"
#include "constraints.h" #include "constraints.h"
#include "asn_internal.h"
int int asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor,
asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key)
const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { {
(void)type_descriptor; /* Unused argument */
(void)struct_ptr; /* Unused argument */
(void)cb; /* Unused argument */
(void)key; /* Unused argument */
(void)type_descriptor; /* Unused argument */ /* Nothing to check */
(void)struct_ptr; /* Unused argument */ return 0;
(void)cb; /* Unused argument */
(void)key; /* Unused argument */
/* Nothing to check */
return 0;
} }
int int asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor,
asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key)
const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { {
(void)type_descriptor; /* Unused argument */
(void)struct_ptr; /* Unused argument */
(void)cb; /* Unused argument */
(void)key; /* Unused argument */
(void)type_descriptor; /* Unused argument */ /* Unknown how to check */
(void)struct_ptr; /* Unused argument */ return 0;
(void)cb; /* Unused argument */
(void)key; /* Unused argument */
/* Unknown how to check */
return 0;
} }
struct errbufDesc { struct errbufDesc
asn_TYPE_descriptor_t *failed_type; {
const void *failed_struct_ptr; asn_TYPE_descriptor_t *failed_type;
char *errbuf; const void *failed_struct_ptr;
size_t errlen; char *errbuf;
size_t errlen;
}; };
static void static void
_asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...) { _asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...)
struct errbufDesc *arg = key; {
va_list ap; struct errbufDesc *arg = key;
ssize_t vlen; va_list ap;
ssize_t maxlen; ssize_t vlen;
ssize_t maxlen;
arg->failed_type = td; arg->failed_type = td;
arg->failed_struct_ptr = sptr; arg->failed_struct_ptr = sptr;
maxlen = arg->errlen; maxlen = arg->errlen;
if(maxlen <= 0) if (maxlen <= 0)
return; return;
va_start(ap, fmt); va_start(ap, fmt);
vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap); vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap);
va_end(ap); va_end(ap);
if(vlen >= maxlen) { if (vlen >= maxlen)
arg->errbuf[maxlen-1] = '\0'; /* Ensuring libc correctness */ {
arg->errlen = maxlen - 1; /* Not counting termination */ arg->errbuf[maxlen - 1] = '\0'; /* Ensuring libc correctness */
return; arg->errlen = maxlen - 1; /* Not counting termination */
} else if(vlen >= 0) { return;
arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ }
arg->errlen = vlen; /* Not counting termination */ else if (vlen >= 0)
} else { {
/* arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */
arg->errlen = vlen; /* Not counting termination */
}
else
{
/*
* The libc on this system is broken. * The libc on this system is broken.
*/ */
vlen = sizeof("<broken vsnprintf>") - 1; vlen = sizeof("<broken vsnprintf>") - 1;
maxlen--; maxlen--;
arg->errlen = vlen < maxlen ? vlen : maxlen; arg->errlen = vlen < maxlen ? vlen : maxlen;
memcpy(arg->errbuf, "<broken vsnprintf>", arg->errlen); memcpy(arg->errbuf, "<broken vsnprintf>", arg->errlen);
arg->errbuf[arg->errlen] = 0; arg->errbuf[arg->errlen] = 0;
} }
return;
} }
int int asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor,
asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr, char *errbuf, size_t *errlen)
const void *struct_ptr, char *errbuf, size_t *errlen) { {
struct errbufDesc arg; struct errbufDesc arg;
int ret; int ret;
arg.failed_type = 0; arg.failed_type = 0;
arg.failed_struct_ptr = 0; arg.failed_struct_ptr = 0;
arg.errbuf = errbuf; arg.errbuf = errbuf;
arg.errlen = errlen ? *errlen : 0; arg.errlen = errlen ? *errlen : 0;
ret = type_descriptor->check_constraints(type_descriptor, ret = type_descriptor->check_constraints(type_descriptor,
struct_ptr, _asn_i_ctfailcb, &arg); struct_ptr, _asn_i_ctfailcb, &arg);
if(ret == -1 && errlen) if (ret == -1 && errlen)
*errlen = arg.errlen; *errlen = arg.errlen;
return ret; return ret;
} }

View File

@ -1,93 +1,95 @@
#include "asn_internal.h"
#include "constraints.h" #include "constraints.h"
#include "asn_internal.h"
int int asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor,
asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key)
const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { {
(void)type_descriptor; /* Unused argument */
(void)struct_ptr; /* Unused argument */
(void)cb; /* Unused argument */
(void)key; /* Unused argument */
(void)type_descriptor; /* Unused argument */ /* Nothing to check */
(void)struct_ptr; /* Unused argument */ return 0;
(void)cb; /* Unused argument */
(void)key; /* Unused argument */
/* Nothing to check */
return 0;
} }
int int asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor,
asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key)
const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { {
(void)type_descriptor; /* Unused argument */
(void)struct_ptr; /* Unused argument */
(void)cb; /* Unused argument */
(void)key; /* Unused argument */
(void)type_descriptor; /* Unused argument */ /* Unknown how to check */
(void)struct_ptr; /* Unused argument */ return 0;
(void)cb; /* Unused argument */
(void)key; /* Unused argument */
/* Unknown how to check */
return 0;
} }
struct errbufDesc { struct errbufDesc
asn_TYPE_descriptor_t *failed_type; {
const void *failed_struct_ptr; asn_TYPE_descriptor_t *failed_type;
char *errbuf; const void *failed_struct_ptr;
size_t errlen; char *errbuf;
size_t errlen;
}; };
static void static void
_asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...) { _asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...)
struct errbufDesc *arg = key; {
va_list ap; struct errbufDesc *arg = key;
ssize_t vlen; va_list ap;
ssize_t maxlen; ssize_t vlen;
ssize_t maxlen;
arg->failed_type = td; arg->failed_type = td;
arg->failed_struct_ptr = sptr; arg->failed_struct_ptr = sptr;
maxlen = arg->errlen; maxlen = arg->errlen;
if(maxlen <= 0) if (maxlen <= 0)
return; return;
va_start(ap, fmt); va_start(ap, fmt);
vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap); vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap);
va_end(ap); va_end(ap);
if(vlen >= maxlen) { if (vlen >= maxlen)
arg->errbuf[maxlen-1] = '\0'; /* Ensuring libc correctness */ {
arg->errlen = maxlen - 1; /* Not counting termination */ arg->errbuf[maxlen - 1] = '\0'; /* Ensuring libc correctness */
return; arg->errlen = maxlen - 1; /* Not counting termination */
} else if(vlen >= 0) { return;
arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ }
arg->errlen = vlen; /* Not counting termination */ else if (vlen >= 0)
} else { {
/* arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */
arg->errlen = vlen; /* Not counting termination */
}
else
{
/*
* The libc on this system is broken. * The libc on this system is broken.
*/ */
vlen = sizeof("<broken vsnprintf>") - 1; vlen = sizeof("<broken vsnprintf>") - 1;
maxlen--; maxlen--;
arg->errlen = vlen < maxlen ? vlen : maxlen; arg->errlen = vlen < maxlen ? vlen : maxlen;
memcpy(arg->errbuf, "<broken vsnprintf>", arg->errlen); memcpy(arg->errbuf, "<broken vsnprintf>", arg->errlen);
arg->errbuf[arg->errlen] = 0; arg->errbuf[arg->errlen] = 0;
} }
return;
} }
int int asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor,
asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr, char *errbuf, size_t *errlen)
const void *struct_ptr, char *errbuf, size_t *errlen) { {
struct errbufDesc arg; struct errbufDesc arg;
int ret; int ret;
arg.failed_type = 0; arg.failed_type = 0;
arg.failed_struct_ptr = 0; arg.failed_struct_ptr = 0;
arg.errbuf = errbuf; arg.errbuf = errbuf;
arg.errlen = errlen ? *errlen : 0; arg.errlen = errlen ? *errlen : 0;
ret = type_descriptor->check_constraints(type_descriptor, ret = type_descriptor->check_constraints(type_descriptor,
struct_ptr, _asn_i_ctfailcb, &arg); struct_ptr, _asn_i_ctfailcb, &arg);
if(ret == -1 && errlen) if (ret == -1 && errlen)
*errlen = arg.errlen; *errlen = arg.errlen;
return ret; return ret;
} }

View File

@ -283,7 +283,6 @@ void Gnss_Satellite::set_rf_link(int32_t rf_link_)
{ {
// Set satellite's rf link. Identifies the GLONASS Frequency Channel // Set satellite's rf link. Identifies the GLONASS Frequency Channel
rf_link = rf_link_; rf_link = rf_link_;
return;
} }

View File

@ -293,7 +293,6 @@ void receive_msg()
} }
} }
} }
return;
} }