Commit 1cb484f1 authored by frtabu's avatar frtabu

fix more trivial cppcheck errors and warnings

parent d171e18c
......@@ -164,9 +164,10 @@ int processoption(paramdef_t *cfgoptions, char *value) {
*/
int config_check_unknown_cmdlineopt(char *prefix) {
int unknowndetected=0;
char testprefix[CONFIG_MAXOPTLENGTH]="";
char testprefix[CONFIG_MAXOPTLENGTH];
int finalcheck = 0;
memset(testpref,0,sizeof(testprefix));
if (prefix != NULL) {
if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
finalcheck = 1;
......
......@@ -270,6 +270,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re
for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i)
{
phy_info phy;
memset(phy,0,sizeof(phy));
phy.index = resp->pnf_phy.phy[i].phy_config_index;
printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
......@@ -287,6 +288,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
rf_info rf;
memset(rf,0,sizeof(rf));
rf.index = resp->pnf_rf.rf[i].rf_config_index;
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
......@@ -897,7 +899,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
// for now just 1
printf("[VNF] %d.%d pnf p7 %s:%d timing %d %d %d %d\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period);
printf("[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period);
req->header.message_id = NFAPI_CONFIG_REQUEST;
req->header.phy_id = phy->id;
......@@ -919,7 +921,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
printf("[VNF] Timing window:%d\n", p7_vnf->timing_window);
printf("[VNF] Timing window:%u\n", p7_vnf->timing_window);
req->num_tlv++;
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
......
This diff is collapsed.
......@@ -47,27 +47,20 @@ void
ccodedot11_encode (unsigned int numbytes,
unsigned char *inPtr,
unsigned char *outPtr,
unsigned char puncturing)
{
unsigned char puncturing) {
unsigned int state;
unsigned char c, out, shiftbit =0;
// printf("In ccodedot11_encode (%d,%p,%p,%d)\n",numbytes,inPtr,outPtr,puncturing);
#ifdef DEBUG_CCODE
unsigned int dummy;
#endif //DEBUG_CCODE
int bit_index;
/* The input bit is shifted in position 8 of the state.
Shiftbit will take values between 1 and 8 */
state = 0;
#ifdef DEBUG_CCODE
dummy = 0;
#endif //DEBUG_CCODE
/* Do not increment inPtr until we read the next octet */
bit_index=0;
......@@ -80,7 +73,6 @@ ccodedot11_encode (unsigned int numbytes,
switch (puncturing) {
case 0: //rate 1/2
for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) {
......@@ -88,22 +80,18 @@ ccodedot11_encode (unsigned int numbytes,
}
out = ccodedot11_table[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
printf("%u: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2;
#endif //DEBUG_CCODE
}
break;
case 1: // rate 3/4
for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) {
......@@ -119,10 +107,9 @@ ccodedot11_encode (unsigned int numbytes,
*outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
printf("%u: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2;
#endif //DEBUG_CCODE
bit_index=(bit_index==2)?0:(bit_index+1);
}
......@@ -130,7 +117,6 @@ ccodedot11_encode (unsigned int numbytes,
case 2: // rate 2/3
for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) {
......@@ -138,19 +124,16 @@ ccodedot11_encode (unsigned int numbytes,
}
out = ccodedot11_table[state];
*outPtr++ = out & 1;
if (bit_index==0)
*outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]);
printf("%d: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2;
#endif //DEBUG_CCODE
bit_index=(bit_index==0)?1:0;
}
break;
......@@ -181,8 +164,6 @@ ccodedot11_encode (unsigned int numbytes,
}
*/
}
......@@ -197,8 +178,7 @@ ccodedot11_encode (unsigned int numbytes,
/* Basic code table initialization for constraint length 7 */
/* Input in MSB, followed by state in 6 LSBs */
void ccodedot11_init(void)
{
void ccodedot11_init(void) {
unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) {
......@@ -219,8 +199,7 @@ void ccodedot11_init(void)
}
/* Input in LSB, followed by state in 6 MSBs */
void ccodedot11_init_inv(void)
{
void ccodedot11_init_inv(void) {
unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) {
......@@ -251,21 +230,15 @@ void ccodedot11_init_inv(void)
#ifdef DEBUG_CCODE
#include <stdio.h>
main()
{
main() {
unsigned char test[] = "0Thebigredfox";
unsigned char output[512], *inPtr, *outPtr;
unsigned int i;
test[0] = 128;
test[1] = 0;
ccodedot11_init();
inPtr = test;
outPtr = output;
ccodedot11_encode(16, inPtr, outPtr,0);
for (i = 0; i < 32; i++) printf("%x ", output[i]);
......
......@@ -52,20 +52,16 @@ ccodelte_encode (int32_t numbits,
uint8_t add_crc,
uint8_t *inPtr,
uint8_t *outPtr,
uint16_t rnti)
{
uint16_t rnti) {
uint32_t state;
uint8_t c, out, first_bit;
int8_t shiftbit=0;
uint16_t c16;
uint16_t next_last_byte=0;
uint32_t crc=0;
#ifdef DEBUG_CCODE
uint32_t dummy=0;
#endif //DEBUG_CCODE
/* The input bit is shifted in position 8 of the state.
Shiftbit will take values between 1 and 8 */
state = 0;
......@@ -137,17 +133,12 @@ ccodelte_encode (int32_t numbits,
#endif //DEBUG_CCODE
/* Do not increment inPtr until we read the next octet */
while (numbits > 0) {
c = *inPtr++;
#ifdef DEBUG_CCODE
printf("** %x **\n",c);
#endif //DEBUG_CCODE
// for (shiftbit = 0; (shiftbit<8) && (numbits>0);shiftbit++,numbits--) {
for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) {
state >>= 1;
......@@ -157,23 +148,18 @@ ccodelte_encode (int32_t numbits,
}
out = ccodelte_table[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1;
#ifdef DEBUG_CCODE
printf("numbits %d, input %d, outbit %d: %d -> %d (%d%d%d)\n",numbits,state>>6,dummy,state,out,out&1,(out>>1)&1,(out>>2)&1);
dummy+=3;
#endif //DEBUG_CCODE
}
}
// now code 8-bit CRC for UCI
if (add_crc == 1) {
c = (uint8_t)(crc>>24);
// for (shiftbit = 0; (shiftbit<8);shiftbit++) {
......@@ -185,22 +171,18 @@ ccodelte_encode (int32_t numbits,
}
out = ccodelte_table[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1;
#ifdef DEBUG_CCODE
printf("crc bit %d input %d, outbit %d: %d -> %d (%d)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
printf("crc bit %d input %d, outbit %d: %d -> %d (%u)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
dummy+=3;
#endif //DEBUG_CCODE
}
}
// now code 16-bit CRC for DCI
if (add_crc == 2) {
c16 = (uint16_t)(crc>>16);
// for (shiftbit = 0; (shiftbit<16);shiftbit++) {
......@@ -212,16 +194,13 @@ ccodelte_encode (int32_t numbits,
}
out = ccodelte_table[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1;
#ifdef DEBUG_CCODE
printf("crc bit %d input %d, outbit %d: %d -> %d (%d)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
printf("crc bit %d input %d, outbit %d: %d -> %d (%u)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
dummy+=3;
#endif //DEBUG_CCODE
}
}
}
......@@ -238,8 +217,7 @@ ccodelte_encode (int32_t numbits,
/* Basic code table initialization for constraint length 7 */
/* Input in MSB, followed by state in 6 LSBs */
void ccodelte_init(void)
{
void ccodelte_init(void) {
unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) {
......@@ -260,8 +238,7 @@ void ccodelte_init(void)
}
/* Input in LSB, followed by state in 6 MSBs */
void ccodelte_init_inv(void)
{
void ccodelte_init_inv(void) {
unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) {
......@@ -281,8 +258,7 @@ void ccodelte_init_inv(void)
}
}
void ccodedab_init(void)
{
void ccodedab_init(void) {
unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) {
......@@ -303,8 +279,7 @@ void ccodedab_init(void)
}
/* Input in LSB, followed by state in 6 MSBs */
void ccodedab_init_inv(void)
{
void ccodedab_init_inv(void) {
unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) {
......@@ -334,21 +309,15 @@ void ccodedab_init_inv(void)
#ifdef CCODE_MAIN
#include <stdio.h>
main()
{
main() {
unsigned char test[] = "Thebigredfox";
unsigned char output[512], *inPtr, *outPtr;
unsigned int i;
test[0] = 128;
test[1] = 0;
ccodelte_init();
inPtr = test;
outPtr = output;
ccodelte_encode(21, inPtr, outPtr);
for (i = 0; i < 21*3; i++) printf("%x ", output[i]);
......
This diff is collapsed.
......@@ -38,9 +38,7 @@ int lte_segmentation(unsigned char *input_buffer,
unsigned int *Cminus,
unsigned int *Kplus,
unsigned int *Kminus,
unsigned int *F)
{
unsigned int *F) {
unsigned int L,Bprime,Bprime_by_C,r,Kr,k,s,crc;
if (B<=6144) {
......@@ -56,7 +54,7 @@ int lte_segmentation(unsigned char *input_buffer,
Bprime = B+((*C)*L);
#ifdef DEBUG_SEGMENTATION
printf("Bprime %d\n",Bprime);
printf("Bprime %u\n",Bprime);
#endif
}
......@@ -68,7 +66,7 @@ int lte_segmentation(unsigned char *input_buffer,
// Find K+
Bprime_by_C = Bprime/(*C);
#ifdef DEBUG_SEGMENTATION
printf("Bprime_by_C %d\n",Bprime_by_C);
printf("Bprime_by_C %u\n",Bprime_by_C);
#endif
// Bprime = Bprime_by_C>>3;
......@@ -93,17 +91,16 @@ int lte_segmentation(unsigned char *input_buffer,
*Kminus = (*Kplus - 32);
} else if (Bprime_by_C <=6144 ) { // increase by 8 bytes til here
*Kplus = (Bprime_by_C>>6)<<6;
#ifdef DEBUG_SEGMENTATION
printf("Bprime_by_C_by_C %d , Kplus %d\n",Bprime_by_C,*Kplus);
printf("Bprime_by_C_by_C %u , Kplus %u\n",Bprime_by_C,*Kplus);
#endif
if (*Kplus < Bprime_by_C)
*Kplus = *Kplus + 64;
#ifdef DEBUG_SEGMENTATION
printf("Bprime_by_C_by_C %d , Kplus2 %d\n",Bprime_by_C,*Kplus);
printf("Bprime_by_C_by_C %u , Kplus2 %u\n",Bprime_by_C,*Kplus);
#endif
*Kminus = (*Kplus - 64);
} else {
......@@ -116,25 +113,21 @@ int lte_segmentation(unsigned char *input_buffer,
*Kminus = 0;
*Cminus = 0;
} else {
// printf("More than one segment (%d), exiting \n",*C);
// exit(-1);
*Cminus = ((*C)*(*Kplus) - (Bprime))/((*Kplus) - (*Kminus));
*Cplus = (*C) - (*Cminus);
}
AssertFatal(Bprime <= (*Cplus)*(*Kplus) + (*Cminus)*(*Kminus),
"Bprime %d < (*Cplus %d)*(*Kplus %d) + (*Cminus %d)*(*Kminus %d)\n",
Bprime,*Cplus,*Kplus,*Cminus,*Kminus);
*F = ((*Cplus)*(*Kplus) + (*Cminus)*(*Kminus) - (Bprime));
#ifdef DEBUG_SEGMENTATION
printf("C %d, Cplus %d, Cminus %d, Kplus %d, Kminus %d, Bprime_bytes %d, Bprime %d, F %d\n",*C,*Cplus,*Cminus,*Kplus,*Kminus,Bprime>>3,Bprime,*F);
printf("C %u, Cplus %u, Cminus %u, Kplus %u, Kminus %u, Bprime_bytes %u, Bprime %u, F %u\n",*C,*Cplus,*Cminus,*Kplus,*Kminus,Bprime>>3,Bprime,*F);
#endif
if ((input_buffer) && (output_buffers)) {
for (k=0; k<*F>>3; k++) {
output_buffers[0][k] = 0;
}
......@@ -142,7 +135,6 @@ int lte_segmentation(unsigned char *input_buffer,
s=0;
for (r=0; r<*C; r++) {
if (r<*Cminus)
Kr = *Kminus;
else
......@@ -157,11 +149,11 @@ int lte_segmentation(unsigned char *input_buffer,
if (*C > 1) { // add CRC
crc = crc24b(output_buffers[r],Kr-24)>>8;
output_buffers[r][(Kr-24)>>3] = ((uint8_t*)&crc)[2];
output_buffers[r][1+((Kr-24)>>3)] = ((uint8_t*)&crc)[1];
output_buffers[r][2+((Kr-24)>>3)] = ((uint8_t*)&crc)[0];
output_buffers[r][(Kr-24)>>3] = ((uint8_t *)&crc)[2];
output_buffers[r][1+((Kr-24)>>3)] = ((uint8_t *)&crc)[1];
output_buffers[r][2+((Kr-24)>>3)] = ((uint8_t *)&crc)[0];
#ifdef DEBUG_SEGMENTATION
printf("Segment %d : CRC %x\n",r,crc);
printf("Segment %u : CRC %x\n",r,crc);
#endif
}
......@@ -175,9 +167,7 @@ int lte_segmentation(unsigned char *input_buffer,
#ifdef MAIN
main()
{
main() {
unsigned int Kplus,Kminus,C,Cplus,Cminus,F,Bbytes;
for (Bbytes=5; Bbytes<2*768; Bbytes++) {
......
This diff is collapsed.
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