From a7c76ac0bf4d9bac9c3dcd2115e7978968b1ccf6 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 6 Jun 2023 00:26:54 +0300 Subject: [PATCH] engine: common: net_buffer: use stdint.h types in sizebuf_t reading/writing funcs --- engine/common/net_buffer.c | 32 ++++++++++++++++---------------- engine/common/net_buffer.h | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engine/common/net_buffer.c b/engine/common/net_buffer.c index 1b4cc5f0..dc5ec5be 100644 --- a/engine/common/net_buffer.c +++ b/engine/common/net_buffer.c @@ -383,37 +383,37 @@ void MSG_WriteCmdExt( sizebuf_t *sb, int cmd, netsrc_t type, const char *name ) } } #endif - MSG_WriteUBitLong( sb, cmd, sizeof( byte ) << 3 ); + MSG_WriteUBitLong( sb, cmd, sizeof( uint8_t ) << 3 ); } void MSG_WriteChar( sizebuf_t *sb, int val ) { - MSG_WriteSBitLong( sb, val, sizeof( char ) << 3 ); + MSG_WriteSBitLong( sb, val, sizeof( int8_t ) << 3 ); } void MSG_WriteByte( sizebuf_t *sb, int val ) { - MSG_WriteUBitLong( sb, val, sizeof( byte ) << 3 ); + MSG_WriteUBitLong( sb, val, sizeof( uint8_t ) << 3 ); } void MSG_WriteShort( sizebuf_t *sb, int val ) { - MSG_WriteSBitLong( sb, val, sizeof(short ) << 3 ); + MSG_WriteSBitLong( sb, val, sizeof( int16_t ) << 3 ); } void MSG_WriteWord( sizebuf_t *sb, int val ) { - MSG_WriteUBitLong( sb, val, sizeof( word ) << 3 ); + MSG_WriteUBitLong( sb, val, sizeof( uint16_t ) << 3 ); } void MSG_WriteLong( sizebuf_t *sb, int val ) { - MSG_WriteSBitLong( sb, val, sizeof( int ) << 3 ); + MSG_WriteSBitLong( sb, val, sizeof( int32_t ) << 3 ); } -void MSG_WriteDword( sizebuf_t *sb, dword val ) +void MSG_WriteDword( sizebuf_t *sb, uint val ) { - MSG_WriteUBitLong( sb, val, sizeof( dword ) << 3 ); + MSG_WriteUBitLong( sb, val, sizeof( uint32_t ) << 3 ); } void MSG_WriteFloat( sizebuf_t *sb, float val ) @@ -591,7 +591,7 @@ uint MSG_ReadBitLong( sizebuf_t *sb, int numbits, qboolean bSigned ) int MSG_ReadCmd( sizebuf_t *sb, netsrc_t type ) { - int cmd = MSG_ReadUBitLong( sb, sizeof( byte ) << 3 ); + int cmd = MSG_ReadUBitLong( sb, sizeof( uint8_t ) << 3 ); #ifdef DEBUG_NET_MESSAGES_READ if( type == NS_SERVER ) @@ -608,22 +608,22 @@ int MSG_ReadCmd( sizebuf_t *sb, netsrc_t type ) int MSG_ReadChar( sizebuf_t *sb ) { - return MSG_ReadSBitLong( sb, sizeof( char ) << 3 ); + return MSG_ReadSBitLong( sb, sizeof( int8_t ) << 3 ); } int MSG_ReadByte( sizebuf_t *sb ) { - return MSG_ReadUBitLong( sb, sizeof( byte ) << 3 ); + return MSG_ReadUBitLong( sb, sizeof( uint8_t ) << 3 ); } int MSG_ReadShort( sizebuf_t *sb ) { - return MSG_ReadSBitLong( sb, sizeof( short ) << 3 ); + return MSG_ReadSBitLong( sb, sizeof( int16_t ) << 3 ); } int MSG_ReadWord( sizebuf_t *sb ) { - return MSG_ReadUBitLong( sb, sizeof( word ) << 3 ); + return MSG_ReadUBitLong( sb, sizeof( uint16_t ) << 3 ); } float MSG_ReadCoord( sizebuf_t *sb ) @@ -650,12 +650,12 @@ void MSG_ReadVec3Angles( sizebuf_t *sb, vec3_t fa ) int MSG_ReadLong( sizebuf_t *sb ) { - return MSG_ReadSBitLong( sb, sizeof( int ) << 3 ); + return MSG_ReadSBitLong( sb, sizeof( int32_t ) << 3 ); } -dword MSG_ReadDword( sizebuf_t *sb ) +uint MSG_ReadDword( sizebuf_t *sb ) { - return MSG_ReadUBitLong( sb, sizeof( dword ) << 3 ); + return MSG_ReadUBitLong( sb, sizeof( uint32_t ) << 3 ); } float MSG_ReadFloat( sizebuf_t *sb ) diff --git a/engine/common/net_buffer.h b/engine/common/net_buffer.h index b532daed..f31b32c6 100644 --- a/engine/common/net_buffer.h +++ b/engine/common/net_buffer.h @@ -94,7 +94,7 @@ void MSG_WriteByte( sizebuf_t *sb, int val ); void MSG_WriteShort( sizebuf_t *sb, int val ); void MSG_WriteWord( sizebuf_t *sb, int val ); void MSG_WriteLong( sizebuf_t *sb, int val ); -void MSG_WriteDword( sizebuf_t *sb, dword val ); +void MSG_WriteDword( sizebuf_t *sb, uint val ); void MSG_WriteCoord( sizebuf_t *sb, float val ); void MSG_WriteFloat( sizebuf_t *sb, float val ); void MSG_WriteVec3Coord( sizebuf_t *sb, const float *fa ); @@ -131,7 +131,7 @@ int MSG_ReadByte( sizebuf_t *sb ); int MSG_ReadShort( sizebuf_t *sb ); int MSG_ReadWord( sizebuf_t *sb ); int MSG_ReadLong( sizebuf_t *sb ); -dword MSG_ReadDword( sizebuf_t *sb ); +uint MSG_ReadDword( sizebuf_t *sb ); float MSG_ReadCoord( sizebuf_t *sb ); float MSG_ReadFloat( sizebuf_t *sb ); void MSG_ReadVec3Coord( sizebuf_t *sb, vec3_t fa );