Akihiro Sagawa : msvcrt: Add support for fflush to clear an input buffer.
Alexandre Julliard
julliard at winehq.org
Wed Mar 14 13:56:11 CDT 2012
Module: wine
Branch: master
Commit: 1a01893c746beff8b41b7ad9c78df47ced89a012
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1a01893c746beff8b41b7ad9c78df47ced89a012
Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date: Mon Mar 12 21:14:04 2012 +0900
msvcrt: Add support for fflush to clear an input buffer.
---
dlls/msvcrt/file.c | 7 +++++++
dlls/msvcrt/tests/file.c | 2 +-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index c15e33f..7fbe07e 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -792,6 +792,13 @@ int CDECL MSVCRT_fflush(MSVCRT_FILE* file)
MSVCRT__unlock_file(file);
return res;
+ } else if(file->_flag & MSVCRT__IOREAD) {
+ MSVCRT__lock_file(file);
+ file->_cnt = 0;
+ file->_ptr = file->_base;
+ MSVCRT__unlock_file(file);
+
+ return 0;
}
return 0;
}
diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c
index 9e93234..6d745d9 100644
--- a/dlls/msvcrt/tests/file.c
+++ b/dlls/msvcrt/tests/file.c
@@ -619,7 +619,7 @@ static void test_fflush( void )
ok(ret == 0, "expected 0, got %d\n", ret);
memset(buf2, '?', sizeof(buf2));
fread(buf2, 1, sizeof(buf2), tempfh);
- todo_wine ok(memcmp(buf1, buf2, sizeof(buf1)) == 0, "Got unexpected data (%c)\n", buf2[0]);
+ ok(memcmp(buf1, buf2, sizeof(buf1)) == 0, "Got unexpected data (%c)\n", buf2[0]);
/* fflush(NULL) doesn't clear input buffer. */
_lseek(_fileno(tempfh), 0, SEEK_SET);
More information about the wine-cvs
mailing list