diff --git a/common/base.c b/common/base.c index 8e17e748bb364ed266a7d7f8439f9a5242c1878c..ce6614fbea4afac5c56ee74f2a187d97724799ad 100644 --- a/common/base.c +++ b/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 ) { diff --git a/common/base.h b/common/base.h index 40957ecdcec56288c65b4d2390bb40df829a7519..857c0fc47d74cd08a8129b847e1e985577ae2e86 100644 --- a/common/base.h +++ b/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 diff --git a/tools/checkasm.c b/tools/checkasm.c index 9b59c1e18baa2a03e3ea7895a047cbc62a17f1d9..829f3e26128ce8c0e09b91c554a489cf646316e2 100644 --- a/tools/checkasm.c +++ b/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; }