msvcrt: Clear _cnt on buffer flush.
This commit is contained in:
parent
61d49a8a97
commit
c6a160691a
|
@ -595,7 +595,7 @@ static int msvcrt_flush_buffer(MSVCRT_FILE* file)
|
|||
return MSVCRT_EOF;
|
||||
}
|
||||
file->_ptr=file->_base;
|
||||
file->_cnt=file->_bufsiz;
|
||||
file->_cnt=0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -3659,14 +3659,15 @@ int CDECL MSVCRT__flsbuf(int c, MSVCRT_FILE* file)
|
|||
if(file->_bufsiz) {
|
||||
int res = 0;
|
||||
|
||||
if(file->_cnt <= 0)
|
||||
if(file->_cnt <= 0) {
|
||||
res = msvcrt_flush_buffer(file);
|
||||
if(!res) {
|
||||
if(res)
|
||||
return res;
|
||||
file->_cnt=file->_bufsiz;
|
||||
}
|
||||
*file->_ptr++ = c;
|
||||
file->_cnt--;
|
||||
}
|
||||
|
||||
return res ? res : c&0xff;
|
||||
return c&0xff;
|
||||
} else {
|
||||
unsigned char cc=c;
|
||||
int len;
|
||||
|
|
|
@ -2239,7 +2239,7 @@ static void test_write_flush_size(FILE *file, int bufsize)
|
|||
*/
|
||||
lseek(fd, 1, SEEK_SET);
|
||||
fflush(file);
|
||||
todo_wine ok(file->_cnt == 0, "_cnt should be 0 after fflush, but is %d\n", file->_cnt);
|
||||
ok(file->_cnt == 0, "_cnt should be 0 after fflush, but is %d\n", file->_cnt);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
ok(fread(inbuffer, 1, bufsize, file) == bufsize, "read failed\n");
|
||||
if (size == bufsize)
|
||||
|
|
Loading…
Reference in New Issue