mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-12 16:18:01 +00:00
engine: fix strict aliasing issues found by an old armv7hf compiler
This commit is contained in:
parent
2ecbe5b67e
commit
b949da291e
@ -2247,7 +2247,8 @@ void CL_ReadNetMessage( void )
|
|||||||
|
|
||||||
while( CL_GetMessage( net_message_buffer, &curSize ))
|
while( CL_GetMessage( net_message_buffer, &curSize ))
|
||||||
{
|
{
|
||||||
if( cls.legacymode && *((int *)&net_message_buffer) == 0xFFFFFFFE )
|
const int split_header = 0xFFFFFFFE;
|
||||||
|
if( cls.legacymode && !memcmp( &split_header, net_message_buffer, sizeof( split_header )))
|
||||||
// Will rewrite existing packet by merged
|
// Will rewrite existing packet by merged
|
||||||
if( !NetSplit_GetLong( &cls.netchan.netsplit, &net_from, net_message_buffer, &curSize ) )
|
if( !NetSplit_GetLong( &cls.netchan.netsplit, &net_from, net_message_buffer, &curSize ) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -1534,7 +1534,7 @@ void CL_SendConsistencyInfo( sizebuf_t *msg )
|
|||||||
{
|
{
|
||||||
case force_exactfile:
|
case force_exactfile:
|
||||||
MD5_HashFile( md5, filename, NULL );
|
MD5_HashFile( md5, filename, NULL );
|
||||||
pc->value = *(int *)md5;
|
memcpy( &pc->value, md5, sizeof( pc->value ));
|
||||||
|
|
||||||
if( user_changed_diskfile )
|
if( user_changed_diskfile )
|
||||||
MSG_WriteUBitLong( msg, 0, 32 );
|
MSG_WriteUBitLong( msg, 0, 32 );
|
||||||
|
@ -284,8 +284,10 @@ int Image_ComparePalette( const byte *pal )
|
|||||||
void Image_SetPalette( const byte *pal, uint *d_table )
|
void Image_SetPalette( const byte *pal, uint *d_table )
|
||||||
{
|
{
|
||||||
byte rgba[4];
|
byte rgba[4];
|
||||||
|
uint uirgba; // TODO: palette looks byte-swapped on big-endian
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
// setup palette
|
// setup palette
|
||||||
switch( image.d_rendermode )
|
switch( image.d_rendermode )
|
||||||
{
|
{
|
||||||
@ -296,7 +298,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
|||||||
rgba[1] = pal[i*3+1];
|
rgba[1] = pal[i*3+1];
|
||||||
rgba[2] = pal[i*3+2];
|
rgba[2] = pal[i*3+2];
|
||||||
rgba[3] = 0xFF;
|
rgba[3] = 0xFF;
|
||||||
d_table[i] = *(uint *)rgba;
|
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||||
|
d_table[i] = uirgba;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LUMP_GRADIENT:
|
case LUMP_GRADIENT:
|
||||||
@ -306,7 +309,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
|||||||
rgba[1] = pal[766];
|
rgba[1] = pal[766];
|
||||||
rgba[2] = pal[767];
|
rgba[2] = pal[767];
|
||||||
rgba[3] = i;
|
rgba[3] = i;
|
||||||
d_table[i] = *(uint *)rgba;
|
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||||
|
d_table[i] = uirgba;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LUMP_MASKED:
|
case LUMP_MASKED:
|
||||||
@ -316,7 +320,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
|||||||
rgba[1] = pal[i*3+1];
|
rgba[1] = pal[i*3+1];
|
||||||
rgba[2] = pal[i*3+2];
|
rgba[2] = pal[i*3+2];
|
||||||
rgba[3] = 0xFF;
|
rgba[3] = 0xFF;
|
||||||
d_table[i] = *(uint *)rgba;
|
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||||
|
d_table[i] = uirgba;
|
||||||
}
|
}
|
||||||
d_table[255] = 0;
|
d_table[255] = 0;
|
||||||
break;
|
break;
|
||||||
@ -327,7 +332,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
|||||||
rgba[1] = pal[i*4+1];
|
rgba[1] = pal[i*4+1];
|
||||||
rgba[2] = pal[i*4+2];
|
rgba[2] = pal[i*4+2];
|
||||||
rgba[3] = pal[i*4+3];
|
rgba[3] = pal[i*4+3];
|
||||||
d_table[i] = *(uint *)rgba;
|
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||||
|
d_table[i] = uirgba;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -273,8 +273,10 @@ static void NET_NetadrToSockadr( netadr_t *a, struct sockaddr_storage *s )
|
|||||||
}
|
}
|
||||||
else if( a->type == NA_IP )
|
else if( a->type == NA_IP )
|
||||||
{
|
{
|
||||||
|
uint32_t ip;
|
||||||
((struct sockaddr_in *)s)->sin_family = AF_INET;
|
((struct sockaddr_in *)s)->sin_family = AF_INET;
|
||||||
((struct sockaddr_in *)s)->sin_addr.s_addr = *(uint32_t *)&a->ip;
|
memcpy( &ip, &a->ip, sizeof( ip ));
|
||||||
|
((struct sockaddr_in *)s)->sin_addr.s_addr = ip;
|
||||||
((struct sockaddr_in *)s)->sin_port = a->port;
|
((struct sockaddr_in *)s)->sin_port = a->port;
|
||||||
}
|
}
|
||||||
else if( a->type6 == NA_IP6 )
|
else if( a->type6 == NA_IP6 )
|
||||||
@ -314,7 +316,7 @@ static void NET_SockadrToNetadr( const struct sockaddr_storage *s, netadr_t *a )
|
|||||||
if( s->ss_family == AF_INET )
|
if( s->ss_family == AF_INET )
|
||||||
{
|
{
|
||||||
a->type = NA_IP;
|
a->type = NA_IP;
|
||||||
*(int *)&a->ip = ((struct sockaddr_in *)s)->sin_addr.s_addr;
|
memcpy( &a->ip, &((struct sockaddr_in *)s)->sin_addr.s_addr, sizeof( uint32_t ));
|
||||||
a->port = ((struct sockaddr_in *)s)->sin_port;
|
a->port = ((struct sockaddr_in *)s)->sin_port;
|
||||||
}
|
}
|
||||||
else if( s->ss_family == AF_INET6 )
|
else if( s->ss_family == AF_INET6 )
|
||||||
|
@ -122,7 +122,7 @@ void SV_ParseConsistencyResponse( sv_client_t *cl, sizebuf_t *msg )
|
|||||||
value = MSG_ReadUBitLong( msg, 32 );
|
value = MSG_ReadUBitLong( msg, 32 );
|
||||||
|
|
||||||
// will be compare only first 4 bytes
|
// will be compare only first 4 bytes
|
||||||
if( value != *(int *)r->rgucMD5_hash )
|
if( memcmp( &value , r->rgucMD5_hash, 4 ))
|
||||||
badresindex = idx + 1;
|
badresindex = idx + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user