From 2d53cdc8cea0df548c73df12644de867b1e1eaac Mon Sep 17 00:00:00 2001 From: Peter Krefting Date: Mon, 17 Oct 2022 14:05:02 +0100 Subject: [PATCH] Fix compiler warnings - Help compiler to promote constants to size_t instead of int. - Cast pointer diff to size_t; in C99 ptrdiff_t and size_t are the same size, but one is signed and the other not. --- scte/35.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scte/35.h b/scte/35.h index 3b2f6d5..98e67f8 100644 --- a/scte/35.h +++ b/scte/35.h @@ -547,18 +547,18 @@ static inline bool scte35_insert_validate(const uint8_t *p_scte35) if (i_length < SCTE35_INSERT_HEADER_SIZE + SCTE35_INSERT_HEADER2_SIZE + SCTE35_SPLICE_TIME_HEADER_SIZE || - i_length < SCTE35_INSERT_HEADER_SIZE + SCTE35_INSERT_HEADER2_SIZE + + i_length < (size_t)SCTE35_INSERT_HEADER_SIZE + SCTE35_INSERT_HEADER2_SIZE + scte35_splice_time_size( scte35_insert_get_splice_time(p_scte35))) return false; if (scte35_insert_has_duration(p_scte35)) - return i_length >= SCTE35_INSERT_HEADER_SIZE + + return i_length >= (size_t)SCTE35_INSERT_HEADER_SIZE + SCTE35_INSERT_HEADER2_SIZE + scte35_splice_time_size(scte35_insert_get_splice_time(p_scte35)) + SCTE35_BREAK_DURATION_HEADER_SIZE + SCTE35_INSERT_FOOTER_SIZE; - return i_length >= SCTE35_INSERT_HEADER_SIZE + + return i_length >= (size_t)SCTE35_INSERT_HEADER_SIZE + SCTE35_INSERT_HEADER2_SIZE + scte35_splice_time_size(scte35_insert_get_splice_time(p_scte35)) + SCTE35_INSERT_FOOTER_SIZE; @@ -575,9 +575,9 @@ static inline bool scte35_insert_validate(const uint8_t *p_scte35) return false; if (scte35_insert_has_duration(p_scte35)) - return i_length >= p_end + SCTE35_BREAK_DURATION_HEADER_SIZE + - SCTE35_INSERT_FOOTER_SIZE - p_command; - return i_length >= p_end + SCTE35_INSERT_FOOTER_SIZE - p_command; + return i_length >= (size_t)(p_end + SCTE35_BREAK_DURATION_HEADER_SIZE + + SCTE35_INSERT_FOOTER_SIZE - p_command); + return i_length >= (size_t)(p_end + SCTE35_INSERT_FOOTER_SIZE - p_command); } /*****************************************************************************