Improve comments and assertions in stream buffer (#277)

* Improve comments and assertions in stream buffer

* Add back null check instead of assert

* Adding config assert back
diff --git a/stream_buffer.c b/stream_buffer.c
index 5c6a47e..0c4f429 100644
--- a/stream_buffer.c
+++ b/stream_buffer.c
@@ -49,7 +49,7 @@
 #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021. */

 

 /* If the user has not provided application specific Rx notification macros,

- * or #defined the notification macros away, them provide default implementations

+ * or #defined the notification macros away, then provide default implementations

  * that uses task notifications. */

 /*lint -save -e9026 Function like macros allowed and needed here so they can be overridden. */

 #ifndef sbRECEIVE_COMPLETED

@@ -267,7 +267,6 @@
         {

             pucAllocatedMemory = NULL;

         }

-        

 

         if( pucAllocatedMemory != NULL )

         {

@@ -466,7 +465,7 @@
 

     /* The trigger level is the number of bytes that must be in the stream

      * buffer before a task that is waiting for data is unblocked. */

-    if( xTriggerLevel <= pxStreamBuffer->xLength )

+    if( xTriggerLevel < pxStreamBuffer->xLength )

     {

         pxStreamBuffer->xTriggerLevelBytes = xTriggerLevel;

         xReturn = pdPASS;

@@ -525,14 +524,15 @@
     size_t xReturn, xSpace = 0;

     size_t xRequiredSpace = xDataLengthBytes;

     TimeOut_t xTimeOut;

-

-    /* The maximum amount of space a stream buffer will ever report is its length

-     * minus 1. */

-    const size_t xMaxReportedSpace = pxStreamBuffer->xLength - ( size_t ) 1;

+    size_t xMaxReportedSpace = 0;

 

     configASSERT( pvTxData );

     configASSERT( pxStreamBuffer );

 

+    /* The maximum amount of space a stream buffer will ever report is its length

+     * minus 1. */

+    xMaxReportedSpace = pxStreamBuffer->xLength - ( size_t ) 1;

+

     /* This send function is used to write to both message buffers and stream

      * buffers.  If this is a message buffer then the space needed must be

      * increased by the amount of bytes needed to store the length of the