On Tue, Jun 3, 2014 at 11:56 AM, Piotr Caban piotr.caban@gmail.com wrote:
On 06/03/14 01:16, Grazvydas Ignotas wrote:
I guess defaulting to 4K buffer and flushing it if it's full on fwrite() exit would be closer to how msvcrt operates, even though not entirely correct. Do you prefer this solution, or perhaps something entirely different?
I would like to have it implemented as similar as possible to native dll. So taking in account that two 2k block writes doesn't flush output I don't want to do it in wine.
I've added following call to your test (just after the file is opened): setvbuf(file, NULL, _IOFBF, 512);
It causes following test failures on windows 7: file.c:2250: Test failed: unexpected flush by 512 byte write file.c:2250: Test failed: unexpected flush by 1024 byte write file.c:2250: Test failed: unexpected flush by 1536 byte write ... This shows that your code should depend on buffer size instead of MSVCRT_WRITE_BLOCK_SIZE.
Ok then, I'll be sending next revision with the same approach but make it depend on buffer size.
Note: keep in mind that wine's implementation of setvbuf is quite broken, it's not allocating new buffer if second argument is NULL.
Sounds like i can take a stab at that too while at it.