[x264-devel] [Git][videolan/x264][master] Fix -Wchar-subscripts and -Wstrict-aliasing warnings
Anton Mitrofanov (@BugMaster)
gitlab at videolan.org
Mon Feb 21 21:50:54 UTC 2022
Anton Mitrofanov pushed to branch master at VideoLAN / x264
Commits:
ff8a127e by Anton Mitrofanov at 2022-02-21T21:43:01+00:00
Fix -Wchar-subscripts and -Wstrict-aliasing warnings
- - - - -
3 changed files:
- common/base.c
- common/base.h
- tools/checkasm.c
Changes:
=====================================
common/base.c
=====================================
@@ -35,6 +35,8 @@
#include <sys/mman.h>
#endif
+#define X264_ISDIGIT(x) isdigit((unsigned char)(x))
+
/****************************************************************************
* x264_reduce_fraction:
****************************************************************************/
@@ -922,7 +924,7 @@ REALIGN_STACK int x264_param_parse( x264_param_t *p, const char *name, const cha
if( 0 );
OPT("asm")
{
- p->cpu = isdigit(value[0]) ? (uint32_t)atoi(value) :
+ p->cpu = X264_ISDIGIT(value[0]) ? (uint32_t)atoi(value) :
!strcasecmp(value, "auto") || atobool(value) ? x264_cpu_detect() : 0;
if( b_error )
{
=====================================
common/base.h
=====================================
@@ -82,7 +82,7 @@ typedef union { x264_uint128_t i; uint64_t q[2]; uint32_t d[4]; uint16_t w[8]; u
#define MEM_DYN(x, t) (*(t (*)[])(x))
#else
//older versions of gcc prefer casting to structure instead of array
-#define MEM_FIX(x, t, s) (*(struct { t a[s]; } (*))(x))
+#define MEM_FIX(x, t, s) (*(struct { t a[s]; } MAY_ALIAS (*))(x))
//let's set an arbitrary large constant size
#define MEM_DYN(x, t) MEM_FIX(x, t, 4096)
#endif
=====================================
tools/checkasm.c
=====================================
@@ -54,6 +54,8 @@ static pixel *pbuf3, *pbuf4;
#define FMT_PIXEL "%02x"
#endif
+#define X264_ISDIGIT(x) isdigit((unsigned char)(x))
+
static int quiet = 0;
#define report( name ) { \
@@ -148,8 +150,8 @@ static int cmp_bench( const void *a, const void *b )
{
if( !*sa && !*sb )
return 0;
- if( isdigit( *sa ) && isdigit( *sb ) && isdigit( sa[1] ) != isdigit( sb[1] ) )
- return isdigit( sa[1] ) - isdigit( sb[1] );
+ if( X264_ISDIGIT( *sa ) && X264_ISDIGIT( *sb ) && X264_ISDIGIT( sa[1] ) != X264_ISDIGIT( sb[1] ) )
+ return X264_ISDIGIT( sa[1] ) - X264_ISDIGIT( sb[1] );
if( *sa != *sb )
return *sa - *sb;
}
View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/ff8a127e8a82130a80952c8c34e42d9013feeecd
--
View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/ff8a127e8a82130a80952c8c34e42d9013feeecd
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the x264-devel
mailing list