mirror of https://github.com/PentHertz/srsLTE.git
removed some clang warnings
This commit is contained in:
parent
62609fdc11
commit
aaa333c1ff
|
@ -148,12 +148,12 @@ SRSASN_CODE bit_ref::pack(uint32_t val, uint32_t n_bits)
|
||||||
val = val & mask;
|
val = val & mask;
|
||||||
uint8_t keepmask = ((uint8_t)-1) - (uint8_t)((1u << (8u - offset)) - 1u);
|
uint8_t keepmask = ((uint8_t)-1) - (uint8_t)((1u << (8u - offset)) - 1u);
|
||||||
if ((uint32_t)(8 - offset) > n_bits) {
|
if ((uint32_t)(8 - offset) > n_bits) {
|
||||||
uint8_t bit = (uint8_t)(val << (8u - offset - n_bits));
|
auto bit = static_cast<uint8_t>(val << (8u - offset - n_bits));
|
||||||
*ptr = ((*ptr) & keepmask) + bit;
|
*ptr = ((*ptr) & keepmask) + bit;
|
||||||
offset += n_bits;
|
offset += n_bits;
|
||||||
n_bits = 0;
|
n_bits = 0;
|
||||||
} else {
|
} else {
|
||||||
uint8_t bit = (uint8_t)(val >> (n_bits - 8u + offset));
|
auto bit = static_cast<uint8_t>(val >> (n_bits - 8u + offset));
|
||||||
*ptr = (*ptr & keepmask) + bit;
|
*ptr = (*ptr & keepmask) + bit;
|
||||||
n_bits -= (8 - offset);
|
n_bits -= (8 - offset);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
@ -182,7 +182,7 @@ SRSASN_CODE unpack_bits(T& val, Ptr& ptr, uint8_t& offset, const uint8_t* max_pt
|
||||||
offset += n_bits;
|
offset += n_bits;
|
||||||
n_bits = 0;
|
n_bits = 0;
|
||||||
} else {
|
} else {
|
||||||
uint8_t mask = (uint8_t)((1u << (8u - offset)) - 1u);
|
auto mask = static_cast<uint8_t>((1u << (8u - offset)) - 1u);
|
||||||
val += ((uint32_t)((*ptr) & mask)) << (n_bits - 8 + offset);
|
val += ((uint32_t)((*ptr) & mask)) << (n_bits - 8 + offset);
|
||||||
n_bits -= 8 - offset;
|
n_bits -= 8 - offset;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
@ -321,7 +321,7 @@ SRSASN_CODE bit_ref::align_bytes_zero()
|
||||||
log_error("Buffer size limit was achieved\n");
|
log_error("Buffer size limit was achieved\n");
|
||||||
return SRSASN_ERROR_ENCODE_FAIL;
|
return SRSASN_ERROR_ENCODE_FAIL;
|
||||||
}
|
}
|
||||||
uint8_t mask = (uint8_t)(256u - (1u << (8u - offset)));
|
auto mask = static_cast<uint8_t>(256u - (1u << (8u - offset)));
|
||||||
*ptr &= mask;
|
*ptr &= mask;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
ptr++;
|
ptr++;
|
||||||
|
@ -336,7 +336,7 @@ SRSASN_CODE pack_unsupported_ext_flag(bit_ref& bref, bool ext)
|
||||||
{
|
{
|
||||||
HANDLE_CODE(bref.pack(ext, 1));
|
HANDLE_CODE(bref.pack(ext, 1));
|
||||||
if (ext) {
|
if (ext) {
|
||||||
log_error("asn1 error: ASN extensions not currently supported\n");
|
log_error("ASN extensions not currently supported\n");
|
||||||
return SRSASN_ERROR_ENCODE_FAIL;
|
return SRSASN_ERROR_ENCODE_FAIL;
|
||||||
}
|
}
|
||||||
return SRSASN_SUCCESS;
|
return SRSASN_SUCCESS;
|
||||||
|
@ -346,7 +346,7 @@ SRSASN_CODE unpack_unsupported_ext_flag(bool& ext, bit_ref& bref)
|
||||||
{
|
{
|
||||||
SRSASN_CODE ret = bref.unpack(ext, 1);
|
SRSASN_CODE ret = bref.unpack(ext, 1);
|
||||||
if (ext) {
|
if (ext) {
|
||||||
log_error("asn1 error: ASN extensions not currently supported\n");
|
log_error("ASN extensions not currently supported\n");
|
||||||
return SRSASN_ERROR_DECODE_FAIL;
|
return SRSASN_ERROR_DECODE_FAIL;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -959,7 +959,7 @@ void number_to_octstring(uint8_t* ptr, uint64_t number, uint32_t nbytes)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < nbytes; ++i) {
|
for (uint32_t i = 0; i < nbytes; ++i) {
|
||||||
ptr[nbytes - 1 - i] = (number >> (uint64_t)(i * 8u)) & 0xFF;
|
ptr[nbytes - 1 - i] = (number >> (uint64_t)(i * 8u)) & 0xFFu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1184,7 +1184,7 @@ void from_number(uint8_t* ptr, uint64_t number, uint32_t nbits)
|
||||||
}
|
}
|
||||||
uint32_t offset = nbits % 8; // clean up any extra set bit
|
uint32_t offset = nbits % 8; // clean up any extra set bit
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
ptr[nof_bytes - 1] &= (uint8_t)((1 << offset) - 1);
|
ptr[nof_bytes - 1] &= (uint8_t)((1u << offset) - 1u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1234,7 +1234,7 @@ namespace asn_string_utils {
|
||||||
size_t get_nof_bits_per_char(size_t lb, size_t ub, bool aligned)
|
size_t get_nof_bits_per_char(size_t lb, size_t ub, bool aligned)
|
||||||
{
|
{
|
||||||
size_t N = ub - lb + 1;
|
size_t N = ub - lb + 1;
|
||||||
size_t b = (size_t)ceilf(log2(N)); // B
|
auto b = (size_t)ceilf(log2(N)); // B
|
||||||
if (aligned) {
|
if (aligned) {
|
||||||
b = (size_t)pow(2, ceilf(log2(b))); // B2
|
b = (size_t)pow(2, ceilf(log2(b))); // B2
|
||||||
}
|
}
|
||||||
|
@ -1277,8 +1277,8 @@ pack(bit_ref& bref, const std::string& s, size_t lb, size_t ub, size_t alb, size
|
||||||
if (octet_aligned) {
|
if (octet_aligned) {
|
||||||
bref.align_bytes_zero();
|
bref.align_bytes_zero();
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < s.size(); ++i) {
|
for (char c : s) {
|
||||||
HANDLE_CODE(bref.pack(s[i], b));
|
HANDLE_CODE(bref.pack(c, b));
|
||||||
}
|
}
|
||||||
return SRSASN_SUCCESS;
|
return SRSASN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1308,8 +1308,8 @@ SRSASN_CODE unpack(std::string& s, cbit_ref& bref, size_t lb, size_t ub, size_t
|
||||||
if (octet_aligned) {
|
if (octet_aligned) {
|
||||||
bref.align_bytes();
|
bref.align_bytes();
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < s.size(); ++i) {
|
for (char& c : s) {
|
||||||
HANDLE_CODE(bref.unpack(s[i], b));
|
HANDLE_CODE(bref.unpack(c, b));
|
||||||
}
|
}
|
||||||
return SRSASN_SUCCESS;
|
return SRSASN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1460,7 +1460,7 @@ void json_writer::write_fieldname(const std::string& fieldname)
|
||||||
} else if (sep == NEWLINE) {
|
} else if (sep == NEWLINE) {
|
||||||
ss << "\n" << ident;
|
ss << "\n" << ident;
|
||||||
}
|
}
|
||||||
if (fieldname.size() > 0) {
|
if (not fieldname.empty()) {
|
||||||
ss << "\"" << fieldname << "\": ";
|
ss << "\"" << fieldname << "\": ";
|
||||||
}
|
}
|
||||||
sep = NONE;
|
sep = NONE;
|
||||||
|
|
|
@ -152,7 +152,7 @@ srslte::rlc_config_t make_rlc_config_t(const asn1::rrc::srb_to_add_mod_s& asn1_t
|
||||||
if (asn1_type.srb_id <= 2) {
|
if (asn1_type.srb_id <= 2) {
|
||||||
return rlc_config_t::srb_config(asn1_type.srb_id);
|
return rlc_config_t::srb_config(asn1_type.srb_id);
|
||||||
} else {
|
} else {
|
||||||
srslte::logmap::get("ASN1::RRC")->error("SRB %d does not support default initialization type\n", asn1_type.srb_id);
|
asn1::log_error("SRB %d does not support default initialization type\n", asn1_type.srb_id);
|
||||||
return rlc_config_t();
|
return rlc_config_t();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,7 +351,7 @@ srsenb::sched_interface::ant_info_ded_t make_ant_info_ded(const asn1::rrc::ant_i
|
||||||
ant_ded.codebook_subset_restrict = asn1code.n4_tx_ant_tm6().to_number();
|
ant_ded.codebook_subset_restrict = asn1code.n4_tx_ant_tm6().to_number();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
srslte::logmap::get("ASN1::RRC")->error("Failed to convert antenna codebook type to number\n");
|
asn1::log_error("Failed to convert antenna codebook type to number\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ant_ded.ue_tx_ant_sel = srsenb::sched_interface::ant_info_ded_t::ue_tx_ant_sel_t::release;
|
ant_ded.ue_tx_ant_sel = srsenb::sched_interface::ant_info_ded_t::ue_tx_ant_sel_t::release;
|
||||||
|
|
|
@ -36,9 +36,9 @@ int test_generic()
|
||||||
|
|
||||||
// test logger handler
|
// test logger handler
|
||||||
{
|
{
|
||||||
srslte::scoped_log<srslte::nullsink_log> null_log("ASN1::RRC");
|
srslte::scoped_log<srslte::nullsink_log> null_log("ASN1");
|
||||||
null_log->set_level(srslte::LOG_LEVEL_INFO);
|
null_log->set_level(srslte::LOG_LEVEL_INFO);
|
||||||
srslte::logmap::get("ASN1::RRC")->info("This is a console test to see if the RRC logger is working fine\n");
|
asn1::log_info("This is a console test to see if the RRC logger is working fine\n");
|
||||||
TESTASSERT(null_log->last_log_msg == "This is a console test to see if the RRC logger is working fine\n");
|
TESTASSERT(null_log->last_log_msg == "This is a console test to see if the RRC logger is working fine\n");
|
||||||
TESTASSERT(null_log->last_log_level == srslte::LOG_LEVEL_INFO);
|
TESTASSERT(null_log->last_log_level == srslte::LOG_LEVEL_INFO);
|
||||||
// go back to original logger
|
// go back to original logger
|
||||||
|
|
Loading…
Reference in New Issue