Op di 1 sep. 2020 om 17:54 schreef Piotr Caban piotr@codeweavers.com:
+/* ??0ifstream@@QAE@HPADH@Z */ +/* ??0ifstream@@QEAA@HPEADH@Z */ +DEFINE_THISCALL_WRAPPER(ifstream_buffer_ctor, 20) +istream* __thiscall ifstream_buffer_ctor(istream *this, filedesc fd,
char *buffer, int length, BOOL virt_init)
+{
- ios *base;
- filebuf *fb = MSVCRT_operator_new(sizeof(filebuf));
- TRACE("(%p %d %p %d %d)\n", this, fd, buffer, length, virt_init);
- if (fb)
- {
filebuf_fd_reserve_ctor(fb, fd, buffer, length);
istream_sb_ctor(this, &fb->base, virt_init);
- }
- else
istream_ctor(this, virt_init);
The allocation failure handling looks quite strange. It's probably better to remove it so the application crashes instead of misbehaving.
It's been a while, but if I remember correctly, I did it this way because stdiostream and strstream and probably others do the same.