Skip to content

Commit

Permalink
Fix FMI3_LS_BUS_READ_NEXT_OPERATION for operations without payload (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemensB authored Nov 10, 2023
1 parent ca81817 commit 3fb6a33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ls-bus-guide/headers/fmi3LsBusUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ typedef struct
* \return fmi3True if a new operation is available, otherwise fmi3False.
*/
#define FMI3_LS_BUS_READ_NEXT_OPERATION(BufferInfo, Operation) \
((fmi3UInt32)((BufferInfo)->writePos - (BufferInfo)->readPos) > sizeof(fmi3LsBusOperationHeader) && \
((fmi3UInt32)((BufferInfo)->writePos - (BufferInfo)->readPos) >= sizeof(fmi3LsBusOperationHeader) && \
(fmi3UInt32)((BufferInfo)->writePos - (BufferInfo)->readPos) >= ((fmi3LsBusOperationHeader*)(BufferInfo)->readPos)->length) \
? ((Operation) = (fmi3LsBusOperationHeader*)(BufferInfo)->readPos, (BufferInfo)->readPos += (Operation)->length), \
fmi3True : fmi3False\
Expand Down Expand Up @@ -186,7 +186,7 @@ typedef struct
* \return fmi3True if a new operation is available, otherwise fmi3False.
*/
#define FMI3_LS_BUS_READ_NEXT_OPERATION_DIRECT(Buffer, BufferLength, ReadPos, Operation) \
(((BufferLength) - (ReadPos)) > sizeof(fmi3LsBusOperationHeader) && \
(((BufferLength) - (ReadPos)) >= sizeof(fmi3LsBusOperationHeader) && \
((BufferLength) - (ReadPos)) >= ((fmi3LsBusOperationHeader*)((Buffer) + (ReadPos)))->length) \
? ((Operation) = (fmi3LsBusOperationHeader*)((Buffer) + (ReadPos)), (ReadPos) += (Operation)->length), \
fmi3True : fmi3False\
Expand Down

0 comments on commit 3fb6a33

Please sign in to comment.