Jacek Caban : urlmon: Fixed buffer size calculation.

Alexandre Julliard julliard at winehq.org
Thu May 21 09:35:50 CDT 2009


Module: wine
Branch: master
Commit: 061b6a839aac98c09cd560a0f5b0a2c19e9294cd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=061b6a839aac98c09cd560a0f5b0a2c19e9294cd

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed May 20 16:47:32 2009 +0200

urlmon: Fixed buffer size calculation.

---

 dlls/urlmon/bindprot.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c
index eceb7e3..f63824b 100644
--- a/dlls/urlmon/bindprot.c
+++ b/dlls/urlmon/bindprot.c
@@ -1002,20 +1002,18 @@ static HRESULT report_data(BindProtocol *This, DWORD bscf, ULONG progress, ULONG
 
         do {
             read = 0;
-            hres = IInternetProtocol_Read(This->protocol, This->buf+This->buf_size, BUFFER_SIZE-This->buf_size, &read);
-            if(hres != S_OK)
-                break;
+            hres = IInternetProtocol_Read(This->protocol, This->buf+This->buf_size,
+                    BUFFER_SIZE-This->buf_size, &read);
+            if(FAILED(hres) && hres != E_PENDING)
+                return hres;
             This->buf_size += read;
-        }while(This->buf_size < MIME_TEST_SIZE);
-        if(FAILED(hres) && hres != E_PENDING)
-            return hres;
+        }while(This->buf_size < MIME_TEST_SIZE && hres == S_OK);
 
-        This->buf_size += read;
         if(This->buf_size < MIME_TEST_SIZE && hres != S_FALSE)
             return S_OK;
 
-
-        hres = FindMimeFromData(NULL, This->url, This->buf, min(This->buf_size, MIME_TEST_SIZE), This->mime, 0, &mime, 0);
+        hres = FindMimeFromData(NULL, This->url, This->buf, min(This->buf_size, MIME_TEST_SIZE),
+                This->mime, 0, &mime, 0);
         if(FAILED(hres))
             return hres;
 




More information about the wine-cvs mailing list