[10/10] msvcirt: Implement strstreambuf::seekoff (resend)

Piotr Caban piotr.caban at gmail.com
Thu Sep 17 05:15:36 CDT 2015


Hi,

On 09/17/15 11:06, Iván Matellanes wrote:
>   DEFINE_THISCALL_WRAPPER(strstreambuf_seekoff, 16)
>   streampos __thiscall strstreambuf_seekoff(strstreambuf *this, streamoff offset, ios_seek_dir dir, int mode)
>   {
> -    FIXME("(%p %d %d %d) stub\n", this, offset, dir, mode);
> -    return EOF;
> +    char *base[3];
> +
> +    TRACE("(%p %d %d %d)\n", this, offset, dir, mode);
> +
> +    if (dir < 0 || dir > 2 || !(mode & (OPENMODE_in|OPENMODE_out)))
> +        return EOF;
> +    /* read buffer */
> +    if (mode & OPENMODE_in) {
> +        base[0] = this->base.eback;
> +        base[1] = this->base.gptr;
> +        base[2] = this->base.egptr;
The code will be easier to read if you use SEEKDIR_beg, SEEKDIR_cur and 
SEEKDIR_end instead of its values.
> +        if (this->base.gptr >= this->base.egptr)
> +            call_streambuf_underflow(&this->base);
According to my testing call_streambuf_underflow should be called 
always, even so default implementation will just return in this case. I 
was not really checking it but it looks wrong that you store base table 
values before underflow is called.

Patches 1-9 looks good for me.

Thanks,
Piotr



More information about the wine-devel mailing list