Commit db0bd528 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Handle aCount < buf_size case correctly in nsIInputStream::Read implementation.

parent 372a0f24
......@@ -152,18 +152,21 @@ static nsresult NSAPI nsInputStream_Read(nsIInputStream *iface, char *aBuf, PRUi
PRUint32 *_retval)
{
nsProtocolStream *This = NSINSTREAM_THIS(iface);
DWORD read = aCount;
TRACE("(%p)->(%p %d %p)\n", This, aBuf, aCount, _retval);
/* Gecko always calls Read with big enough buffer */
if(aCount < This->buf_size)
FIXME("aCount < This->buf_size\n");
if(read > This->buf_size)
read = This->buf_size;
*_retval = This->buf_size;
if(This->buf_size)
memcpy(aBuf, This->buf, This->buf_size);
This->buf_size = 0;
if(read) {
memcpy(aBuf, This->buf, read);
if(read < This->buf_size)
memmove(This->buf, This->buf+read, This->buf_size-read);
This->buf_size -= read;
}
*_retval = read;
return NS_OK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment