Skip to content

Commit

Permalink
Merge pull request #86 from trofi/clang-build-fix
Browse files Browse the repository at this point in the history
src/ui_io.cpp: fix build against clang-19
  • Loading branch information
mrcook authored Nov 19, 2024
2 parents 1197070 + 3360661 commit 68e56ac
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ui_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,15 @@ bool checkForNonBlockingKeyPress(int microseconds) {
#else
struct timeval tbuf {};
int ch;
int smask;
fd_set smask;

// Return true if a read on descriptor 1 will not block.
tbuf.tv_sec = 0;
tbuf.tv_usec = microseconds;

smask = 1; // i.e. (1 << 0)
if (select(1, (fd_set *) &smask, (fd_set *) nullptr, (fd_set *) nullptr, &tbuf) == 1) {
FD_ZERO(&smask);
FD_SET(STDIN_FILENO, &smask);
if (select(1, &smask, (fd_set *) nullptr, (fd_set *) nullptr, &tbuf) == 1) {
ch = getch();
// check for EOF errors here, select sometimes works even when EOF
if (ch == -1) {
Expand Down

0 comments on commit 68e56ac

Please sign in to comment.