shithub: qk1

Download patch

ref: 273a315a5d0fb3e2884805a827e1584223aa35c7
parent: d308fcf8a67f13bf34be3ed9862d3386de49c21d
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Dec 29 14:54:31 EST 2023

less type mess

--- a/common.c
+++ b/common.c
@@ -243,7 +243,7 @@
 		return -1;
 	}
 
-	c = (unsigned char)net_message.data[msg_readcount];
+	c = (byte)net_message.data[msg_readcount];
 	msg_readcount++;
 
 	return c;
@@ -417,7 +417,7 @@
 	if(buf->data[buf->cursize-1])
 		memcpy(SZ_GetSpace(buf, len), data, len);	// no trailing 0
 	else
-		memcpy((uchar *)SZ_GetSpace(buf, len-1)-1, data, len);	// write over trailing 0
+		memcpy((byte *)SZ_GetSpace(buf, len-1)-1, data, len);	// write over trailing 0
 }
 
 /*
--- a/fns.h
+++ b/fns.h
@@ -1,4 +1,4 @@
-void	setpal(uchar*);
+void	setpal(byte *);
 void	stopfb(void);
 void	flipfb(void);
 void	initfb(void);
@@ -67,7 +67,7 @@
 
 long sndqueued(void);
 void sndstop(void);
-void sndwrite(uchar *buf, long sz);
+void sndwrite(byte *buf, long sz);
 void sndclose(void);
 int sndopen(void);
 
--- a/fs.c
+++ b/fs.c
@@ -99,7 +99,7 @@
 
 static int notid1;
 static int loadsize;
-static uchar *loadbuf;
+static byte *loadbuf;
 static mem_user_t *loadcache;
 static FILE *demobf;
 static vlong demoofs;
@@ -248,7 +248,7 @@
 static void
 put32(FILE *bf, u32int v)
 {
-	uchar u[4];
+	byte u[4];
 
 	PBIT32(u, v);
 	ewrite(bf, u, 4);
@@ -383,12 +383,12 @@
 	return nil;
 }
 
-static uchar *
+static byte *
 loadlmp(char *f, int mth, int *n)
 {
 	int m;
 	char r[32];
-	uchar *buf;
+	byte *buf;
 	FILE *bf;
 
 	bf = openlmp(f, &m);
@@ -551,7 +551,7 @@
 {
 	int *vp, *ve;
 	char *s;
-	uchar *ev;
+	byte *ev;
 	ddef_t *d, *de;
 	eval_t *v;
 
@@ -558,7 +558,7 @@
 	fprintf(bf, "{\n");
 	if(ed->free)
 		goto end;
-	ev = (uchar *)&ed->v;
+	ev = (byte *)&ed->v;
 	de = pr->fielddefs + pr->numfielddefs;
 	for(d=pr->fielddefs+1; d<de; d++){
 		s = PR_Str(pr, d->s_name);
@@ -829,7 +829,7 @@
 pak(char *f)
 {
 	int n, ofs, len, nlmp;
-	uchar u[8];
+	byte u[8];
 	FILE *bf;
 	Lump *l;
 	Pak *p;
--- a/host.c
+++ b/host.c
@@ -357,7 +357,7 @@
 	while (count);
 
 	// make sure all the clients know we're disconnecting
-	buf.data = (uchar *)message;
+	buf.data = (byte *)message;
 	buf.maxsize = 4;
 	buf.cursize = 0;
 	MSG_WriteByte(&buf, svc_disconnect);
--- a/model_alias.c
+++ b/model_alias.c
@@ -105,12 +105,12 @@
 static void *
 Mod_LoadAliasSkin(void * pin, int *pskinindex, int skinsize, aliashdr_t *pheader)
 {
-	uchar *pinskin;
+	byte *pinskin;
 	pixel_t *pskin;
 
 	*pskinindex = Hunk_From(pheader);
 	pskin = Hunk_Alloc(skinsize*4);
-	pinskin = (uchar *)pin;
+	pinskin = (byte *)pin;
 	torgbx(pinskin, pskin, skinsize);
 	pinskin += skinsize;
 	return (void *)pinskin;
--- a/net.h
+++ b/net.h
@@ -95,8 +95,8 @@
 	int	(*Init)(void);
 	void	(*Shutdown)(void);
 	int	(*Connect)(Addr *);
-	int	(*Read)(uchar *, int, Addr *);
-	int	(*Write)(uchar *, int, Addr *);
+	int	(*Read)(byte *, int, Addr *);
+	int	(*Write)(byte *, int, Addr *);
 	char*	(*AddrToString)(Addr *);
 	int	(*getip)(char *, Addr *);
 	int	(*AddrCompare)(Addr *, Addr *);
@@ -212,8 +212,8 @@
 void	UDP_Shutdown(void);
 void	UDP_Listen(bool);
 int	UDP_Connect(Addr *);
-int	udpread(uchar *, int, Addr *);
-int	udpwrite(uchar *, int, Addr *);
+int	udpread(byte *, int, Addr *);
+int	udpwrite(byte *, int, Addr *);
 void	udpinfo(Addr*);
 int	getnewcon(Addr*);
 char*	UDP_AddrToString(Addr *);
--- a/net_dgrm_plan9.c
+++ b/net_dgrm_plan9.c
@@ -19,7 +19,7 @@
 
 static int myDriverLevel;
 
-static uchar netbuf[4+4+NET_MAXMESSAGE];
+static byte netbuf[4+4+NET_MAXMESSAGE];
 
 extern int m_return_state;
 extern int m_state;
@@ -27,7 +27,7 @@
 extern char m_return_reason[32];
 
 static int
-netpack(Addr *a, int f, uint seq, uchar *buf, int n)
+netpack(Addr *a, int f, uint seq, byte *buf, int n)
 {
 	hnputl(netbuf, NET_HEADERSIZE + n | f);
 	hnputl(netbuf+4, seq);
--- a/net_udp_plan9.c
+++ b/net_udp_plan9.c
@@ -11,7 +11,7 @@
 UDP_Init(void)
 {
 	char *s;
-	uchar ip[IPaddrlen];
+	byte ip[IPaddrlen];
 
 	fmtinstall('I', eipfmt);
 	if(strcmp(hostname.string, "UNNAMED") == 0)
@@ -126,7 +126,7 @@
 }
 
 int
-udpwrite(uchar *buf, int len, Addr *a)
+udpwrite(byte *buf, int len, Addr *a)
 {
 	if(write(a->fd, buf, len) != len){
 		Con_DPrintf("udpwrite: %r\n");
@@ -148,7 +148,7 @@
 }
 
 int
-UDP_Broadcast(uchar *buf, int len)
+UDP_Broadcast(byte *buf, int len)
 {
 	int fd;
 	char ip[46];
@@ -214,17 +214,14 @@
 	return 0;
 }
 
-ushort
+u16int
 UDP_GetSocketPort(Addr *a)
 {
-	ushort p;
-
-	p = atoi(a->srv);
-	return p;
+	return atoi(a->srv);
 }
 
 void
-UDP_SetSocketPort(Addr *a, ushort port)
+UDP_SetSocketPort(Addr *a, u16int port)
 {
 	snprint(a->srv, sizeof a->srv, "%hud", port);	/* was htons'ed */
 }
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -33,7 +33,7 @@
 static Chan *chans, *che;
 
 static int ainit, mixbufi;
-static uchar mixbufs[2][Ssamp*Sblk], *mixbuf;
+static byte mixbufs[2][Ssamp*Sblk], *mixbuf;
 static vlong sndt, sampt;
 static int nsamp;
 static int sampbuf[Ssamp*2];
@@ -93,8 +93,7 @@
 	{
 // fast special case
 		for (i=0 ; i<outcount ; i++)
-			((signed char *)sc->data)[i]
-			= (int)( (unsigned char)(data[i]) - 128);
+			((s8int*)sc->data)[i] = (int)((u8int)(data[i]) - 128);
 	}
 	else
 	{
@@ -106,13 +105,13 @@
 			srcsample = samplefrac >> 8;
 			samplefrac += fracstep;
 			if (inwidth == 2)
-				sample = LittleShort ( ((short *)data)[srcsample] );
+				sample = LittleShort ( ((short*)data)[srcsample] );
 			else
-				sample = (int)( (unsigned char)(data[srcsample]) - 128) << 8;
+				sample = (int)( (u8int)(data[srcsample]) - 128) << 8;
 			if (sc->width == 2)
-				((short *)sc->data)[i] = sample;
+				((short*)sc->data)[i] = sample;
 			else
-				((signed char *)sc->data)[i] = sample >> 8;
+				((s8int*)sc->data)[i] = sample >> 8;
 		}
 	}
 }
@@ -124,7 +123,7 @@
 	int len;
 	float stepscale;
 	sfxcache_t *sc;
-	uchar *u, buf[1024];	/* avoid dirtying the cache heap */
+	byte *u, buf[1024];	/* avoid dirtying the cache heap */
 
 	if(sc = Cache_Check(&sfx->cu), sc != nil)
 		return sc;
@@ -157,7 +156,7 @@
 sndout(void)
 {
 	int v, *pb, *pe;
-	uchar *p;
+	byte *p;
 	double vol;
 
 	vol = volume.value;
@@ -180,7 +179,7 @@
 sample8(Chan *c, void *d, int n)
 {
 	int v, *pb, *pe, *ls, *rs;
-	uchar *p;
+	byte *p;
 
 	if(c->lvol > 255)
 		c->lvol = 255;
@@ -188,7 +187,7 @@
 		c->rvol = 255;
 	ls = scalt[c->lvol >> 3];
 	rs = scalt[c->rvol >> 3];
-	p = (uchar *)d + c->p;
+	p = (byte *)d + c->p;
 	pb = sampbuf;
 	pe = sampbuf + n * 2;
 	while(pb < pe){
@@ -280,7 +279,7 @@
 static void
 ambs(void)
 {
-	uchar *av;
+	byte *av;
 	float vol;
 	Chan *c, *e;
 	mleaf_t *l;
--- a/snd_openal.c
+++ b/snd_openal.c
@@ -290,7 +290,7 @@
 	float vol, *av;
 	ALint state;
 	alchan_t *ch;
-	uchar *asl;
+	byte *asl;
 	mleaf_t *l;
 	albuf_t *b;
 	Sfx *sfx;
--- a/snd_plan9.c
+++ b/snd_plan9.c
@@ -3,7 +3,7 @@
 
 static int afd;
 static QLock alock;
-static uchar *mixbuf;
+static byte *mixbuf;
 static Channel *ach;
 
 long
@@ -42,7 +42,7 @@
 }
 
 void
-sndwrite(uchar *buf, long sz)
+sndwrite(byte *buf, long sz)
 {
 	if(ach == nil)
 		return;
--- a/sv_main.c
+++ b/sv_main.c
@@ -1105,7 +1105,7 @@
 */
 void SV_SendReconnect (void)
 {
-	uchar	data[128];
+	byte data[128];
 	sizebuf_t	msg;
 
 	msg.data = data;
--- a/vid_plan9.c
+++ b/vid_plan9.c
@@ -128,10 +128,10 @@
 }
 
 void
-setpal(uchar *p0)
+setpal(byte *p0)
 {
 	int x;
-	uchar *p;
+	byte *p;
 
 	for(p = p0, x = 0; x < 256; x++, p += 3)
 		q1pal[x] = (x < 256-32 ? 0xff : 0)<<24 | p[0]<<16 | p[1]<<8 | p[2];
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -94,10 +94,10 @@
 }
 
 void
-setpal(uchar *p0)
+setpal(byte *p0)
 {
 	int x;
-	uchar *p;
+	byte *p;
 
 	for(p = p0, x = 0; x < 256; x++, p += 3)
 		q1pal[x] = (x < 256-32 ? 0xff : 0)<<24 | p[0]<<16 | p[1]<<8 | p[2];