Fix error introduced when merging #264. (#286)

This commit is contained in:
RichardBarry 2021-03-20 12:59:51 -07:00 committed by GitHub
parent 6685c042cb
commit 6b72419c78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -496,7 +496,7 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer )
{ {
const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer; const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
size_t xSpace; size_t xSpace;
volatile size_t xOriginalTail; size_t xOriginalTail;
configASSERT( pxStreamBuffer ); configASSERT( pxStreamBuffer );
@ -726,7 +726,7 @@ static size_t prvWriteMessageToBuffer( StreamBuffer_t * const pxStreamBuffer,
{ {
size_t xNextHead = pxStreamBuffer->xHead; size_t xNextHead = pxStreamBuffer->xHead;
if( xDataLengthBytes != xRequiredSpace ) if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )
{ {
/* This is a message buffer, as opposed to a stream buffer. */ /* This is a message buffer, as opposed to a stream buffer. */
@ -735,7 +735,7 @@ static size_t prvWriteMessageToBuffer( StreamBuffer_t * const pxStreamBuffer,
/* There is enough space to write both the message length and the message /* There is enough space to write both the message length and the message
* itself into the buffer. Start by writing the length of the data, the data * itself into the buffer. Start by writing the length of the data, the data
* itself will be written later in this function. */ * itself will be written later in this function. */
xNextHead = prvWriteBytesToBuffer( pxStreamBuffer, ( const uint8_t * ) &( xDataLengthBytes ), sbBYTES_TO_STORE_MESSAGE_LENGTH, xNextHead); xNextHead = prvWriteBytesToBuffer( pxStreamBuffer, ( const uint8_t * ) &( xDataLengthBytes ), sbBYTES_TO_STORE_MESSAGE_LENGTH, xNextHead );
} }
else else
{ {
@ -883,7 +883,7 @@ size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer )
/* The number of bytes available is greater than the number of bytes /* The number of bytes available is greater than the number of bytes
* required to hold the length of the next message, so another message * required to hold the length of the next message, so another message
* is available. */ * is available. */
( void ) prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) &xTempReturn, sbBYTES_TO_STORE_MESSAGE_LENGTH, pxStreamBuffer->xTail); ( void ) prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) &xTempReturn, sbBYTES_TO_STORE_MESSAGE_LENGTH, pxStreamBuffer->xTail );
xReturn = ( size_t ) xTempReturn; xReturn = ( size_t ) xTempReturn;
} }
else else
@ -939,7 +939,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,
* read bytes from the buffer. */ * read bytes from the buffer. */
if( xBytesAvailable > xBytesToStoreMessageLength ) if( xBytesAvailable > xBytesToStoreMessageLength )
{ {
xReceivedLength = prvReadMessageFromBuffer( pxStreamBuffer, pvRxData, xBufferLengthBytes, xBytesAvailable); xReceivedLength = prvReadMessageFromBuffer( pxStreamBuffer, pvRxData, xBufferLengthBytes, xBytesAvailable );
/* Was a task waiting for space in the buffer? */ /* Was a task waiting for space in the buffer? */
if( xReceivedLength != ( size_t ) 0 ) if( xReceivedLength != ( size_t ) 0 )