msvcirt: Add a more accurate implementation of streambuf::pbackfail

Piotr Caban piotr.caban at gmail.com
Fri Aug 21 03:39:18 CDT 2015


On 08/19/15 19:04, Iván Matellanes wrote:
> +/* ?pbackfail at streambuf@@UAEHH at Z */
> +/* ?pbackfail at streambuf@@UEAAHH at Z */
> +DEFINE_THISCALL_WRAPPER(streambuf_pbackfail, 8)
> +#define call_streambuf_pbackfail(this, c) CALL_VTBL_FUNC(this, 36, int, (streambuf*, int), (this, c))
> +int __thiscall streambuf_pbackfail(streambuf *this, int c)
> +{
> +    TRACE("(%p %d)\n", this, c);
> +    if (this->gptr > this->eback)
> +        return *--this->gptr = c;
> +    if (call_streambuf_seekoff(this, -1, SEEKDIR_cur, OPENMODE_in) == EOF)
> +        return EOF;
> +    return c;
> +}
If seekoff is used the buffers needs to be updated. Otherwise next read 
will return incorrect data. You will need to make space for put back 
character and place it in the buffer.

Thanks,
Piotr



More information about the wine-devel mailing list