reel: correct wchar_t check for error on 32-bit

This commit is contained in:
nick black 2020-05-14 01:01:17 -04:00
parent 7d87f8aa20
commit 2588baa7db
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -245,7 +245,7 @@ handle_input(struct notcurses* nc, struct ncreel* pr, int efd,
uint64_t eventcount; uint64_t eventcount;
if(read(fds[0].fd, &eventcount, sizeof(eventcount)) > 0){ if(read(fds[0].fd, &eventcount, sizeof(eventcount)) > 0){
key = demo_getc_nblock(nc, NULL); key = demo_getc_nblock(nc, NULL);
if(key < 0){ if(key == (wchar_t)-1){
return -1; return -1;
} }
} }
@ -254,13 +254,13 @@ handle_input(struct notcurses* nc, struct ncreel* pr, int efd,
uint64_t val; uint64_t val;
if(read(efd, &val, sizeof(val)) != sizeof(val)){ if(read(efd, &val, sizeof(val)) != sizeof(val)){
fprintf(stderr, "Error reading from eventfd %d (%s)\n", efd, strerror(errno)); fprintf(stderr, "Error reading from eventfd %d (%s)\n", efd, strerror(errno));
}else if(key < 0){ }else if(key == (wchar_t)-1){
ncreel_redraw(pr); ncreel_redraw(pr);
DEMO_RENDER(nc); DEMO_RENDER(nc);
} }
} }
} }
}while(key < 0); }while(key == (wchar_t)-1);
return key; return key;
} }
@ -344,7 +344,7 @@ ncreel_demo_core(struct notcurses* nc, int efdr, int efdw){
// FIXME wclrtoeol(w); // FIXME wclrtoeol(w);
ncplane_set_fg_rgb(w, 0, 55, 218); ncplane_set_fg_rgb(w, 0, 55, 218);
wchar_t rw; wchar_t rw;
if((rw = handle_input(nc, pr, efdr, &deadline)) < 0){ if((rw = handle_input(nc, pr, efdr, &deadline)) == (wchar_t)-1){
break; break;
} }
// FIXME clrtoeol(); // FIXME clrtoeol();