add parenthesis to #define'd constants so later multipications work correctly
authormjsousa <msousa@fe.up.pt>
Wed, 02 Jun 2021 11:09:57 +0100
changeset 14 5b6407edfe8e
parent 13 6f6451e78531
child 15 cadd89d14ca5
add parenthesis to #define'd constants so later multipications work correctly
mb_rtu_private.h
mb_util.h
--- a/mb_rtu_private.h	Wed Jun 02 09:23:13 2021 +0100
+++ b/mb_rtu_private.h	Wed Jun 02 11:09:57 2021 +0100
@@ -49,7 +49,7 @@
   * due to the algorithm used to work around aborted frames.
   */
 #define RECV_BUFFER_SIZE_SMALL  (MAX_RTU_FRAME_LENGTH + 10)
-#define RECV_BUFFER_SIZE_LARGE  (2 * MAX_RTU_FRAME_LENGTH)
+#define RECV_BUFFER_SIZE_LARGE  (2 * (MAX_RTU_FRAME_LENGTH))
 
 
 /* Frame lengths... */
--- a/mb_util.h	Wed Jun 02 09:23:13 2021 +0100
+++ b/mb_util.h	Wed Jun 02 11:09:57 2021 +0100
@@ -86,7 +86,7 @@
 #define TCP_HEADER_LENGTH       6
 
  /* Global Frame sizes */
-#define MAX_RTU_FRAME_LENGTH MAX_L2_FRAME_LENGTH + RTU_FRAME_CRC_LENGTH
+#define MAX_RTU_FRAME_LENGTH (MAX_L2_FRAME_LENGTH + RTU_FRAME_CRC_LENGTH)
 #define MAX_ASC_FRAME_LENGTH ((MAX_L2_FRAME_LENGTH * L2_TO_ASC_CODING) +             \
                               ASC_FRAME_HEADER_LENGTH + ASC_FRAME_TAIL_LENGTH +      \
                               ASC_FRAME_LRC_LENGTH)