shithub: qk1

Download patch

ref: 05c4f601bbbbe2f1943b25dab7ad7b6eca5e7182
parent: 49eaf765f30cabeea15ce054636349f6db14b2ae
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Dec 28 23:43:48 EST 2023

get rid of ushort/ulong

--- a/cl_parse.c
+++ b/cl_parse.c
@@ -676,7 +676,7 @@
 			break;
 
 		case svc_clientdata:
-			CL_ParseClientdata((ushort)MSG_ReadShort());
+			CL_ParseClientdata((u16int)MSG_ReadShort());
 			break;
 
 		case svc_version:
--- a/fns.h
+++ b/fns.h
@@ -55,7 +55,7 @@
 void	initfs(char **paths);
 #pragma varargck	argpos	fatal	1
 _Noreturn void	fatal(char*, ...);
-void*	emalloc(ulong);
+void*	emalloc(long);
 vlong	flen(int);
 double	dtime(void);
 void	game_shutdown(void);
--- a/fs.c
+++ b/fs.c
@@ -583,7 +583,7 @@
 static void
 dumpdefs(FILE *bf, pr_t *pr)
 {
-	ushort t;
+	int t;
 	ddef_t *d, *de;
 
 	fprintf(bf, "{\n");
--- a/net.h
+++ b/net.h
@@ -100,8 +100,8 @@
 	char*	(*AddrToString)(Addr *);
 	int	(*getip)(char *, Addr *);
 	int	(*AddrCompare)(Addr *, Addr *);
-	ushort	(*GetSocketPort)(Addr *);
-	void	(*SetSocketPort)(Addr *, ushort);
+	u16int	(*GetSocketPort)(Addr *);
+	void	(*SetSocketPort)(Addr *, u16int);
 };
 extern int net_numlandrivers;
 extern Landrv landrv[MAX_NET_DRIVERS];
@@ -219,5 +219,5 @@
 char*	UDP_AddrToString(Addr *);
 int	getip(char *, Addr *);
 int	UDP_AddrCompare(Addr *, Addr *);
-ushort	UDP_GetSocketPort(Addr *);
-void	UDP_SetSocketPort(Addr *, ushort);
+u16int	UDP_GetSocketPort(Addr *);
+void	UDP_SetSocketPort(Addr *, u16int);
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -461,8 +461,8 @@
 	static long xand;
 
 	if(xand == 0){
-		if((RAND_MAX & ((ulong)RAND_MAX+1)) == 0){
-			xmax = (ulong)RAND_MAX+1;
+		if((RAND_MAX & ((unsigned)RAND_MAX+1)) == 0){
+			xmax = (unsigned)RAND_MAX+1;
 			xand = RAND_MAX;
 		}else{
 			xmax = 0x8000;
--- a/qk1.c
+++ b/qk1.c
@@ -60,7 +60,7 @@
 }
 
 void *
-emalloc(ulong n)
+emalloc(long n)
 {
 	void *p;
 
--- a/unix/net_udp.c
+++ b/unix/net_udp.c
@@ -348,12 +348,12 @@
 
 //=============================================================================
 
-ushort UDP_GetSocketPort (Addr *addr)
+u16int UDP_GetSocketPort (Addr *addr)
 {
 	return ntohs(((struct sockaddr_in *)addr)->sin_port);
 }
 
-void UDP_SetSocketPort (Addr *addr, ushort port)
+void UDP_SetSocketPort (Addr *addr, u16int port)
 {
 	((struct sockaddr_in *)addr)->sin_port = htons(port);
 }
--- a/unix/qk1.c
+++ b/unix/qk1.c
@@ -60,7 +60,7 @@
 }
 
 void *
-emalloc(ulong n)
+emalloc(long n)
 {
 	void *p;