Kirill K. Smirnov : ole32: Fix logic in Storage32Impl_SmallBlocksToBigBlocks function.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 27 12:51:10 CST 2006


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

Author: Kirill K. Smirnov <lich at math.spbu.ru>
Date:   Sun Nov 26 16:47:54 2006 +0300

ole32: Fix logic in Storage32Impl_SmallBlocksToBigBlocks function.

---

 dlls/ole32/storage32.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index cd67465..733f659 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -3555,7 +3555,8 @@ BlockChainStream* Storage32Impl_SmallBlo
 {
   ULONG bbHeadOfChain = BLOCK_END_OF_CHAIN;
   ULARGE_INTEGER size, offset;
-  ULONG cbRead, cbWritten, cbTotalRead, cbTotalWritten;
+  ULONG cbRead, cbWritten;
+  ULARGE_INTEGER cbTotalRead;
   ULONG propertyIndex;
   HRESULT resWrite = S_OK;
   HRESULT resRead;
@@ -3585,8 +3586,7 @@ BlockChainStream* Storage32Impl_SmallBlo
    */
   offset.u.LowPart = 0;
   offset.u.HighPart = 0;
-  cbTotalRead = 0;
-  cbTotalWritten = 0;
+  cbTotalRead.QuadPart = 0;
 
   buffer = HeapAlloc(GetProcessHeap(),0,DEF_SMALL_BLOCK_SIZE);
   do
@@ -3601,7 +3601,7 @@ BlockChainStream* Storage32Impl_SmallBlo
 
     if (cbRead > 0)
     {
-        cbTotalRead += cbRead;
+        cbTotalRead.QuadPart += cbRead;
 
         resWrite = BlockChainStream_WriteAt(bbTempChain,
                                             offset,
@@ -3612,10 +3612,9 @@ BlockChainStream* Storage32Impl_SmallBlo
         if (FAILED(resWrite))
             break;
 
-        cbTotalWritten += cbWritten;
         offset.u.LowPart += This->smallBlockSize;
     }
-  } while (cbRead > 0);
+  } while (cbTotalRead.QuadPart < size.QuadPart);
   HeapFree(GetProcessHeap(),0,buffer);
 
   if (FAILED(resRead) || FAILED(resWrite))




More information about the wine-cvs mailing list