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,6 +3453,11 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
DEF_SMALL_BLOCK_SIZE,
buffer,
&cbRead);
if (FAILED(successRead))
break;
if (cbRead > 0)
{
cbTotalRead += cbRead;
successWrite = BlockChainStream_WriteAt(bbTempChain,
@ -3460,11 +3465,14 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
cbRead,
buffer,
&cbWritten);
if (!successWrite)
break;
cbTotalWritten += cbWritten;
offset.u.LowPart += This->smallBlockSize;
} while (SUCCEEDED(successRead) && successWrite);
}
} while (cbRead > 0);
HeapFree(GetProcessHeap(),0,buffer);
assert(cbTotalRead == cbTotalWritten);