diff --git a/public/crclib.c b/public/crclib.c index e31beb8d..394da7c0 100644 --- a/public/crclib.c +++ b/public/crclib.c @@ -259,7 +259,7 @@ void MD5Update( MD5Context_t *ctx, const byte *buf, uint len ) } memcpy( p, buf, t ); - MD5Transform( ctx->buf, (uint *)ctx->in ); + MD5Transform( ctx->buf, ctx->in ); buf += t; len -= t; } @@ -268,7 +268,7 @@ void MD5Update( MD5Context_t *ctx, const byte *buf, uint len ) while( len >= 64 ) { memcpy( ctx->in, buf, 64 ); - MD5Transform( ctx->buf, (uint *)ctx->in ); + MD5Transform( ctx->buf, ctx->in ); buf += 64; len -= 64; } @@ -307,7 +307,7 @@ void MD5Final( byte digest[16], MD5Context_t *ctx ) // two lots of padding: pad the first block to 64 bytes memset( p, 0, count ); - MD5Transform( ctx->buf, (uint *)ctx->in ); + MD5Transform( ctx->buf, ctx->in ); // now fill the next block with 56 bytes memset( ctx->in, 0, 56 ); @@ -319,10 +319,10 @@ void MD5Final( byte digest[16], MD5Context_t *ctx ) } // append length in bits and transform - ((uint *)ctx->in)[14] = ctx->bits[0]; - ((uint *)ctx->in)[15] = ctx->bits[1]; + ctx->in[14] = ctx->bits[0]; + ctx->in[15] = ctx->bits[1]; - MD5Transform( ctx->buf, (uint *)ctx->in ); + MD5Transform( ctx->buf, ctx->in ); memcpy( digest, ctx->buf, 16 ); memset( ctx, 0, sizeof( *ctx )); // in case it's sensitive } diff --git a/public/crclib.h b/public/crclib.h index a63b5c44..a32cc3e8 100644 --- a/public/crclib.h +++ b/public/crclib.h @@ -23,7 +23,7 @@ typedef struct { uint buf[4]; uint bits[2]; - byte in[64]; + uint in[16]; } MD5Context_t; diff --git a/ref_gl/gl_dbghulls.c b/ref_gl/gl_dbghulls.c index d21cfae5..d457bfb3 100644 --- a/ref_gl/gl_dbghulls.c +++ b/ref_gl/gl_dbghulls.c @@ -17,7 +17,7 @@ GNU General Public License for more details. #include "mod_local.h" #define list_entry( ptr, type, member ) \ - ((type *)((char *)(ptr) - (size_t)(&((type *)0)->member))) + ((type *)((void *)(ptr) - (size_t)(&((type *)0)->member))) // iterate over each entry in the list #define list_for_each_entry( pos, head, member ) \ diff --git a/ref_gl/gl_sprite.c b/ref_gl/gl_sprite.c index 6069ed47..10596e9d 100644 --- a/ref_gl/gl_sprite.c +++ b/ref_gl/gl_sprite.c @@ -87,7 +87,7 @@ static const dframetype_t *R_SpriteLoadFrame( model_t *mod, const void *pin, msp pspriteframe->gl_texturenum = gl_texturenum; *ppframe = pspriteframe; - return ( const dframetype_t* )(( const byte* )pin + sizeof( dspriteframe_t ) + pinframe.width * pinframe.height * bytes ); + return ( const dframetype_t* )(( const void* )pin + sizeof( dspriteframe_t ) + pinframe.width * pinframe.height * bytes ); } /* @@ -157,7 +157,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui if( pin->version == SPRITE_VERSION_Q1 || pin->version == SPRITE_VERSION_32 ) numi = NULL; else if( pin->version == SPRITE_VERSION_HL ) - numi = (const short *)((const byte*)buffer + sizeof( dsprite_hl_t )); + numi = (const short *)(void *)((const byte*)buffer + sizeof( dsprite_hl_t )); r_texFlags = texFlags; sprite_version = pin->version; @@ -169,7 +169,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui rgbdata_t *pal; pal = gEngfuncs.FS_LoadImage( "#id.pal", (byte *)&i, 768 ); - pframetype = (const dframetype_t *)((const byte*)buffer + sizeof( dsprite_q1_t )); // pinq1 + 1 + pframetype = (const dframetype_t *)(void *)((const byte*)buffer + sizeof( dsprite_q1_t )); // pinq1 + 1 gEngfuncs.FS_FreeImage( pal ); // palette installed, no reason to keep this data } else if( *numi == 256 ) @@ -191,7 +191,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui break; } - pframetype = (const dframetype_t *)(src + 768); + pframetype = (const dframetype_t *)(void *)(src + 768); gEngfuncs.FS_FreeImage( pal ); // palette installed, no reason to keep this data } else diff --git a/wscript b/wscript index 259f6baf..ef88b5fb 100644 --- a/wscript +++ b/wscript @@ -271,7 +271,7 @@ def configure(conf): '-Werror=duplicated-branches', # BEWARE: buggy '-Werror=bool-compare', '-Werror=bool-operation', - '-Werror=cast-align', + '-Wcast-align', '-Werror=cast-align=strict', # =strict is for GCC >=8 '-Werror=packed', '-Werror=packed-not-aligned',