=?UTF-8?Q?Iv=C3=A1n=20Matellanes=20?=: msvcirt: Allocate a buffer if necessary when a file is opened.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Aug 17 09:01:12 CDT 2015
Module: wine
Branch: master
Commit: cac27a40d8197a514b59a8f850ce62340cec87a2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cac27a40d8197a514b59a8f850ce62340cec87a2
Author: Iván Matellanes <matellanesivan at gmail.com>
Date: Mon Aug 10 20:08:54 2015 +0200
msvcirt: Allocate a buffer if necessary when a file is opened.
---
dlls/msvcirt/msvcirt.c | 1 +
dlls/msvcirt/tests/msvcirt.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c
index bf89650..7caa05b 100644
--- a/dlls/msvcirt/msvcirt.c
+++ b/dlls/msvcirt/msvcirt.c
@@ -973,6 +973,7 @@ filebuf* __thiscall filebuf_open(filebuf *this, const char *name, ios_open_mode
_close(fd);
} else
this->fd = fd;
+ streambuf_allocate(&this->base);
streambuf_unlock(&this->base);
return (this->fd == -1) ? NULL : this;
}
diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c
index e0bda56..0977173 100644
--- a/dlls/msvcirt/tests/msvcirt.c
+++ b/dlls/msvcirt/tests/msvcirt.c
@@ -1016,9 +1016,11 @@ static void test_filebuf(void)
pret = (filebuf*) call_func4(p_filebuf_open, &fb1, filename1,
OPENMODE_ate|OPENMODE_nocreate|OPENMODE_noreplace|OPENMODE_binary, filebuf_openprot);
ok(pret == NULL, "wrong return, expected %p got %p\n", NULL, pret);
+ ok(fb1.base.allocated == 0, "wrong allocate value, expected 0 got %d\n", fb1.base.allocated);
fb1.base.do_lock = 0;
pret = (filebuf*) call_func4(p_filebuf_open, &fb1, filename1, OPENMODE_out, filebuf_openprot);
ok(pret == &fb1, "wrong return, expected %p got %p\n", &fb1, pret);
+ ok(fb1.base.allocated == 1, "wrong allocate value, expected 1 got %d\n", fb1.base.allocated);
ok(_write(fb1.fd, "testing", 7) == 7, "_write failed\n");
pret = (filebuf*) call_func1(p_filebuf_close, &fb1);
ok(pret == &fb1, "wrong return, expected %p got %p\n", &fb1, pret);
More information about the wine-cvs
mailing list