From 2c78111666e23068742c7342242563317eef0d1c Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Mon, 27 May 2019 10:24:08 +0200 Subject: [PATCH] SRSUE: Fixed CLang Tidy in ue.cc --- lib/include/srslte/phy/common/phy_common.h | 2 +- lib/src/phy/common/phy_common.c | 4 ++-- srsue/src/ue.cc | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/include/srslte/phy/common/phy_common.h b/lib/include/srslte/phy/common/phy_common.h index 4740690b7..d262911e0 100644 --- a/lib/include/srslte/phy/common/phy_common.h +++ b/lib/include/srslte/phy/common/phy_common.h @@ -352,7 +352,7 @@ SRSLTE_API char *srslte_mod_string(srslte_mod_t mod); SRSLTE_API uint32_t srslte_mod_bits_x_symbol(srslte_mod_t mod); -SRSLTE_API int srslte_band_get_band(uint32_t dl_earfcn); +SRSLTE_API uint8_t srslte_band_get_band(uint32_t dl_earfcn); SRSLTE_API bool srslte_band_is_tdd(uint32_t band); diff --git a/lib/src/phy/common/phy_common.c b/lib/src/phy/common/phy_common.c index 7549a691e..494105d05 100644 --- a/lib/src/phy/common/phy_common.c +++ b/lib/src/phy/common/phy_common.c @@ -462,7 +462,7 @@ uint32_t srslte_re_x_prb(uint32_t ns, uint32_t symbol, uint32_t nof_ports, uint3 struct lte_band { - uint32_t band; + uint8_t band; float fd_low_mhz; uint32_t dl_earfcn_offset; uint32_t ul_earfcn_offset; @@ -596,7 +596,7 @@ bool srslte_band_is_tdd(uint32_t band) return lte_bands[i].ul_earfcn_offset == 0; } -int srslte_band_get_band(uint32_t dl_earfcn) +uint8_t srslte_band_get_band(uint32_t dl_earfcn) { uint32_t i = SRSLTE_NOF_LTE_BANDS - 1; if (dl_earfcn > lte_bands[i].dl_earfcn_offset) { diff --git a/srsue/src/ue.cc b/srsue/src/ue.cc index 9625645a4..bc0d8762e 100644 --- a/srsue/src/ue.cc +++ b/srsue/src/ue.cc @@ -36,7 +36,7 @@ using namespace srslte; namespace srsue { -ue::ue() : logger(NULL) +ue::ue() : logger(nullptr) { // print build info std::cout << std::endl << get_build_string() << std::endl; @@ -174,11 +174,11 @@ int ue::parse_args(const all_args_t& args_) // populate EARFCN list if (!args.phy.dl_earfcn.empty()) { std::stringstream ss(args.phy.dl_earfcn); - int idx = 0; + uint32_t idx = 0; while (ss.good()) { std::string substr; getline(ss, substr, ','); - const int earfcn = atoi(substr.c_str()); + auto earfcn = (uint32_t)strtoul(substr.c_str(), nullptr, 10); args.stack.rrc.supported_bands[idx] = srslte_band_get_band(earfcn); args.stack.rrc.nof_supported_bands = ++idx; args.phy.earfcn_list.push_back(earfcn); @@ -190,7 +190,7 @@ int ue::parse_args(const all_args_t& args_) } // Set UE category - args.stack.rrc.ue_category = atoi(args.stack.rrc.ue_category_str.c_str()); + args.stack.rrc.ue_category = (uint32_t)strtoul(args.stack.rrc.ue_category_str.c_str(), nullptr, 10); // Consider Carrier Aggregation support if more than one args.stack.rrc.support_ca = (args.rf.nof_rf_channels * args.rf.nof_radios) > 1;