Commit e883aeb3 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Cache the contents of one extended big block depot block.

parent 14a77db4
...@@ -2760,6 +2760,7 @@ static HRESULT StorageImpl_Construct( ...@@ -2760,6 +2760,7 @@ static HRESULT StorageImpl_Construct(
* There is no block depot cached yet. * There is no block depot cached yet.
*/ */
This->indexBlockDepotCached = 0xFFFFFFFF; This->indexBlockDepotCached = 0xFFFFFFFF;
This->indexExtBlockDepotCached = 0xFFFFFFFF;
/* /*
* Start searching for free blocks with block 0. * Start searching for free blocks with block 0.
...@@ -3134,17 +3135,32 @@ static ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This, ULONG depotIndex) ...@@ -3134,17 +3135,32 @@ static ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This, ULONG depotIndex)
ULONG extBlockOffset = numExtBlocks % depotBlocksPerExtBlock; ULONG extBlockOffset = numExtBlocks % depotBlocksPerExtBlock;
ULONG blockIndex = BLOCK_UNUSED; ULONG blockIndex = BLOCK_UNUSED;
ULONG extBlockIndex; ULONG extBlockIndex;
BYTE depotBuffer[MAX_BIG_BLOCK_SIZE];
int index, num_blocks;
assert(depotIndex >= COUNT_BBDEPOTINHEADER); assert(depotIndex >= COUNT_BBDEPOTINHEADER);
if (extBlockCount >= This->extBigBlockDepotCount) if (extBlockCount >= This->extBigBlockDepotCount)
return BLOCK_UNUSED; return BLOCK_UNUSED;
extBlockIndex = This->extBigBlockDepotLocations[extBlockCount]; if (This->indexExtBlockDepotCached != extBlockCount)
{
extBlockIndex = This->extBigBlockDepotLocations[extBlockCount];
if (extBlockIndex != BLOCK_UNUSED) StorageImpl_ReadBigBlock(This, extBlockIndex, depotBuffer);
StorageImpl_ReadDWordFromBigBlock(This, extBlockIndex,
extBlockOffset * sizeof(ULONG), &blockIndex); num_blocks = This->bigBlockSize / 4;
for (index = 0; index < num_blocks; index++)
{
StorageUtl_ReadDWord(depotBuffer, index*sizeof(ULONG), &blockIndex);
This->extBlockDepotCached[index] = blockIndex;
}
This->indexExtBlockDepotCached = extBlockCount;
}
blockIndex = This->extBlockDepotCached[extBlockOffset];
return blockIndex; return blockIndex;
} }
...@@ -3176,6 +3192,11 @@ static void Storage32Impl_SetExtDepotBlock(StorageImpl* This, ULONG depotIndex, ...@@ -3176,6 +3192,11 @@ static void Storage32Impl_SetExtDepotBlock(StorageImpl* This, ULONG depotIndex,
extBlockOffset * sizeof(ULONG), extBlockOffset * sizeof(ULONG),
blockIndex); blockIndex);
} }
if (This->indexExtBlockDepotCached == extBlockCount)
{
This->extBlockDepotCached[extBlockOffset] = blockIndex;
}
} }
/****************************************************************************** /******************************************************************************
......
...@@ -358,6 +358,9 @@ struct StorageImpl ...@@ -358,6 +358,9 @@ struct StorageImpl
ULONG extBigBlockDepotCount; ULONG extBigBlockDepotCount;
ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER]; ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER];
ULONG extBlockDepotCached[MAX_BIG_BLOCK_SIZE / 4];
ULONG indexExtBlockDepotCached;
ULONG blockDepotCached[MAX_BIG_BLOCK_SIZE / 4]; ULONG blockDepotCached[MAX_BIG_BLOCK_SIZE / 4];
ULONG indexBlockDepotCached; ULONG indexBlockDepotCached;
ULONG prevFreeBlock; ULONG prevFreeBlock;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment