fix paranoia, chartorune never returns <=0
This commit is contained in:
parent
c7c882b4ae
commit
bb45ddca85
3 changed files with 2 additions and 21 deletions
|
@ -154,11 +154,6 @@ cgascreenputs(char* s, int n)
|
||||||
|
|
||||||
while(n > 0){
|
while(n > 0){
|
||||||
i = chartorune(&r, s);
|
i = chartorune(&r, s);
|
||||||
if(i <= 0){
|
|
||||||
s++;
|
|
||||||
--n;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
cgascreenputc(r);
|
cgascreenputc(r);
|
||||||
s += i;
|
s += i;
|
||||||
n -= i;
|
n -= i;
|
||||||
|
|
|
@ -148,11 +148,6 @@ vgascreenputs(char* s, int n)
|
||||||
|
|
||||||
while(n > 0){
|
while(n > 0){
|
||||||
i = chartorune(&r, s);
|
i = chartorune(&r, s);
|
||||||
if(i <= 0){
|
|
||||||
s++;
|
|
||||||
--n;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
memmove(buf, s, i);
|
memmove(buf, s, i);
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
n -= i;
|
n -= i;
|
||||||
|
|
|
@ -401,7 +401,7 @@ void
|
||||||
consproc(void *)
|
consproc(void *)
|
||||||
{
|
{
|
||||||
char *p, *e, *x, buf[64];
|
char *p, *e, *x, buf[64];
|
||||||
int n, i;
|
int n;
|
||||||
Rune r;
|
Rune r;
|
||||||
|
|
||||||
threadsetname("consproc");
|
threadsetname("consproc");
|
||||||
|
@ -411,12 +411,7 @@ consproc(void *)
|
||||||
while((n = read(consfd, p, e - p)) > 0){
|
while((n = read(consfd, p, e - p)) > 0){
|
||||||
x = buf + n;
|
x = buf + n;
|
||||||
while(p < x && fullrune(p, x - p)){
|
while(p < x && fullrune(p, x - p)){
|
||||||
i = chartorune(&r, p);
|
p += chartorune(&r, p);
|
||||||
if(i <= 0){
|
|
||||||
p++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
p += i;
|
|
||||||
if(r)
|
if(r)
|
||||||
send(rawchan, &r);
|
send(rawchan, &r);
|
||||||
}
|
}
|
||||||
|
@ -462,10 +457,6 @@ lineproc(void *aux)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = chartorune(&x, s);
|
i = chartorune(&x, s);
|
||||||
if(i <= 0){
|
|
||||||
s++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
s += i;
|
s += i;
|
||||||
if(r == '\b'){
|
if(r == '\b'){
|
||||||
if(s >= p){
|
if(s >= p){
|
||||||
|
|
Loading…
Reference in a new issue