Re: [3/4] msvcirt: Implement filebuf::setmode
On 08/05/15 20:32, Iván Matellanes wrote:
diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c index bf89650..0f82f30 100644 --- a/dlls/msvcirt/msvcirt.c +++ b/dlls/msvcirt/msvcirt.c @@ -1009,8 +1009,16 @@ streambuf* __thiscall filebuf_setbuf(filebuf *this, char *buffer, int length) DEFINE_THISCALL_WRAPPER(filebuf_setmode, 8) int __thiscall filebuf_setmode(filebuf *this, int mode) { - FIXME("(%p %d) stub\n", this, mode); - return 0; + int previous; + + TRACE("(%p %d)\n", this, mode); + if (mode != filebuf_text && mode != filebuf_binary) + return -1; + + streambuf_lock(&this->base); + previous = _setmode(this->fd, mode); + streambuf_unlock(&this->base); + return previous; } The function should empty the buffers before it changes the mode. Also it will be cleaner if filebuf_text and filebuf_binary definition is changed so _O_TEXT and _O_BINARY is used instead of its value.
Thanks, Piotr
participants (1)
-
Piotr Caban