Explicit casting added to the 'check for time out' function to ensure integer promotion does not occur.

This commit is contained in:
Richard Barry 2009-07-25 18:10:16 +00:00
parent af6c245366
commit 87eb48c97c

View file

@ -1693,7 +1693,7 @@ portBASE_TYPE xReturn;
else /* We are not blocking indefinitely, perform the checks below. */
#endif
if( ( xNumOfOverflows != pxTimeOut->xOverflowCount ) && ( xTickCount >= pxTimeOut->xTimeOnEntering ) )
if( ( xNumOfOverflows != pxTimeOut->xOverflowCount ) && ( ( portTickType ) xTickCount >= ( portTickType ) pxTimeOut->xTimeOnEntering ) )
{
/* The tick count is greater than the time at which vTaskSetTimeout()
was called, but has also overflowed since vTaskSetTimeOut() was called.
@ -1701,10 +1701,10 @@ portBASE_TYPE xReturn;
passed since vTaskSetTimeout() was called. */
xReturn = pdTRUE;
}
else if( ( xTickCount - pxTimeOut->xTimeOnEntering ) < *pxTicksToWait )
else if( ( ( portTickType ) xTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering ) < ( portTickType ) *pxTicksToWait )
{
/* Not a genuine timeout. Adjust parameters for time remaining. */
*pxTicksToWait -= ( xTickCount - pxTimeOut->xTimeOnEntering );
*pxTicksToWait -= ( ( portTickType ) xTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering );
vTaskSetTimeOutState( pxTimeOut );
xReturn = pdFALSE;
}