From a77b85156281a5c5b3f209e94d2d0bf6e11ba070 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 10 Mar 2010 14:51:37 -0600 Subject: [PATCH 6/8] ole32: Remove the NUM_BLOCKS_PER_DEPOT_BLOCK define. This should always be calculated based on the big block size. --- dlls/ole32/storage32.c | 6 ++++-- dlls/ole32/storage32.h | 8 +------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 87dabc4..c3c4e84 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -3141,7 +3141,7 @@ static HRESULT StorageImpl_GetNextBlockInChain( BYTE depotBuffer[MAX_BIG_BLOCK_SIZE]; BOOL success; ULONG depotBlockIndexPos; - int index; + int index, num_blocks; *nextBlockIndex = BLOCK_SPECIAL; @@ -3176,7 +3176,9 @@ static HRESULT StorageImpl_GetNextBlockInChain( if (!success) return STG_E_READFAULT; - for (index = 0; index < NUM_BLOCKS_PER_DEPOT_BLOCK; index++) + num_blocks = This->bigBlockSize / 4; + + for (index = 0; index < num_blocks; index++) { StorageUtl_ReadDWord(depotBuffer, index*sizeof(ULONG), nextBlockIndex); This->blockDepotCached[index] = *nextBlockIndex; diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index 73d17b6..9e57e30 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -96,14 +96,8 @@ static const ULONG DIRENTRY_NULL = 0xFFFFFFFF; */ #define STGTY_ROOT 0x05 -/* - * These defines assume a hardcoded blocksize. The code will assert - * if the blocksize is different. Some changes will have to be done if it - * becomes the case. - */ #define COUNT_BBDEPOTINHEADER 109 #define LIMIT_TO_USE_SMALL_BLOCK 0x1000 -#define NUM_BLOCKS_PER_DEPOT_BLOCK 128 #define STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f) #define STGM_SHARE_MODE(stgm) ((stgm)&0x000f0) @@ -363,7 +357,7 @@ struct StorageImpl ULONG extBigBlockDepotCount; ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER]; - ULONG blockDepotCached[NUM_BLOCKS_PER_DEPOT_BLOCK]; + ULONG blockDepotCached[MAX_BIG_BLOCK_SIZE / 4]; ULONG indexBlockDepotCached; ULONG prevFreeBlock; -- 1.6.3.3