[vlc-devel] [PATCH 1/2] mpeg: es: fix -Wsign-compare warning
Alexandre Janniaux
ajanni at videolabs.io
Thu Jan 21 11:49:03 UTC 2021
../../modules/demux/mpeg/es.c: In function 'GenericProbe':
WARNING : ../../modules/demux/mpeg/es.c:827: 35: comparison of integer expressions of different signedness: 'uint64_t' {aka 'long unsigned int'} and 'ssize_t' {aka 'const long int'} [-Wsign-compare]
827 | if( i_skip + i_check_size > i_peek )
| ^
---
modules/demux/mpeg/es.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index 73449bf2a2..3ff4c05f98 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -824,7 +824,8 @@ static int GenericProbe( demux_t *p_demux, uint64_t *pi_offset,
for( ;; )
{
- if( i_skip + i_check_size > i_peek )
+ /* i_peek > 0 so we can cast into size_t. */
+ if( i_skip + i_check_size > (size_t)i_peek )
{
if( !b_forced_demux )
return VLC_EGENERIC;
@@ -852,7 +853,7 @@ static int GenericProbe( demux_t *p_demux, uint64_t *pi_offset,
i_size = i_samples * 2 * 2;
}
- if( i_skip + i_check_size + i_size <= i_peek )
+ if( i_skip + i_check_size + i_size <= (size_t)i_peek )
{
b_ok = pf_check( &p_peek[i_skip+i_size], NULL ) >= 0;
if( b_ok )
--
2.30.0
More information about the vlc-devel
mailing list