ole: Fix SmallBlocksToBigBlocks loop.

Stop copying data when read returns 0 bytes
This commit is contained in:
Ulrich Czekalla 2006-01-06 12:16:04 +01:00 committed by Alexandre Julliard
parent 3dea0973d2
commit 427920f8a2
1 changed files with 13 additions and 5 deletions

View File

@ -3453,18 +3453,26 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
DEF_SMALL_BLOCK_SIZE,
buffer,
&cbRead);
cbTotalRead += cbRead;
if (FAILED(successRead))
break;
successWrite = BlockChainStream_WriteAt(bbTempChain,
if (cbRead > 0)
{
cbTotalRead += cbRead;
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);