shithub: riscv

Download patch

ref: bb45ddca85109a945c8293c180febd534d35b0fb
parent: c7c882b4aea6c240ef8253efe1302ebf32258279
author: cinap_lenrek <cinap_lenrek@localhost>
date: Thu May 12 22:49:40 EDT 2011

fix paranoia, chartorune never returns <=0

--- a/sys/src/9/pc/cga.c
+++ b/sys/src/9/pc/cga.c
@@ -154,11 +154,6 @@
 
 	while(n > 0){
 		i = chartorune(&r, s);
-		if(i <= 0){
-			s++;
-			--n;
-			continue;
-		}
 		cgascreenputc(r);
 		s += i;
 		n -= i;
--- a/sys/src/9/pc/vga.c
+++ b/sys/src/9/pc/vga.c
@@ -148,11 +148,6 @@
 
 	while(n > 0){
 		i = chartorune(&r, s);
-		if(i <= 0){
-			s++;
-			--n;
-			continue;
-		}
 		memmove(buf, s, i);
 		buf[i] = 0;
 		n -= i;
--- a/sys/src/cmd/aux/kbdfs.c
+++ b/sys/src/cmd/aux/kbdfs.c
@@ -401,7 +401,7 @@
 consproc(void *)
 {
 	char *p, *e, *x, buf[64];
-	int n, i;
+	int n;
 	Rune r;
 
 	threadsetname("consproc");
@@ -411,12 +411,7 @@
 	while((n = read(consfd, p, e - p)) > 0){
 		x = buf + n;
 		while(p < x && fullrune(p, x - p)){
-			i = chartorune(&r, p);
-			if(i <= 0){
-				p++;
-				continue;
-			}
-			p += i;
+			p += chartorune(&r, p);
 			if(r)
 				send(rawchan, &r);
 		}
@@ -462,10 +457,6 @@
 					int i;
 
 					i = chartorune(&x, s);
-					if(i <= 0){
-						s++;
-						continue;
-					}
 					s += i;
 					if(r == '\b'){
 						if(s >= p){