[1/7] msvcirt: Allocate a buffer if necessary when a file is opened
Iván Matellanes
matellanesivan at gmail.com
Mon Aug 10 13:08:54 CDT 2015
This patch series supersedes 113364, 113435 and 113437.
---
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);
--
2.1.4
More information about the wine-patches
mailing list