shithub: rd

Download patch

ref: ff67a7a3f5fea5fa0e3f28941122e4a666064339
parent: 9e4a5b55ba158232bf2781f5914260ff74da5dde
author: Yaroslav Kolomiiets <yarikos@gmail.com>
date: Fri Aug 5 12:16:43 EDT 2016

cosmetics

--- a/dat.h
+++ b/dat.h
@@ -226,8 +226,8 @@
 void	activating(Rdp*,Share*);
 void	deactivating(Rdp*,Share*);
 void	finalhandshake(Rdp*);
-void	scanimgupdate(Rdp*,Share*);
-void	scancmap(Rdp*,Share*);
+void	drawimgupdate(Rdp*,Share*);
+void	loadcmap(Rdp*,Share*);
 void	scanorders(Rdp*,Share*);
 
 struct Imgupd {
--- a/load.c
+++ b/load.c
@@ -68,3 +68,29 @@
 	free(buf);
 	return nb;
 }
+
+void
+loadcmap(Rdp* c, Share* as)
+{
+	int i, n;
+	uchar *p,  *ep, *cmap;
+
+	if(as->type != ShUcmap){
+		fprint(2, "loadcmap: bad share type");
+		return;
+	}
+	p = as->data;
+	ep = as->data + as->ndata;
+	cmap = c->cmap;
+
+	n = GSHORT(p+4);
+	p += 8;
+	if(n > sizeof(c->cmap)){
+		fprint(2, "loadcmap: data too big");
+		return;
+	}
+	if(p+3*n > ep)
+		sysfatal(Eshort);
+	for(i = 0; i<n; p+=3)
+		cmap[i++] = rgb2cmap(p[0], p[1], p[2]);
+}
--- a/rd-thread.c
+++ b/rd-thread.c
@@ -214,10 +214,10 @@
 			scanorders(c, &u);
 			break;
 		case ShUimg:
-			scanimgupdate(c, &u);
+			drawimgupdate(c, &u);
 			break;
 		case ShUcmap:
-			scancmap(c, &u);
+			loadcmap(c, &u);
 			break;
 		case ShUwarp:
 			warpmouse(u.x, u.y);
@@ -229,7 +229,7 @@
 }
 
 void
-scanimgupdate(Rdp *c, Share* as)
+drawimgupdate(Rdp *c, Share* as)
 {
 	uchar* p, *ep;
 	int n, err, nr;
@@ -252,7 +252,7 @@
 			freeimage(img);
 		img = allocimage(display, rs, c->chan, 0, DNofill);
 		if(img == nil)
-			sysfatal("scanimgupdate: %r");
+			sysfatal("drawimgupdate: %r");
 	}
 
 	while(p<ep && nr>0){
@@ -278,28 +278,6 @@
 	flushimage(display, 1);
 	if(display->locking)
 		unlockdisplay(display);
-}
-
-void
-scancmap(Rdp* c, Share* as)
-{
-	int i, n;
-	uchar *p,  *ep, *cmap;
-
-	p = as->data;
-	ep = as->data + as->ndata;
-	cmap = c->cmap;
-
-	n = GSHORT(p+4);
-	p += 8;
-	if(n > sizeof(c->cmap)){
-		fprint(2, "scancmap: data too big");
-		return;
-	}
-	if(p+3*n > ep)
-		sysfatal(Eshort);
-	for(i = 0; i<n; p+=3)
-		cmap[i++] = rgb2cmap(p[0], p[1], p[2]);
 }
 
 static void
--- a/rd.c
+++ b/rd.c
@@ -332,10 +332,10 @@
 			scanorders(c, &u);
 			break;
 		case ShUimg:
-			scanimgupdate(c, &u);
+			drawimgupdate(c, &u);
 			break;
 		case ShUcmap:
-			scancmap(c, &u);
+			loadcmap(c, &u);
 			break;
 		case ShUwarp:
 			warpmouse(u.x, u.y);
@@ -348,7 +348,7 @@
 
 /* 2.2.9.1.1.3.1.2.1 Bitmap Update Data (TS_UPDATE_BITMAP_DATA) */
 void
-scanimgupdate(Rdp *c, Share* as)
+drawimgupdate(Rdp *c, Share* as)
 {
 	uchar* p, *ep;
 	int n, err, nr;
@@ -371,7 +371,7 @@
 			freeimage(img);
 		img = allocimage(display, rs, c->chan, 0, DNofill);
 		if(img == nil)
-			sysfatal("scanimgupdate: %r");
+			sysfatal("drawimgupdate: %r");
 	}
 
 	while(p<ep && nr>0){
@@ -397,26 +397,4 @@
 	flushimage(display, 1);
 	if(display->locking)
 		unlockdisplay(display);
-}
-
-void
-scancmap(Rdp* c, Share* as)
-{
-	int i, n;
-	uchar *p,  *ep, *cmap;
-
-	p = as->data;
-	ep = as->data + as->ndata;
-	cmap = c->cmap;
-
-	n = GSHORT(p+4);
-	p += 8;
-	if(n > sizeof(c->cmap)){
-		fprint(2, "scancmap: data too big");
-		return;
-	}
-	if(p+3*n > ep)
-		sysfatal(Eshort);
-	for(i = 0; i<n; p+=3)
-		cmap[i++] = rgb2cmap(p[0], p[1], p[2]);
 }