Use pdTRUE/pdFALSE instead of TRUE/FALSE in xStreamBufferSend(). (#114)

This commit is contained in:
Yuhui Zheng 2020-08-11 21:44:57 -07:00 committed by GitHub
parent 61fc74f0c5
commit 4bde12f223
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -551,13 +551,13 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
* values to be returned. A confusion could exist to the caller. Returning 0 because a timeout occurred * values to be returned. A confusion could exist to the caller. Returning 0 because a timeout occurred
* and a subsequent send attempts could eventually succeed, and returning 0 because a write could never * and a subsequent send attempts could eventually succeed, and returning 0 because a write could never
* happen because of the size are two scenarios to me :/ */ * happen because of the size are two scenarios to me :/ */
xIsFeasible = FALSE; xIsFeasible = pdFALSE;
} }
else else
{ {
/* It is possible to write the message completely in the buffer. This is the intended route. /* It is possible to write the message completely in the buffer. This is the intended route.
* Let's continue with the regular timeout logic. */ * Let's continue with the regular timeout logic. */
xIsFeasible = TRUE; xIsFeasible = pdTRUE;
} }
} }
else else
@ -575,17 +575,17 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
/* TODO FIXME: Is there a check we should do with the xTriggerLevelBytes value ? */ /* TODO FIXME: Is there a check we should do with the xTriggerLevelBytes value ? */
/* With the adjustment to 'xRequiredSpace', the deadlock is avoided, thus it's now feasible. */ /* With the adjustment to 'xRequiredSpace', the deadlock is avoided, thus it's now feasible. */
xIsFeasible = TRUE; xIsFeasible = pdTRUE;
} }
else else
{ {
/* It is possible to write the message completely in the buffer. */ /* It is possible to write the message completely in the buffer. */
xIsFeasible = TRUE; xIsFeasible = pdTRUE;
} }
} }
/* Added check against xIsFeasible. If it's not feasible, don't even wait for notification, let the call to 'prvWriteMessageToBuffer' do nothing and return 0 */ /* Added check against xIsFeasible. If it's not feasible, don't even wait for notification, let the call to 'prvWriteMessageToBuffer' do nothing and return 0 */
if( xTicksToWait != ( TickType_t ) 0 && xIsFeasible == TRUE ) if( xTicksToWait != ( TickType_t ) 0 && xIsFeasible == pdTRUE )
{ {
vTaskSetTimeOutState( &xTimeOut ); vTaskSetTimeOutState( &xTimeOut );