Skip to content

Commit 1b3825f

Browse files
authored
Fix -Wuseless-cast compiler warning for public headers (#115)
**Issue #:** awslabs/aws-c-common#973 **Research:** 6 years ago, PR #5 made these constants `uint32_t` via a cast. **Description of changes:** Avoid `-Wuseless-cast` warnings, don't cast `size_t` to `uint32_t` on 32-bit platforms.
1 parent 7a014d8 commit 1b3825f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/aws/event-stream/event_stream.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ struct aws_event_stream_message {
6565
struct aws_byte_buf message_buffer;
6666
};
6767

68-
#define AWS_EVENT_STREAM_PRELUDE_LENGTH (uint32_t)(sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t))
68+
/* Prelude (12-bytes) = Total Byte Length (4-bytes) + Headers Byte Length (4-bytes) + Prelude CRC (4-bytes) */
69+
#define AWS_EVENT_STREAM_PRELUDE_LENGTH (uint32_t)(12)
6970

70-
#define AWS_EVENT_STREAM_TRAILER_LENGTH (uint32_t)(sizeof(uint32_t))
71+
/* Trailer (4-bytes) = Message CRC (4-bytes) */
72+
#define AWS_EVENT_STREAM_TRAILER_LENGTH (uint32_t)(4)
7173

7274
enum aws_event_stream_header_value_type {
7375
AWS_EVENT_STREAM_HEADER_BOOL_TRUE = 0,

0 commit comments

Comments
 (0)