From 759719ad55db5a7f59e223b967853da7a73f4583 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 16 Sep 2020 18:38:06 +0200 Subject: [PATCH] Improved RF helper --- lib/src/phy/rf/rf_helper.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/src/phy/rf/rf_helper.h b/lib/src/phy/rf/rf_helper.h index b3609ac5d..67a26a851 100644 --- a/lib/src/phy/rf/rf_helper.h +++ b/lib/src/phy/rf/rf_helper.h @@ -59,6 +59,10 @@ static inline int parse_string(char* args, const char* config_arg_base, int chan { int ret = SRSLTE_ERROR; + if (args == NULL) { + return ret; + } + char config_key[RF_PARAM_LEN] = {0}; char config_str[RF_PARAM_LEN] = {0}; char* config_ptr = NULL; @@ -112,12 +116,12 @@ static inline int parse_double(char* args, const char* config_arg_base, int chan static inline int parse_uint32(char* args, const char* config_arg_base, int channel_index, uint32_t* value) { - double tmp_value; - int ret = parse_double(args, config_arg_base, channel_index, &tmp_value); + char tmp_value[RF_PARAM_LEN] = {0}; + int ret = parse_string(args, config_arg_base, channel_index, tmp_value); // Copy parsed value only if was found, otherwise it keeps the default if (ret == SRSLTE_SUCCESS) { - *value = tmp_value; + *value = (uint32_t)strtol(tmp_value, NULL, 10); } return ret;