urlmon: Fixed buffer size calculation.

This commit is contained in:
Jacek Caban 2009-05-20 16:47:32 +02:00 committed by Alexandre Julliard
parent 30df52ca1e
commit 061b6a839a
1 changed files with 7 additions and 9 deletions

View File

@ -1002,20 +1002,18 @@ static HRESULT report_data(BindProtocol *This, DWORD bscf, ULONG progress, ULONG
do { do {
read = 0; read = 0;
hres = IInternetProtocol_Read(This->protocol, This->buf+This->buf_size, BUFFER_SIZE-This->buf_size, &read); hres = IInternetProtocol_Read(This->protocol, This->buf+This->buf_size,
if(hres != S_OK) BUFFER_SIZE-This->buf_size, &read);
break;
This->buf_size += read;
}while(This->buf_size < MIME_TEST_SIZE);
if(FAILED(hres) && hres != E_PENDING) if(FAILED(hres) && hres != E_PENDING)
return hres; return hres;
This->buf_size += read; This->buf_size += read;
}while(This->buf_size < MIME_TEST_SIZE && hres == S_OK);
if(This->buf_size < MIME_TEST_SIZE && hres != S_FALSE) if(This->buf_size < MIME_TEST_SIZE && hres != S_FALSE)
return S_OK; return S_OK;
hres = FindMimeFromData(NULL, This->url, This->buf, min(This->buf_size, MIME_TEST_SIZE),
hres = FindMimeFromData(NULL, This->url, This->buf, min(This->buf_size, MIME_TEST_SIZE), This->mime, 0, &mime, 0); This->mime, 0, &mime, 0);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;