1
0
Fork 0

CO_gateway_ascii: static analysis: side effects on right hand of logical operator [MISRA 2012 Rule 13.5, required]

This commit is contained in:
temi54c1l8 2024-06-27 11:03:40 +02:00
parent c5160499f8
commit 6440f8b6b6

View file

@ -656,8 +656,8 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
* COMMAND PARSER * COMMAND PARSER
***************************************************************************/ ***************************************************************************/
/* if idle, search for new command, skip comments or empty lines */ /* if idle, search for new command, skip comments or empty lines */
while ((gtwa->state == CO_GTWA_ST_IDLE) while (CO_fifo_CommSearch(&gtwa->commFifo, false) &&
&& CO_fifo_CommSearch(&gtwa->commFifo, false) (gtwa->state == CO_GTWA_ST_IDLE)
) { ) {
char tok[20]; char tok[20];
size_t n; size_t n;
@ -683,7 +683,11 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
} }
else { /* MISRA C 2004 14.10 */ } else { /* MISRA C 2004 14.10 */ }
if ((tok[0] != '[') || (tok[strlen(tok)-1U] != ']')) { if (tok[0] != '[') {
err = true;
break;
}
if (tok[strlen(tok)-1U] != ']') {
err = true; err = true;
break; break;
} }
@ -1781,17 +1785,16 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
/* If not all data were transferred, make sure, there is enough data in /* If not all data were transferred, make sure, there is enough data in
* SDO buffer, to continue communication. Otherwise wait and check for * SDO buffer, to continue communication. Otherwise wait and check for
* timeout */ * timeout */
if (gtwa->SDOdataCopyStatus if (gtwa->SDOdataCopyStatus) {
&& (CO_fifo_getOccupied(&gtwa->SDO_C->bufFifo) < if( CO_fifo_getOccupied(&gtwa->SDO_C->bufFifo) < (CO_CONFIG_GTW_BLOCK_DL_LOOP * 7U)) {
(CO_CONFIG_GTW_BLOCK_DL_LOOP * 7U)) if (gtwa->stateTimeoutTmr > CO_GTWA_STATE_TIMEOUT_TIME_US) {
) { abortCode = CO_SDO_AB_DEVICE_INCOMPAT;
if (gtwa->stateTimeoutTmr > CO_GTWA_STATE_TIMEOUT_TIME_US) { abort_comm = true;
abortCode = CO_SDO_AB_DEVICE_INCOMPAT; }
abort_comm = true; else {
} gtwa->stateTimeoutTmr += timeDifference_us;
else { hold = true;
gtwa->stateTimeoutTmr += timeDifference_us; }
hold = true;
} }
} }
if (!hold || abort_comm) { if (!hold || abort_comm) {
@ -2189,10 +2192,10 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
/* execute next CANopen processing immediately, if idle and more commands /* execute next CANopen processing immediately, if idle and more commands
* available */ * available */
if ((timerNext_us != NULL) && (gtwa->state == CO_GTWA_ST_IDLE) if ((timerNext_us != NULL) && (gtwa->state == CO_GTWA_ST_IDLE)) {
&& CO_fifo_CommSearch(&gtwa->commFifo, false) if(CO_fifo_CommSearch(&gtwa->commFifo, false)) {
) { *timerNext_us = 0;
*timerNext_us = 0; }
} }
} }