Index: App/Services/CommBuffers.c =================================================================== diff -u -r1d856a336fbfdc72a1e1165b64f1725e497c5f65 -ra0f8a69651a1c29c9f76894aed5ab23ee8ace7c7 --- App/Services/CommBuffers.c (.../CommBuffers.c) (revision 1d856a336fbfdc72a1e1165b64f1725e497c5f65) +++ App/Services/CommBuffers.c (.../CommBuffers.c) (revision a0f8a69651a1c29c9f76894aed5ab23ee8ace7c7) @@ -101,18 +101,15 @@ if ( len <= ( COMM_BUFFER_LENGTH - currentActiveBufCount ) ) { U08 *buffPtr; // buffer destination for added data - U08 *srcPtr; // data source // adjust buffer count per this data add (also reserves space to add data before releasing thread protection) commBufferByteCount[buffer][activeBuffer] += len; // release thread protection _enable_IRQ(); // set destination pointer to end of active buffer data buffPtr = &commBuffers[buffer][activeBuffer][currentActiveBufCount]; - // get source pointer to start of given data array - srcPtr = data; // copy source data to destination buffer - memcpy( buffPtr, srcPtr, len ); + memcpy( buffPtr, data, len ); // data successfully added to buffer result = TRUE; } @@ -162,7 +159,7 @@ U32 activeBuffer = activeDoubleBuffer[buffer]; U32 inactiveBuffer = ( activeBuffer == 0 ? 1 : 0 ); U32 bytesInInactiveBuffer = commBufferByteCount[buffer][inactiveBuffer]; - U32 sizeOfFirstConsumption = ( len <= bytesInInactiveBuffer ? len : bytesInInactiveBuffer ); + U32 sizeOfFirstConsumption = MIN( len, bytesInInactiveBuffer ); // see what we can get from inactive buffer getDataFromInactiveBuffer( buffer, data, sizeOfFirstConsumption ); // will switch double buffers if we empty inactive buffer