Removed atof, atoll and atoi calls

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 8dd1c59e18
commit b48bb0d754

@ -86,19 +86,19 @@ void parse_args(int argc, char **argv) {
rf_args = argv[optind]; rf_args = argv[optind];
break; break;
case 'b': case 'b':
band = atoi(argv[optind]); band = (int)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
earfcn_start = atoi(argv[optind]); earfcn_start = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
earfcn_end = atoi(argv[optind]); earfcn_end = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell_detect_config.max_frames_pss = atoi(argv[optind]); cell_detect_config.max_frames_pss = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'g': case 'g':
rf_gain = atof(argv[optind]); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -163,52 +163,52 @@ void parse_args(int argc, char **argv) {
rf_args = argv[optind]; rf_args = argv[optind];
break; break;
case 'g': case 'g':
rf_gain = atof(argv[optind]); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'l': case 'l':
rf_amp = atof(argv[optind]); rf_amp = strtof(argv[optind], NULL);
break; break;
case 'f': case 'f':
rf_freq = atof(argv[optind]); rf_freq = strtof(argv[optind], NULL);
break; break;
case 'o': case 'o':
output_file_name = argv[optind]; output_file_name = argv[optind];
break; break;
case 'm': case 'm':
mcs_idx = atoi(argv[optind]); mcs_idx = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'u': case 'u':
net_port = atoi(argv[optind]); net_port = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'x': case 'x':
transmission_mode = (srslte_tm_t)(atoi(argv[optind]) - 1); transmission_mode = (srslte_tm_t)(strtol(argv[optind], NULL, 10) - 1);
break; break;
case 'b': case 'b':
multiplex_pmi = (uint32_t) atoi(argv[optind]); multiplex_pmi = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'w': case 'w':
multiplex_nof_layers = (uint32_t) atoi(argv[optind]); multiplex_nof_layers = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'M': case 'M':
mbsfn_area_id = atoi(argv[optind]); mbsfn_area_id = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;
break; break;
case 's': case 's':
output_file_snr = atof(argv[optind]); output_file_snr = strtof(argv[optind], NULL);
break; break;
case 'B': case 'B':
mbsfn_sf_mask = atoi(argv[optind]); mbsfn_sf_mask = (uint8_t)strtol(argv[optind], NULL, 10);
break; break;
case 'q': case 'q':
enable_256qam ^= true; enable_256qam ^= true;
@ -627,7 +627,7 @@ int update_control() {
break; break;
default: default:
last_mcs_idx = mcs_idx; last_mcs_idx = mcs_idx;
mcs_idx = atoi(input); mcs_idx = strtol(input, NULL, 10);
} }
} }
bzero(input,sizeof(input)); bzero(input,sizeof(input));

@ -208,19 +208,19 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
args->input_file_name = argv[optind]; args->input_file_name = argv[optind];
break; break;
case 'p': case 'p':
args->file_nof_prb = atoi(argv[optind]); args->file_nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'P': case 'P':
args->file_nof_ports = atoi(argv[optind]); args->file_nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'o': case 'o':
args->file_offset_freq = atof(argv[optind]); args->file_offset_freq = strtof(argv[optind], NULL);
break; break;
case 'O': case 'O':
args->file_offset_time = atoi(argv[optind]); args->file_offset_time = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
args->file_cell_id = atoi(argv[optind]); args->file_cell_id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'I': case 'I':
args->rf_dev = argv[optind]; args->rf_dev = argv[optind];
@ -229,10 +229,10 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
args->rf_args = argv[optind]; args->rf_args = argv[optind];
break; break;
case 'A': case 'A':
args->rf_nof_rx_ant = atoi(argv[optind]); args->rf_nof_rx_ant = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'g': case 'g':
args->rf_gain = atof(argv[optind]); args->rf_gain = strtof(argv[optind], NULL);
break; break;
case 'C': case 'C':
args->disable_cfo = true; args->disable_cfo = true;
@ -244,34 +244,34 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
args->average_subframe = true; args->average_subframe = true;
break; break;
case 't': case 't':
args->time_offset = atoi(argv[optind]); args->time_offset = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
args->rf_freq = strtod(argv[optind], NULL); args->rf_freq = strtod(argv[optind], NULL);
break; break;
case 'T': case 'T':
args->tdd_special_sf = atoi(argv[optind]); args->tdd_special_sf = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'G': case 'G':
args->sf_config = atoi(argv[optind]); args->sf_config = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
args->nof_subframes = atoi(argv[optind]); args->nof_subframes = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
args->rnti = strtol(argv[optind], NULL, 16); args->rnti = strtol(argv[optind], NULL, 16);
break; break;
case 'l': case 'l':
args->force_N_id_2 = atoi(argv[optind]); args->force_N_id_2 = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'u': case 'u':
args->net_port = atoi(argv[optind]); args->net_port = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'U': case 'U':
args->net_address = argv[optind]; args->net_address = argv[optind];
break; break;
case 's': case 's':
args->net_port_signal = atoi(argv[optind]); args->net_port_signal = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'S': case 'S':
args->net_address_signal = argv[optind]; args->net_address_signal = argv[optind];
@ -287,22 +287,22 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
args->verbose = srslte_verbose; args->verbose = srslte_verbose;
break; break;
case 'Z': case 'Z':
args->decimate = atoi(argv[optind]); args->decimate = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'y': case 'y':
args->cpu_affinity = atoi(argv[optind]); args->cpu_affinity = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'W': case 'W':
output_file_name = argv[optind]; output_file_name = argv[optind];
break; break;
case 'M': case 'M':
args->mbsfn_area_id = atoi(argv[optind]); args->mbsfn_area_id = (int32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'N': case 'N':
args->non_mbsfn_region = atoi(argv[optind]); args->non_mbsfn_region = (uint8_t)strtol(argv[optind], NULL, 10);
break; break;
case 'B': case 'B':
args->mbsfn_sf_mask = atoi(argv[optind]); args->mbsfn_sf_mask = (uint8_t)strtol(argv[optind], NULL, 10);
break; break;
case 'q': case 'q':
args->enable_256qam ^= true; args->enable_256qam ^= true;

@ -60,25 +60,25 @@ void parse_args(int argc, char **argv) {
output_file_name = argv[optind]; output_file_name = argv[optind];
break; break;
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
frame_length = atoi(argv[optind]); frame_length = (int)strtol(argv[optind], NULL, 10);
break; break;
case 't': case 't':
corr_peak_threshold = atof(argv[optind]); corr_peak_threshold = strtof(argv[optind], NULL);
break; break;
case 's': case 's':
symbol_sz = atof(argv[optind]); symbol_sz = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'N': case 'N':
out_N_id_2 = atoi(argv[optind]); out_N_id_2 = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
force_N_id_2 = atoi(argv[optind]); force_N_id_2 = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
force_cfo = atof(argv[optind]); force_cfo = strtof(argv[optind], NULL);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -66,19 +66,19 @@ void parse_args(int argc, char **argv) {
rf_args = argv[optind]; rf_args = argv[optind];
break; break;
case 'g': case 'g':
rf_gain = atof(argv[optind]); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'r': case 'r':
rf_rate = atof(argv[optind]); rf_rate = strtof(argv[optind], NULL);
break; break;
case 'f': case 'f':
rf_freq = atof(argv[optind]); rf_freq = strtof(argv[optind], NULL);
break; break;
case 'n': case 'n':
nof_samples = atoi(argv[optind]); nof_samples = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'A': case 'A':
nof_rx_antennas = atoi(argv[optind]); nof_rx_antennas = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -67,22 +67,22 @@ void parse_args(int argc, char **argv) {
rf_args = argv[optind]; rf_args = argv[optind];
break; break;
case 'g': case 'g':
rf_gain = atof(argv[optind]); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'p': case 'p':
nof_prb = atoi(argv[optind]); nof_prb = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
rf_freq = atof(argv[optind]); rf_freq = strtof(argv[optind], NULL);
break; break;
case 'n': case 'n':
nof_subframes = atoi(argv[optind]); nof_subframes = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
N_id_2 = atoi(argv[optind]); N_id_2 = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'A': case 'A':
nof_rx_antennas = (uint32_t) atoi(argv[optind]); nof_rx_antennas = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -66,22 +66,22 @@ void parse_args(int argc, char **argv) {
input_filename = argv[optind]; input_filename = argv[optind];
break; break;
case 't': case 't':
tone_offset_hz = atof(argv[optind]); tone_offset_hz = strtof(argv[optind], NULL);
break; break;
case 'T': case 'T':
time_adv_samples = atoi(argv[optind]); time_adv_samples = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
rf_freq = atof(argv[optind]); rf_freq = strtof(argv[optind], NULL);
break; break;
case 'g': case 'g':
rf_rx_gain = atof(argv[optind]); rf_rx_gain = strtof(argv[optind], NULL);
break; break;
case 'G': case 'G':
srslte_rf_tx_gain = atof(argv[optind]); srslte_rf_tx_gain = strtof(argv[optind], NULL);
break; break;
case 'p': case 'p':
nof_prb = atoi(argv[optind]); nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
if (!srslte_nofprb_isvalid(nof_prb)) { if (!srslte_nofprb_isvalid(nof_prb)) {
ERROR("Invalid number of UL RB %d\n", nof_prb); ERROR("Invalid number of UL RB %d\n", nof_prb);
exit(-1); exit(-1);

@ -78,10 +78,10 @@ void parse_args(int argc, char** argv)
while ((opt = getopt(argc, argv, "recosvnm")) != -1) { while ((opt = getopt(argc, argv, "recosvnm")) != -1) {
switch (opt) { switch (opt) {
case 'r': case 'r':
cell.base.nof_prb = atoi(argv[optind]); cell.base.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.n_id_ncell = atoi(argv[optind]); cell.n_id_ncell = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
have_channel = true; have_channel = true;
@ -90,7 +90,7 @@ void parse_args(int argc, char** argv)
have_ofdm = true; have_ofdm = true;
break; break;
case 's': case 's':
snr_db = (float)atof(argv[optind]); snr_db = strtof(argv[optind], NULL);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -54,13 +54,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "recov")) != -1) { while ((opt = getopt(argc, argv, "recov")) != -1) {
switch(opt) { switch(opt) {
case 'r': case 'r':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
cell.cp = SRSLTE_CP_EXT; cell.cp = SRSLTE_CP_EXT;
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'o': case 'o':
output_matlab = argv[optind]; output_matlab = argv[optind];

@ -57,13 +57,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "recov")) != -1) { while ((opt = getopt(argc, argv, "recov")) != -1) {
switch(opt) { switch(opt) {
case 'r': case 'r':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
cell.cp = SRSLTE_CP_EXT; cell.cp = SRSLTE_CP_EXT;
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'o': case 'o':
output_matlab = argv[optind]; output_matlab = argv[optind];

@ -55,13 +55,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "recv")) != -1) { while ((opt = getopt(argc, argv, "recv")) != -1) {
switch(opt) { switch(opt) {
case 'r': case 'r':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
cell.cp = SRSLTE_CP_EXT; cell.cp = SRSLTE_CP_EXT;
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -67,13 +67,13 @@ static void parse_args(int argc, char** argv)
model = argv[optind]; model = argv[optind];
break; break;
case 't': case 't':
duration_ms = (uint32_t)atof(argv[optind]); duration_ms = (uint32_t)strtof(argv[optind], NULL);
break; break;
case 's': case 's':
srate = (uint32_t)atof(argv[optind]); srate = (uint32_t)strtof(argv[optind], NULL);
break; break;
case 'r': case 'r':
random_seed = (uint32_t)atoi(argv[optind]); random_seed = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
case 'g': case 'g':

@ -54,13 +54,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "ner")) != -1) { while ((opt = getopt(argc, argv, "ner")) != -1) {
switch (opt) { switch (opt) {
case 'n': case 'n':
nof_prb = atoi(argv[optind]); nof_prb = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
cp = SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;
break; break;
case 'r': case 'r':
nof_repetitions = atoi(argv[optind]); nof_repetitions = (int)strtol(argv[optind], NULL, 10);
break; break;
default: default:
usage(argv[0]); usage(argv[0]);

@ -47,10 +47,10 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "nlps")) != -1) { while ((opt = getopt(argc, argv, "nlps")) != -1) {
switch (opt) { switch (opt) {
case 'n': case 'n':
num_bits = atoi(argv[optind]); num_bits = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
crc_length = atoi(argv[optind]); crc_length = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
crc_poly = (uint32_t) strtoul(argv[optind], NULL, 16); crc_poly = (uint32_t) strtoul(argv[optind], NULL, 16);

@ -41,10 +41,10 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "tr")) != -1) { while ((opt = getopt(argc, argv, "tr")) != -1) {
switch (opt) { switch (opt) {
case 't': case 't':
nof_tx_bits = atoi(argv[optind]); nof_tx_bits = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
nof_rx_bits = atoi(argv[optind]); nof_rx_bits = (int)strtol(argv[optind], NULL, 10);
break; break;
default: default:
usage(argv[0]); usage(argv[0]);

@ -55,13 +55,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "cei")) != -1) { while ((opt = getopt(argc, argv, "cei")) != -1) {
switch (opt) { switch (opt) {
case 'c': case 'c':
cb_idx = atoi(argv[optind]); cb_idx = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
nof_e_bits = atoi(argv[optind]); nof_e_bits = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'i': case 'i':
rv_idx = atoi(argv[optind]); rv_idx = (int)strtol(argv[optind], NULL, 10);
break; break;
default: default:
usage(argv[0]); usage(argv[0]);

@ -43,7 +43,7 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "lv")) != -1) { while ((opt = getopt(argc, argv, "lv")) != -1) {
switch (opt) { switch (opt) {
case 'l': case 'l':
long_cb = atoi(argv[optind]); long_cb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -74,13 +74,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "kcinNledts")) != -1) { while ((opt = getopt(argc, argv, "kcinNledts")) != -1) {
switch (opt) { switch (opt) {
case 'c': case 'c':
nof_cb = atoi(argv[optind]); nof_cb = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'N': case 'N':
nof_repetitions = atoi(argv[optind]); nof_repetitions = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'k': case 'k':
test_known_data = 1; test_known_data = 1;
@ -89,16 +89,16 @@ void parse_args(int argc, char **argv) {
test_errors = 1; test_errors = 1;
break; break;
case 'i': case 'i':
nof_iterations = atoi(argv[optind]); nof_iterations = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
frame_length = atoi(argv[optind]); frame_length = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'd': case 'd':
tdec_type = (srslte_tdec_impl_type_t) atoi(argv[optind]); tdec_type = (srslte_tdec_impl_type_t)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
ebno_db = atof(argv[optind]); ebno_db = strtof(argv[optind], NULL);
break; break;
case 's': case 's':
seed = (uint32_t) strtoul(argv[optind], NULL, 0); seed = (uint32_t) strtoul(argv[optind], NULL, 0);

@ -61,13 +61,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "nlste")) != -1) { while ((opt = getopt(argc, argv, "nlste")) != -1) {
switch (opt) { switch (opt) {
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
frame_length = atoi(argv[optind]); frame_length = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
ebno_db = atof(argv[optind]); ebno_db = strtof(argv[optind], NULL);
break; break;
case 's': case 's':
seed = (uint32_t) strtoul(argv[optind], NULL, 0); seed = (uint32_t) strtoul(argv[optind], NULL, 0);

@ -50,13 +50,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "mcln")) != -1) { while ((opt = getopt(argc, argv, "mcln")) != -1) {
switch (opt) { switch (opt) {
case 'n': case 'n':
nof_symbols = atoi(argv[optind]); nof_symbols = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
nof_cw = atoi(argv[optind]); nof_cw = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
nof_layers = atoi(argv[optind]); nof_layers = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'm': case 'm':
mimo_type_name = argv[optind]; mimo_type_name = argv[optind];

@ -65,32 +65,32 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "mplnrcdsg")) != -1) { while ((opt = getopt(argc, argv, "mplnrcdsg")) != -1) {
switch (opt) { switch (opt) {
case 'n': case 'n':
nof_symbols = atoi(argv[optind]); nof_symbols = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
nof_tx_ports = atoi(argv[optind]); nof_tx_ports = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
nof_rx_ports = atoi(argv[optind]); nof_rx_ports = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
nof_layers = atoi(argv[optind]); nof_layers = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'm': case 'm':
mimo_type_name = argv[optind]; mimo_type_name = argv[optind];
break; break;
case 'c': case 'c':
codebook_idx = (uint32_t) atoi(argv[optind]); codebook_idx = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'd': case 'd':
strncpy(decoder_type_name, argv[optind], 15); strncpy(decoder_type_name, argv[optind], 15);
decoder_type_name[15] = 0; decoder_type_name[15] = 0;
break; break;
case 's': case 's':
snr_db = (float) atof(argv[optind]); snr_db = strtof(argv[optind], NULL);
break; break;
case 'g': case 'g':
scaling = (float) atof(argv[optind]); scaling = strtof(argv[optind], NULL);
break; break;
default: default:
usage(argv[0]); usage(argv[0]);

@ -47,30 +47,30 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "nm")) != -1) { while ((opt = getopt(argc, argv, "nm")) != -1) {
switch (opt) { switch (opt) {
case 'n': case 'n':
num_bits = atoi(argv[optind]); num_bits = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'm': case 'm':
switch(atoi(argv[optind])) { switch (strtol(argv[optind], NULL, 10)) {
case 1: case 1:
modulation = SRSLTE_MOD_BPSK; modulation = SRSLTE_MOD_BPSK;
break; break;
case 2: case 2:
modulation = SRSLTE_MOD_QPSK; modulation = SRSLTE_MOD_QPSK;
break; break;
case 4: case 4:
modulation = SRSLTE_MOD_16QAM; modulation = SRSLTE_MOD_16QAM;
break; break;
case 6: case 6:
modulation = SRSLTE_MOD_64QAM; modulation = SRSLTE_MOD_64QAM;
break; break;
case 8: case 8:
modulation = SRSLTE_MOD_256QAM; modulation = SRSLTE_MOD_256QAM;
break; break;
default: default:
ERROR("Invalid modulation %d. Possible values: " ERROR("Invalid modulation %ld. Possible values: "
"(1: BPSK, 2: QPSK, 4: QAM16, 6: QAM64, 8: QAM256)\n", "(1: BPSK, 2: QPSK, 4: QAM16, 6: QAM64, 8: QAM256)\n",
atoi(argv[optind])); strtol(argv[optind], NULL, 10));
break; break;
} }
break; break;
default: default:

@ -46,36 +46,36 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "nmvf")) != -1) { while ((opt = getopt(argc, argv, "nmvf")) != -1) {
switch (opt) { switch (opt) {
case 'n': case 'n':
num_bits = atoi(argv[optind]); num_bits = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;
break; break;
case 'm': case 'm':
switch(atoi(argv[optind])) { switch (strtol(argv[optind], NULL, 10)) {
case 1: case 1:
modulation = SRSLTE_MOD_BPSK; modulation = SRSLTE_MOD_BPSK;
break; break;
case 2: case 2:
modulation = SRSLTE_MOD_QPSK; modulation = SRSLTE_MOD_QPSK;
break; break;
case 4: case 4:
modulation = SRSLTE_MOD_16QAM; modulation = SRSLTE_MOD_16QAM;
break; break;
case 6: case 6:
modulation = SRSLTE_MOD_64QAM; modulation = SRSLTE_MOD_64QAM;
break; break;
case 8: case 8:
modulation = SRSLTE_MOD_256QAM; modulation = SRSLTE_MOD_256QAM;
break; break;
default: default:
ERROR("Invalid modulation %d. Possible values: " ERROR("Invalid modulation %d. Possible values: "
"(1: BPSK, 2: QPSK, 4: QAM16, 6: QAM64)\n", "(1: BPSK, 2: QPSK, 4: QAM16, 6: QAM64)\n",
atoi(argv[optind])); (int)strtol(argv[optind], NULL, 10));
break; break;
} }
break; break;
default: default:

@ -77,25 +77,25 @@ void parse_args(int argc, char** argv)
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 'l': case 'l':
cell.n_id_ncell = atoi(argv[optind]); cell.n_id_ncell = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
cell.base.nof_prb = atoi(argv[optind]); cell.base.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 't': case 't':
do_chest = atoi(argv[optind]); do_chest = (strtol(argv[optind], NULL, 10) != 0);
break; break;
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
sf_idx = atoi(argv[optind]) % 10; sf_idx = (int)(strtol(argv[optind], NULL, 10) % 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;
break; break;
case 'r': case 'r':
nf = atoi(argv[optind]); nf = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'R': case 'R':
cell.is_r14 = true; cell.is_r14 = true;

@ -49,13 +49,13 @@ void parse_args(int argc, char** argv)
while ((opt = getopt(argc, argv, "cpnv")) != -1) { while ((opt = getopt(argc, argv, "cpnv")) != -1) {
switch (opt) { switch (opt) {
case 'p': case 'p':
cell.base.nof_ports = atoi(argv[optind]); cell.base.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.base.nof_prb = atoi(argv[optind]); cell.base.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.base.id = atoi(argv[optind]); cell.base.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -71,13 +71,13 @@ void parse_args(int argc, char **argv) {
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -52,13 +52,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "cpnv")) != -1) { while ((opt = getopt(argc, argv, "cpnv")) != -1) {
switch(opt) { switch(opt) {
case 'p': case 'p':
cell.nof_ports = atoi(argv[optind]); cell.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -69,16 +69,16 @@ void parse_args(int argc, char **argv) {
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'd': case 'd':
use_standard_lte_rates = true; use_standard_lte_rates = true;
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
cell.nof_ports = atoi(argv[optind]); cell.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'o': case 'o':
matlab_file_name = argv[optind]; matlab_file_name = argv[optind];

@ -51,13 +51,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "cpnv")) != -1) { while ((opt = getopt(argc, argv, "cpnv")) != -1) {
switch(opt) { switch(opt) {
case 'p': case 'p':
cell.nof_ports = atoi(argv[optind]); cell.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -75,7 +75,7 @@ void parse_args(int argc, char **argv) {
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
rnti = strtoul(argv[optind], NULL, 0); rnti = strtoul(argv[optind], NULL, 0);
@ -84,13 +84,13 @@ void parse_args(int argc, char **argv) {
max_frames = strtoul(argv[optind], NULL, 0); max_frames = strtoul(argv[optind], NULL, 0);
break; break;
case 'f': case 'f':
cfi = atoi(argv[optind]); cfi = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
cell.nof_ports = atoi(argv[optind]); cell.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'o': case 'o':
dci_format = srslte_dci_format_from_string(argv[optind]); dci_format = srslte_dci_format_from_string(argv[optind]);

@ -57,19 +57,19 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "cfpndvAx")) != -1) { while ((opt = getopt(argc, argv, "cfpndvAx")) != -1) {
switch (opt) { switch (opt) {
case 'p': case 'p':
cell.nof_ports = (uint32_t) atoi(argv[optind]); cell.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
cfi = (uint32_t) atoi(argv[optind]); cfi = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.nof_prb = (uint32_t) atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.id = (uint32_t) atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'A': case 'A':
nof_rx_ant = (uint32_t) atoi(argv[optind]); nof_rx_ant = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'd': case 'd':
print_dci_table = true; print_dci_table = true;

@ -75,10 +75,10 @@ void parse_args(int argc, char **argv) {
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
sf_idx = atoi(argv[optind]); sf_idx = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
rnti = strtoul(argv[optind], NULL, 0); rnti = strtoul(argv[optind], NULL, 0);
@ -87,13 +87,13 @@ void parse_args(int argc, char **argv) {
max_frames = strtoul(argv[optind], NULL, 0); max_frames = strtoul(argv[optind], NULL, 0);
break; break;
case 'f': case 'f':
cfi = atoi(argv[optind]); cfi = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
cell.nof_ports = atoi(argv[optind]); cell.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'o': case 'o':
dci_format = srslte_dci_format_from_string(argv[optind]); dci_format = srslte_dci_format_from_string(argv[optind]);

@ -87,46 +87,46 @@ void parse_args(int argc, char **argv) {
input_file = argv[optind]; input_file = argv[optind];
break; break;
case 'm': case 'm':
mcs[0] = (uint32_t) atoi(argv[optind]); mcs[0] = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'b': case 'b':
use_8_bit = true; use_8_bit = true;
break; break;
case 'M': case 'M':
mcs[1] = (uint32_t) atoi(argv[optind]); mcs[1] = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
subframe = atoi(argv[optind]); subframe = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'X': case 'X':
M = (uint32_t) atoi(argv[optind]); M = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
rv_idx[0] = (uint32_t) atoi(argv[optind]); rv_idx[0] = (int)strtol(argv[optind], NULL, 10);
break; break;
case 't': case 't':
rv_idx[1] = (uint32_t) atoi(argv[optind]); rv_idx[1] = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'R': case 'R':
rnti = atoi(argv[optind]); rnti = (uint16_t)strtol(argv[optind], NULL, 10);
break; break;
case 'F': case 'F':
cfi = atoi(argv[optind]); cfi = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'x': case 'x':
tm = (srslte_tm_t)atoi(argv[optind]) - 1; tm = (srslte_tm_t)(strtol(argv[optind], NULL, 10) - 1);
break; break;
case 'p': case 'p':
pmi = (uint32_t) atoi(argv[optind]); pmi = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'a': case 'a':
nof_rx_antennas = (uint32_t) atoi(argv[optind]); nof_rx_antennas = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'w': case 'w':
tb_cw_swap = true; tb_cw_swap = true;

@ -79,10 +79,10 @@ void parse_args(int argc, char **argv) {
matlab_file_name = argv[optind]; matlab_file_name = argv[optind];
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
nof_ctrl_symbols = atoi(argv[optind]); nof_ctrl_symbols = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'g': case 'g':
if (!strcmp(argv[optind], "1/6")) { if (!strcmp(argv[optind], "1/6")) {
@ -101,10 +101,10 @@ void parse_args(int argc, char **argv) {
cell.phich_length = SRSLTE_PHICH_EXT; cell.phich_length = SRSLTE_PHICH_EXT;
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
cell.nof_ports = atoi(argv[optind]); cell.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -57,13 +57,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "cpnvgel")) != -1) { while ((opt = getopt(argc, argv, "cpnvgel")) != -1) {
switch(opt) { switch(opt) {
case 'p': case 'p':
cell.nof_ports = atoi(argv[optind]); cell.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'g': case 'g':
if (!strcmp(argv[optind], "1/6")) { if (!strcmp(argv[optind], "1/6")) {

@ -75,22 +75,22 @@ void parse_args(int argc, char **argv) {
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
sf_idx = atoi(argv[optind]); sf_idx = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
cfi = atoi(argv[optind]); cfi = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
cell.nof_ports = atoi(argv[optind]); cell.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'M': case 'M':
mbsfn_area_id = atoi(argv[optind]); mbsfn_area_id = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -83,31 +83,31 @@ void parse_args(int argc, char **argv) {
input_file = argv[optind]; input_file = argv[optind];
break; break;
case 'm': case 'm':
mcs_idx = (uint32_t) atoi(argv[optind]); mcs_idx = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
subframe = atoi(argv[optind]); subframe = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
rv_idx[0] = (uint32_t) atoi(argv[optind]); rv_idx[0] = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'R': case 'R':
rnti = atoi(argv[optind]); rnti = (uint16_t)strtol(argv[optind], NULL, 10);
break; break;
case 'F': case 'F':
cfi = atoi(argv[optind]); cfi = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
pmi = (uint32_t) atoi(argv[optind]); pmi = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'a': case 'a':
nof_rx_antennas = (uint32_t) atoi(argv[optind]); nof_rx_antennas = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -50,16 +50,16 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "nfrz")) != -1) { while ((opt = getopt(argc, argv, "nfrz")) != -1) {
switch (opt) { switch (opt) {
case 'n': case 'n':
nof_prb = atoi(argv[optind]); nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
config_idx = atoi(argv[optind]); config_idx = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
root_seq_idx = atoi(argv[optind]); root_seq_idx = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'z': case 'z':
zero_corr_zone = atoi(argv[optind]); zero_corr_zone = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
default: default:
usage(argv[0]); usage(argv[0]);

@ -52,19 +52,19 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "Nfrzn")) != -1) { while ((opt = getopt(argc, argv, "Nfrzn")) != -1) {
switch (opt) { switch (opt) {
case 'N': case 'N':
nof_prb = atoi(argv[optind]); nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
preamble_format = atoi(argv[optind]); preamble_format = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
root_seq_idx = atoi(argv[optind]); root_seq_idx = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'z': case 'z':
zero_corr_zone = atoi(argv[optind]); zero_corr_zone = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
n_seqs = atoi(argv[optind]); n_seqs = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
default: default:
usage(argv[0]); usage(argv[0]);

@ -73,41 +73,41 @@ void parse_args(int argc, char **argv) {
output_filename = argv[optind]; output_filename = argv[optind];
break; break;
case 'f': case 'f':
uhd_freq = atof(argv[optind]); uhd_freq = strtof(argv[optind], NULL);
break; break;
case 'g': case 'g':
uhd_rx_gain = atof(argv[optind]); uhd_rx_gain = strtof(argv[optind], NULL);
break; break;
case 'G': case 'G':
uhd_tx_gain = atof(argv[optind]); uhd_tx_gain = strtof(argv[optind], NULL);
break; break;
case 'P': case 'P':
preamble_format = atoi(argv[optind]); preamble_format = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'O': case 'O':
frequency_offset = atoi(argv[optind]); frequency_offset = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 't': case 't':
timeadv = atof(argv[optind]); timeadv = strtof(argv[optind], NULL);
break; break;
case 'p': case 'p':
nof_prb = atoi(argv[optind]); nof_prb = (int)strtol(argv[optind], NULL, 10);
if (!srslte_nofprb_isvalid(nof_prb)) { if (!srslte_nofprb_isvalid(nof_prb)) {
ERROR("Invalid number of UL RB %d\n", nof_prb); ERROR("Invalid number of UL RB %d\n", nof_prb);
exit(-1); exit(-1);
} }
break; break;
case 'F': case 'F':
preamble_format = atoi(argv[optind]); preamble_format = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
root_seq_idx = atoi(argv[optind]); root_seq_idx = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
seq_idx = atoi(argv[optind]); seq_idx = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'z': case 'z':
zero_corr_zone = atoi(argv[optind]); zero_corr_zone = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
default: default:
usage(argv[0]); usage(argv[0]);

@ -56,13 +56,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "csNnqv")) != -1) { while ((opt = getopt(argc, argv, "csNnqv")) != -1) {
switch(opt) { switch(opt) {
case 's': case 's':
subframe = atoi(argv[optind]); subframe = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
cell.nof_prb = atoi(argv[optind]); cell.nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'c': case 'c':
cell.id = atoi(argv[optind]); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'q': case 'q':
test_cqi_only = true; test_cqi_only = true;

@ -48,10 +48,10 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "csefl")) != -1) { while ((opt = getopt(argc, argv, "csefl")) != -1) {
switch (opt) { switch (opt) {
case 'c': case 'c':
cell_id = atoi(argv[optind]); cell_id = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
nof_bits = atoi(argv[optind]); nof_bits = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
cp = SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;

@ -44,10 +44,10 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "nf")) != -1) { while ((opt = getopt(argc, argv, "nf")) != -1) {
switch (opt) { switch (opt) {
case 'n': case 'n':
num_samples = atoi(argv[optind]); num_samples = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'f': case 'f':
freq = atof(argv[optind]); freq = strtof(argv[optind], NULL);
break; break;
default: default:
usage(argv[0]); usage(argv[0]);

@ -76,19 +76,19 @@ void parse_args(int argc, char** argv)
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 't': case 't':
threshold = atof(argv[optind]); threshold = strtof(argv[optind], NULL);
break; break;
case 'o': case 'o':
file_offset = atoi(argv[optind]); file_offset = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
N_id_2_sync = atoi(argv[optind]); N_id_2_sync = (int)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
save_frame_to_file = true; save_frame_to_file = true;
break; break;
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -51,7 +51,7 @@ void parse_args(int argc, char** argv)
while ((opt = getopt(argc, argv, "lv")) != -1) { while ((opt = getopt(argc, argv, "lv")) != -1) {
switch (opt) { switch (opt) {
case 'l': case 'l':
input_len = atoi(argv[optind]); input_len = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose = SRSLTE_VERBOSE_DEBUG; srslte_verbose = SRSLTE_VERBOSE_DEBUG;

@ -84,26 +84,26 @@ void parse_args(int argc, char** argv)
has_cfo_corr = false; has_cfo_corr = false;
break; break;
case 'c': case 'c':
cfo_fixed = atof(argv[optind]); cfo_fixed = strtof(argv[optind], NULL);
break; break;
case 'g': case 'g':
rf_gain = atof(argv[optind]); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'f': case 'f':
rf_freq = atof(argv[optind]); rf_freq = strtof(argv[optind], NULL);
break; break;
case 't': case 't':
threshold = atof(argv[optind]); threshold = strtof(argv[optind], NULL);
break; break;
case 'i': case 'i':
cell.base.id = atoi(argv[optind]); cell.base.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
save_frame_to_file = true; save_frame_to_file = true;
disable_plots = true; disable_plots = true;
break; break;
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'd': case 'd':
disable_plots = true; disable_plots = true;

@ -66,13 +66,13 @@ void parse_args(int argc, char** argv)
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 'c': case 'c':
n_id_ncell = atoi(argv[optind]); n_id_ncell = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
sfn = atoi(argv[optind]); sfn = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'r': case 'r':
max_num_sf = atoi(argv[optind]); max_num_sf = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose = SRSLTE_VERBOSE_DEBUG; srslte_verbose = SRSLTE_VERBOSE_DEBUG;

@ -75,22 +75,22 @@ void parse_args(int argc, char** argv)
has_cfo_corr = false; has_cfo_corr = false;
break; break;
case 'c': case 'c':
cfo_fixed = atof(argv[optind]); cfo_fixed = strtof(argv[optind], NULL);
break; break;
case 'g': case 'g':
rf_gain = atof(argv[optind]); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'f': case 'f':
rf_freq = atof(argv[optind]); rf_freq = strtof(argv[optind], NULL);
break; break;
case 't': case 't':
threshold = atof(argv[optind]); threshold = strtof(argv[optind], NULL);
break; break;
case 'i': case 'i':
cell.n_id_ncell = atoi(argv[optind]); cell.n_id_ncell = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;

@ -72,25 +72,25 @@ void parse_args(int argc, char **argv) {
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 't': case 't':
threshold = atof(argv[optind]); threshold = strtof(argv[optind], NULL);
break; break;
case 'e': case 'e':
cp = SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;
break; break;
case 'i': case 'i':
cell_id = atoi(argv[optind]); cell_id = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'o': case 'o':
file_offset = atoi(argv[optind]); file_offset = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'l': case 'l':
N_id_2_sync = atoi(argv[optind]); N_id_2_sync = (int)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
fft_size = atoi(argv[optind]); fft_size = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'd': case 'd':
disable_plots = true; disable_plots = true;

@ -75,31 +75,31 @@ void parse_args(int argc, char **argv) {
rf_args = argv[optind]; rf_args = argv[optind];
break; break;
case 'g': case 'g':
rf_gain = atof(argv[optind]); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'f': case 'f':
rf_freq = atof(argv[optind]); rf_freq = strtof(argv[optind], NULL);
break; break;
case 't': case 't':
threshold = atof(argv[optind]); threshold = strtof(argv[optind], NULL);
break; break;
case 'e': case 'e':
cp = SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;
break; break;
case 'i': case 'i':
cell_id = atoi(argv[optind]); cell_id = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'T': case 'T':
tdd_mode = true; tdd_mode = true;
break; break;
case 'l': case 'l':
N_id_2_sync = atoi(argv[optind]); N_id_2_sync = (int)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
fft_size = atoi(argv[optind]); fft_size = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'n': case 'n':
nof_frames = atoi(argv[optind]); nof_frames = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'd': case 'd':
disable_plots = true; disable_plots = true;

@ -63,13 +63,13 @@ void parse_args(int argc, char** argv)
input_file_name = argv[optind]; input_file_name = argv[optind];
break; break;
case 'c': case 'c':
cfo = atof(argv[optind]); cfo = strtof(argv[optind], NULL);
break; break;
case 'g': case 'g':
snr = atof(argv[optind]); snr = strtof(argv[optind], NULL);
break; break;
case 'o': case 'o':
offset = atoi(argv[optind]); offset = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose = SRSLTE_VERBOSE_DEBUG; srslte_verbose = SRSLTE_VERBOSE_DEBUG;

@ -51,13 +51,13 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "cpoev")) != -1) { while ((opt = getopt(argc, argv, "cpoev")) != -1) {
switch (opt) { switch (opt) {
case 'c': case 'c':
cell_id = atoi(argv[optind]); cell_id = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
nof_prb = atoi(argv[optind]); nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'o': case 'o':
offset = atoi(argv[optind]); offset = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'e': case 'e':
cp = SRSLTE_CP_EXT; cp = SRSLTE_CP_EXT;

@ -51,7 +51,7 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "Nbmnd")) != -1) { while ((opt = getopt(argc, argv, "Nbmnd")) != -1) {
switch (opt) { switch (opt) {
case 'N': case 'N':
N = atoi(argv[optind]); N = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'b': case 'b':
forward = false; forward = false;

@ -61,7 +61,7 @@ static sem_t plot_sem;
static uint32_t plot_sf_idx = 0; static uint32_t plot_sf_idx = 0;
static plot_real_t fft_plot[SRSLTE_MAX_RADIOS] = {}; static plot_real_t fft_plot[SRSLTE_MAX_RADIOS] = {};
static cf_t* fft_plot_buffer[SRSLTE_MAX_RADIOS] = {}; static cf_t* fft_plot_buffer[SRSLTE_MAX_RADIOS] = {};
static float* fft_plot_temp = NULL; static float* fft_plot_temp = nullptr;
static uint32_t fft_plot_buffer_size; static uint32_t fft_plot_buffer_size;
srslte_dft_plan_t dft_spectrum = {}; srslte_dft_plan_t dft_spectrum = {};
#endif /* ENABLE_GUI */ #endif /* ENABLE_GUI */
@ -94,10 +94,10 @@ void parse_args(int argc, char **argv) {
while ((opt = getopt(argc, argv, "foabcderpsStvhmFxwg")) != -1) { while ((opt = getopt(argc, argv, "foabcderpsStvhmFxwg")) != -1) {
switch (opt) { switch (opt) {
case 'f': case 'f':
freq = atof(argv[optind]); freq = strtof(argv[optind], NULL);
break; break;
case 'g': case 'g':
rf_gain = atof(argv[optind]); rf_gain = strtof(argv[optind], NULL);
agc_enable = false; agc_enable = false;
break; break;
case 'o': case 'o':
@ -116,16 +116,16 @@ void parse_args(int argc, char **argv) {
radios_args[2][63] = '\0'; radios_args[2][63] = '\0';
break; break;
case 'r': case 'r':
nof_radios = (uint32_t)atoi(argv[optind]); nof_radios = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'p': case 'p':
nof_ports = (uint32_t)atoi(argv[optind]); nof_ports = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 's': case 's':
srate = atof(argv[optind]); srate = strtof(argv[optind], NULL);
break; break;
case 't': case 't':
duration = atof(argv[optind]); duration = strtof(argv[optind], NULL);
break; break;
case 'm': case 'm':
measure_delay ^= true; measure_delay ^= true;

@ -131,7 +131,7 @@ bool hss::read_db_file(std::string db_filename)
m_hss_log->error("Neither XOR nor MILENAGE configured.\n"); m_hss_log->error("Neither XOR nor MILENAGE configured.\n");
return false; return false;
} }
ue_ctx->imsi = atoll(split[2].c_str()); ue_ctx->imsi = strtoull(split[2].c_str(), nullptr, 10);
get_uint_vec_from_hex_str(split[3], ue_ctx->key, 16); get_uint_vec_from_hex_str(split[3], ue_ctx->key, 16);
if (split[4] == std::string("op")) { if (split[4] == std::string("op")) {
ue_ctx->op_configured = true; ue_ctx->op_configured = true;
@ -155,7 +155,7 @@ bool hss::read_db_file(std::string db_filename)
m_hss_log->debug_hex(ue_ctx->opc, 16, "User OPc : "); m_hss_log->debug_hex(ue_ctx->opc, 16, "User OPc : ");
m_hss_log->debug_hex(ue_ctx->amf, 2, "AMF : "); m_hss_log->debug_hex(ue_ctx->amf, 2, "AMF : ");
m_hss_log->debug_hex(ue_ctx->sqn, 6, "SQN : "); m_hss_log->debug_hex(ue_ctx->sqn, 6, "SQN : ");
ue_ctx->qci = atoi(split[8].c_str()); ue_ctx->qci = (uint16_t)strtol(split[8].c_str(), nullptr, 10);
m_hss_log->debug("Default Bearer QCI: %d\n", ue_ctx->qci); m_hss_log->debug("Default Bearer QCI: %d\n", ue_ctx->qci);
if (split[9] == std::string("dynamic")) { if (split[9] == std::string("dynamic")) {

@ -221,7 +221,7 @@ private:
if(line.substr(0,len).compare(key)) { if(line.substr(0,len).compare(key)) {
return false; return false;
} }
*var = (T)atoi(line.substr(len).c_str()); *var = (T)strtol(line.substr(len).c_str(), NULL, 10);
return true; return true;
} }
@ -248,7 +248,7 @@ private:
std::string substr; std::string substr;
getline(ss, substr, ','); getline(ss, substr, ',');
if (not substr.empty()) { if (not substr.empty()) {
list.push_back(atoi(substr.c_str())); list.push_back(strtol(substr.c_str(), nullptr, 10));
} }
} }
return list; return list;

@ -55,7 +55,7 @@ public:
args.stack.rrc.feature_group = 0xe6041000; args.stack.rrc.feature_group = 0xe6041000;
args.stack.rrc.ue_category_str = SRSLTE_UE_CATEGORY_DEFAULT; args.stack.rrc.ue_category_str = SRSLTE_UE_CATEGORY_DEFAULT;
args.stack.rrc.ue_category = atoi(args.stack.rrc.ue_category_str.c_str()); args.stack.rrc.ue_category = strtol(args.stack.rrc.ue_category_str.c_str(), nullptr, 10);
args.stack.rrc.nof_supported_bands = 1; args.stack.rrc.nof_supported_bands = 1;
args.stack.rrc.supported_bands[0] = 7; args.stack.rrc.supported_bands[0] = 7;
args.stack.rrc.release = 8; args.stack.rrc.release = 8;

Loading…
Cancel
Save