Module: wine Branch: refs/heads/master Commit: 427920f8a26d999077225941f8e09899fa459a6c URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=427920f8a26d999077225941...
Author: Ulrich Czekalla ulrich@codeweavers.com Date: Fri Jan 6 12:16:04 2006 +0100
ole: Fix SmallBlocksToBigBlocks loop. Stop copying data when read returns 0 bytes
---
dlls/ole32/storage32.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index c9d696e..cde6526 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -3453,18 +3453,26 @@ BlockChainStream* Storage32Impl_SmallBlo DEF_SMALL_BLOCK_SIZE, buffer, &cbRead); - cbTotalRead += cbRead; + if (FAILED(successRead)) + break; + + if (cbRead > 0) + { + cbTotalRead += cbRead;
- successWrite = BlockChainStream_WriteAt(bbTempChain, + successWrite = BlockChainStream_WriteAt(bbTempChain, offset, cbRead, buffer, &cbWritten); - cbTotalWritten += cbWritten;
- offset.u.LowPart += This->smallBlockSize; + if (!successWrite) + break;
- } while (SUCCEEDED(successRead) && successWrite); + cbTotalWritten += cbWritten; + offset.u.LowPart += This->smallBlockSize; + } + } while (cbRead > 0); HeapFree(GetProcessHeap(),0,buffer);
assert(cbTotalRead == cbTotalWritten);