1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-02 12:20:57 +00:00

fix a memory corruption and make sure only getch2 handles stdin

in order to avoid delayed events caused by lost input
patch by Mikulas Patocka <mikulas at artax.karlin.mff.cuni.cz>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13346 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
faust3 2004-09-15 14:08:46 +00:00
parent 0e339fc397
commit 3616785033

View File

@ -661,7 +661,7 @@ mp_input_default_key_func(int fd) {
unsigned int l; unsigned int l;
l = 0; l = 0;
while(l < sizeof(int)) { while(l < sizeof(int)) {
r = read(fd,(&code)+l,sizeof(int)-l); r = read(fd,((char *)&code)+l,sizeof(int)-l);
if(r <= 0) if(r <= 0)
break; break;
l +=r; l +=r;
@ -907,7 +907,7 @@ if(n>0){
} }
#ifndef HAVE_NO_POSIX_SELECT #ifndef HAVE_NO_POSIX_SELECT
// No input from this fd // No input from this fd
if(! (key_fds[i].flags & MP_FD_NO_SELECT) && ! FD_ISSET(key_fds[i].fd,&fds)) if(! (key_fds[i].flags & MP_FD_NO_SELECT) && ! FD_ISSET(key_fds[i].fd,&fds) && key_fds[i].fd != 0)
continue; continue;
#endif #endif
if(key_fds[i].fd == 0) { // stdin is handled by getch2 if(key_fds[i].fd == 0) { // stdin is handled by getch2