Reduce scope of local variables to avoid warning about shadowing
After adding -Wshadow to build options, gcc produced following warning:
305/CO_LSSslave.c: In function ‘CO_LSSslave_receive’:
305/CO_LSSslave.c:114:30: warning: declaration of ‘valSw’ shadows a
previous local [-Wshadow]
114 | uint32_t valSw;
| ^~~~~
305/CO_LSSslave.c:76:22: note: shadowed declaration is here
76 | uint32_t valSw;
| ^~~~~
This commit is contained in:
parent
2c9d07f265
commit
ddc2443cfd
1 changed files with 4 additions and 1 deletions
|
|
@ -73,24 +73,27 @@ static void CO_LSSslave_receive(void *object, void *msg)
|
|||
}
|
||||
}
|
||||
else if(LSSslave->lssState == CO_LSS_STATE_WAITING) {
|
||||
uint32_t valSw;
|
||||
switch (cs) {
|
||||
case CO_LSS_SWITCH_STATE_SEL_VENDOR: {
|
||||
uint32_t valSw;
|
||||
memcpy(&valSw, &data[1], sizeof(valSw));
|
||||
LSSslave->lssSelect.identity.vendorID = CO_SWAP_32(valSw);
|
||||
break;
|
||||
}
|
||||
case CO_LSS_SWITCH_STATE_SEL_PRODUCT: {
|
||||
uint32_t valSw;
|
||||
memcpy(&valSw, &data[1], sizeof(valSw));
|
||||
LSSslave->lssSelect.identity.productCode = CO_SWAP_32(valSw);
|
||||
break;
|
||||
}
|
||||
case CO_LSS_SWITCH_STATE_SEL_REV: {
|
||||
uint32_t valSw;
|
||||
memcpy(&valSw, &data[1], sizeof(valSw));
|
||||
LSSslave->lssSelect.identity.revisionNumber = CO_SWAP_32(valSw);
|
||||
break;
|
||||
}
|
||||
case CO_LSS_SWITCH_STATE_SEL_SERIAL: {
|
||||
uint32_t valSw;
|
||||
memcpy(&valSw, &data[1], sizeof(valSw));
|
||||
LSSslave->lssSelect.identity.serialNumber = CO_SWAP_32(valSw);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue