From 8d942bcc86b3de9cfc6b2d12b3e01ee0f13264f7 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 19 Apr 2020 12:56:16 +0300 Subject: [PATCH] xash3d_types: start refactoring engine to use stdint.h types --- common/xash3d_types.h | 10 ++-------- engine/common/identification.c | 4 ++-- engine/common/netchan.h | 16 ++++++++-------- mainui | 2 +- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/common/xash3d_types.h b/common/xash3d_types.h index f3de92e3..7f979601 100644 --- a/common/xash3d_types.h +++ b/common/xash3d_types.h @@ -7,6 +7,7 @@ #endif // _WIN32 #include // off_t +#include STDINT_H typedef unsigned char byte; typedef int sound_t; @@ -29,14 +30,7 @@ typedef enum { false, true } qboolean; typedef int qboolean; #endif -#if _MSC_VER == 1200 -typedef __int64 integer64; //msvc6 -#elif defined (XASH_SDL) && !defined(REF_DLL) -typedef Uint64 integer64; -#else -typedef unsigned long long integer64; -#endif -typedef integer64 longtime_t; +typedef uint64_t longtime_t; #define MAX_STRING 256 // generic string #define MAX_INFO_STRING 256 // infostrings are transmitted across network diff --git a/engine/common/identification.c b/engine/common/identification.c index 0ba61517..833d03bc 100644 --- a/engine/common/identification.c +++ b/engine/common/identification.c @@ -29,7 +29,7 @@ should be enough to determine if device exist in identifier ========================================================== */ -typedef integer64 bloomfilter_t; +typedef uint64_t bloomfilter_t; static bloomfilter_t id; @@ -48,7 +48,7 @@ bloomfilter_t BloomFilter_Process( const char *buffer, int size ) while( crc32 ) { - value |= ((integer64)1) << ( crc32 & bf64_mask ); + value |= ((uint64_t)1) << ( crc32 & bf64_mask ); crc32 = crc32 >> 6; } diff --git a/engine/common/netchan.h b/engine/common/netchan.h index 16bc6fa4..0ccb4236 100644 --- a/engine/common/netchan.h +++ b/engine/common/netchan.h @@ -113,9 +113,9 @@ GNU General Public License for more details. typedef struct netsplit_chain_packet_s { // bool vector - unsigned int recieved_v[8]; + uint32_t recieved_v[8]; // serial number - unsigned int id; + uint32_t id; byte data[NET_MAX_PAYLOAD]; byte received; byte count; @@ -124,10 +124,10 @@ typedef struct netsplit_chain_packet_s // raw packet format typedef struct netsplit_packet_s { - unsigned int signature; // 0xFFFFFFFE - unsigned int length; - unsigned int part; - unsigned int id; + uint32_t signature; // 0xFFFFFFFE + uint32_t length; + uint32_t part; + uint32_t id; // max 256 parts byte count; byte index; @@ -138,8 +138,8 @@ typedef struct netsplit_packet_s typedef struct netsplit_s { netsplit_chain_packet_t packets[NETSPLIT_BACKUP]; - integer64 total_received; - integer64 total_received_uncompressed; + uint64_t total_received; + uint64_t total_received_uncompressed; } netsplit_t; // packet splitting diff --git a/mainui b/mainui index 9ef06db9..f7bde407 160000 --- a/mainui +++ b/mainui @@ -1 +1 @@ -Subproject commit 9ef06db97fd612c820674c399db757d00176ada5 +Subproject commit f7bde4076321a5e9172a91e789d45dd643c6840e