Commit 60defa24 authored by frtabu's avatar frtabu

more fixes for cppcheck

parent d0a3788c
......@@ -33,7 +33,7 @@ memleak:common/utils/hashtable/obj_hashtable.c
// suppress error about keys memory leak, free must be done by calling func
memleak:openair2/UTIL/OMG/omg_hashtable.c
//-----------------------------------------------------------------------------
// suppress error about data memory leak. This is the buffer where
// suppress error about data memory leak. This is the buffer where
// _emm_as_encode function creates the encoded buffer
//
memleak:openair3/NAS/UE/EMM/SAP/emm_as.c
......
......@@ -1545,7 +1545,7 @@ static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg,
// DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
if (0 && pdu->segments[j].segment_length == 3)
if (pdu->segments[j].segment_length == 3)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
pdu->segments[j].segment_data[0],
......@@ -4429,40 +4429,43 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
for(i = 0; i < totalNumPdus; ++i)
{
nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]);
if (pdu) {
uint16_t length = 0;
uint16_t index = 0;
uint16_t length = 0;
uint16_t index = 0;
if(!(pull16(ppReadPackedMsg, &length, end) &&
if(!(pull16(ppReadPackedMsg, &length, end) &&
pull16(ppReadPackedMsg, &index, end)))
return 0;
return 0;
pdu->pdu_length = length;
pdu->pdu_index = index;
pdu->pdu_length = length;
pdu->pdu_index = index;
// TODO : May need to rethink this bit
pdu->num_segments = 1;
pdu->segments[0].segment_length = pdu->pdu_length;
pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
pdu->num_segments = 1;
pdu->segments[0].segment_length = pdu->pdu_length;
pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
if(pdu->segments[0].segment_data)
{
if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
if(pdu->segments[0].segment_data)
{
if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
return 0;
if (0 && pdu->segments[0].segment_length == 3)
{
if (pdu->segments[0].segment_length == 3)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
pdu->segments[0].segment_data[0],
pdu->segments[0].segment_data[1],
pdu->segments[0].segment_data[2]
);
}
}
else
{
}
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index);
}
}
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
}
}
}
break;
......
......@@ -1902,7 +1902,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
if ((frame_parms->frame_type==FDD) ||
(bundling_flag==bundling) ||
((frame_parms->frame_type==TDD)&&(frame_parms->tdd_config==1)&&((subframe_tx!=2)||(subframe_tx!=7)))) {
((frame_parms->frame_type==TDD)&&(frame_parms->tdd_config==1)&&((subframe_tx==2)||(subframe_tx==7)))) {
format = pucch_format1a;
// LOG_D(PHY,"[UE] PUCCH 1a\n");
} else {
......
......@@ -1047,7 +1047,7 @@ int main(int argc, char **argv) {
sigma2_dB = N0;//-10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12));//10*log10((double)tx_lev) +10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12)) - SNR;
sigma2 = pow(10,sigma2_dB/10);
// compute tx_gain to achieve target SNR (per resource element!)
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);//*(nb_rb*12/(double)UE->frame_parms.ofdm_symbol_size)/(double)tx_lev);
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);// *(nb_rb*12/(double)UE->frame_parms.ofdm_symbol_size)/(double)tx_lev);
if (n_frames==1)
printf("tx_lev = %u (%u.%u dB,%f), gain %f\n",tx_lev,tx_lev_dB/10,tx_lev_dB,10*log10((double)tx_lev),10*log10(tx_gain));
......@@ -1212,7 +1212,8 @@ int main(int argc, char **argv) {
dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
if (round == 4) exit(-1);
round=5;
}
if (n_frames==1) printf("round %d errors %u/%u\n",round,errs[round],trials);
......
......@@ -254,7 +254,7 @@ void load_pbch_desc(FILE *pbch_file_fd) {
printf("PBCH polynomial : ");
for (i=0; i<=pbch_polynomial_degree; i++) {
ret = fscanf(pbch_file_fd,"%s",dummy);
ret = fscanf(pbch_file_fd,"%24s",dummy);
if (ret < 0) {
printf("fscanf failed: %s\n", strerror(errno));
......
......@@ -532,7 +532,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
if (tb_src != NULL) {
tb_size = ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits >> 3;
printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %d sizeof (mac_rlc_max_rx_header_size_t) %d\n",
printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %u sizeof (mac_rlc_max_rx_header_size_t) %d\n",
((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits,
tb_size, sizeof (mac_rlc_max_rx_header_size_t));
*tx_packetsP = *tx_packetsP + 1;
......
......@@ -148,7 +148,8 @@ void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, uns
buffer_marker = 0;
}
buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker, " %04ld |", octet_index);
buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker,
" %04lu |", octet_index);
}
/*
......@@ -382,7 +383,7 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
if (tb_src != NULL) {
tb_size = ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits >> 3;
printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %d sizeof (mac_rlc_max_rx_header_size_t) %d\n",
printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %u sizeof (mac_rlc_max_rx_header_size_t) %d\n",
((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits,
tb_size, sizeof (mac_rlc_max_rx_header_size_t));
*tx_packetsP = *tx_packetsP + 1;
......
......@@ -1396,16 +1396,12 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
}
}
SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[next_xid];
DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[next_xid];
SRB_configList2 = &(ue_context_pP->ue_context.SRB_configList2[next_xid]);
DRB_configList2 = &(ue_context_pP->ue_context.DRB_configList2[next_xid]);
if(SRB_configList2!=NULL) {
if (*SRB_configList2) {
free(*SRB_configList2);
LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid);
}
} else {
LOG_E(RRC, "SRB_configList2 is null\n");
if (*SRB_configList2) {
free(*SRB_configList2);
LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid);
}
*SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
......@@ -1423,13 +1419,9 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
LOG_W(RRC,"SRB2 configuration does not exist in SRB configuration list\n");
}
if(DRB_configList2!=NULL) {
if (*DRB_configList2) {
free(*DRB_configList2);
LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid);
}
} else {
LOG_E(RRC, "DRB_configList2 is null\n");
if (*DRB_configList2) {
free(*DRB_configList2);
LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid);
}
*DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2));
......
......@@ -270,7 +270,7 @@ rrc_eNB_S1AP_get_ue_ids(
} else {
LOG_E(RRC, "[eNB %ld] Incoherence between RRC context and S1AP context (%d != %d) for UE RNTI %d or UE RRC context doesn't exist\n",
rrc_instance_pP - RC.rrc[0],
ue_context_p->ue_context.eNB_ue_s1ap_id,
(ue_context_p==NULL)?99999:ue_context_p->ue_context.eNB_ue_s1ap_id,
eNB_ue_s1ap_id,
result->ue_rnti);
}
......@@ -300,8 +300,7 @@ rrc_eNB_S1AP_remove_ue_ids(
)
//------------------------------------------------------------------------------
{
const uint16_t ue_initial_id = ue_ids_pP->ue_initial_id;
const uint32_t eNB_ue_s1ap_id = ue_ids_pP->eNB_ue_s1ap_id;
hashtable_rc_t h_rc;
if (rrc_instance_pP == NULL) {
......@@ -313,7 +312,8 @@ rrc_eNB_S1AP_remove_ue_ids(
LOG_E(RRC, "Trying to free a NULL S1AP UE IDs\n");
return;
}
const uint16_t ue_initial_id = ue_ids_pP->ue_initial_id;
const uint32_t eNB_ue_s1ap_id = ue_ids_pP->eNB_ue_s1ap_id;
if (eNB_ue_s1ap_id > 0) {
h_rc = hashtable_remove(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id);
......
......@@ -32,7 +32,7 @@ extern uint32_t g_log_level;
{ \
char _logStr[1024]; \
snprintf(_logStr, 1024, __VA_ARGS__); \
printf("NWGTPv2U-APP %s - %s <%s,%u>\n", gLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\
printf("NWGTPv2U-APP %s - %s <%s,%d>\n", gLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\
} \
} while(0)
......
......@@ -64,8 +64,8 @@ NwGtpv1uRcT nwTimerStart( NwGtpv1uTimerMgrHandleT tmrMgrHandle,
struct timeval tv;
NW_LOG(NW_LOG_LEVEL_INFO,
"Received start timer request from stack with timer type %u, arg %x, for %u sec and %u usec",
tmrType, timeoutArg, timeoutSec, timeoutUsec);
"Received start timer request from stack with timer type %d , arg %x, for %d sec and %d usec",
tmrType, (unsigned int)timeoutArg, timeoutSec, timeoutUsec);
pTmr = (NwMiniTmrMgrEntityT *) malloc (sizeof(NwMiniTmrMgrEntityT));
......@@ -90,7 +90,7 @@ NwGtpv1uRcT nwTimerStop( NwGtpv1uTimerMgrHandleT tmrMgrHandle,
NwGtpv1uTimerHandleT hTmr)
{
NW_LOG(NW_LOG_LEVEL_INFO,
"Received stop timer request from stack for timer handle %u", hTmr);
"Received stop timer request from stack for timer handle %d", hTmr);
evtimer_del(&(((NwMiniTmrMgrEntityT *)hTmr)->ev));
free((void *)hTmr);
return NW_GTPV1U_OK;
......
......@@ -96,7 +96,7 @@ int main (int argc, const char* argv[])
/* Start NB_TIMERS_MAX timers to expire at time interval of 1s */
for (int i=0; i < NB_TIMERS_MAX; i++) {
if (_start(&timer[i], i) != RETURNok) {
printf("ERROR: timer_start(i=%u) failed\n", i);
printf("ERROR: timer_start(i=%d) failed\n", i);
}
}
......
......@@ -319,7 +319,7 @@ int main (int argc, const char* argv[])
_network_simulator_msg_sent += 1;
}
printf("\nINFO\t: %d messages received, %d messages sent\n",
printf("\nINFO\t: %u messages received, %u messages sent\n",
_network_simulator_msg_recv, _network_simulator_msg_sent);
}
......
......@@ -143,7 +143,7 @@ int main (int argc, const char* argv[])
}
printf("INFO\t: The User Simulator is now connected to %s (%d)\n",
devpath, USER_GETFD());
devpath, (int)USER_GETFD());
} else {
/* Initialize network socket handlers */
_user_simulator_id.open = socket_udp_open;
......@@ -163,7 +163,7 @@ int main (int argc, const char* argv[])
}
printf("INFO\t: The User Simulator is now connected to %s/%s (%d)\n",
host, port, USER_GETFD());
host, port, (int)USER_GETFD());
}
......@@ -231,7 +231,7 @@ int main (int argc, const char* argv[])
/*
* Termination cleanup
*/
printf("INFO\t: Closing user endpoint descriptor %d\n", USER_GETFD());
printf("INFO\t: Closing user endpoint descriptor %d\n", (int)USER_GETFD());
USER_CLOSE();
printf("INFO\t: User simulator exited\n");
......@@ -282,7 +282,7 @@ static int _set_signal_handler(int signal, void (handler)(int))
static void _signal_handler(int signal_number)
{
printf("\nWARNING\t: Signal %d received\n", signal_number);
printf("INFO\t: Closing user socket %d\n", USER_GETFD());
printf("INFO\t: Closing user socket %d\n", (int)USER_GETFD());
USER_CLOSE();
printf("INFO\t: User simulator exited\n");
exit(EXIT_SUCCESS);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment