[vlc-devel] [PATCH 3/4] vlc_common.h: Ensure clip_uint8_vlc returns an uint8_t

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Oct 22 09:49:48 CEST 2020


Even though the modified branch is logically guaranteed to return a
number that fits in an uint8, some compilers will complain that a signed
32 bits integer is returned
---
 include/vlc_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 323df74653..9742d2b943 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -585,7 +585,7 @@ VLC_USED
 static inline uint8_t clip_uint8_vlc( int32_t a )
 {
     if( a&(~255) ) return (-a)>>31;
-    else           return a;
+    else           return (uint8_t)a;
 }
 
 /**
-- 
2.20.1



More information about the vlc-devel mailing list