From c7539b2294173d34d1fe5c2cfa9abbd2a98c6930 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 10 Mar 2010 14:46:53 -0600 Subject: [PATCH 5/8] ole32: Remove the BIG_BLOCK_SIZE define. Big block sizes can be 512 or 4096, so we define arrays that are large enough in either case. --- dlls/ole32/storage32.c | 12 ++++++------ dlls/ole32/storage32.h | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 5f78241..87dabc4 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -2633,7 +2633,7 @@ static HRESULT StorageImpl_Construct( if (create) { ULARGE_INTEGER size; - BYTE bigBlockBuffer[BIG_BLOCK_SIZE]; + BYTE bigBlockBuffer[MAX_BIG_BLOCK_SIZE]; /* * Initialize all header variables: @@ -2830,7 +2830,7 @@ static ULONG StorageImpl_GetNextFreeBigBlock( StorageImpl* This) { ULONG depotBlockIndexPos; - BYTE depotBuffer[BIG_BLOCK_SIZE]; + BYTE depotBuffer[MAX_BIG_BLOCK_SIZE]; BOOL success; ULONG depotBlockOffset; ULONG blocksPerDepot = This->bigBlockSize / sizeof(ULONG); @@ -2965,7 +2965,7 @@ static ULONG StorageImpl_GetNextFreeBigBlock( */ static void Storage32Impl_AddBlockDepot(StorageImpl* This, ULONG blockIndex) { - BYTE blockBuffer[BIG_BLOCK_SIZE]; + BYTE blockBuffer[MAX_BIG_BLOCK_SIZE]; /* * Initialize blocks as free @@ -3048,7 +3048,7 @@ static ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This) { ULONG numExtBlocks = This->extBigBlockDepotCount; ULONG nextExtBlock = This->extBigBlockDepotStart; - BYTE depotBuffer[BIG_BLOCK_SIZE]; + BYTE depotBuffer[MAX_BIG_BLOCK_SIZE]; ULONG index = BLOCK_UNUSED; ULONG nextBlockOffset = This->bigBlockSize - sizeof(ULONG); ULONG blocksPerDepotBlock = This->bigBlockSize / sizeof(ULONG); @@ -3138,7 +3138,7 @@ static HRESULT StorageImpl_GetNextBlockInChain( ULONG offsetInDepot = blockIndex * sizeof (ULONG); ULONG depotBlockCount = offsetInDepot / This->bigBlockSize; ULONG depotBlockOffset = offsetInDepot % This->bigBlockSize; - BYTE depotBuffer[BIG_BLOCK_SIZE]; + BYTE depotBuffer[MAX_BIG_BLOCK_SIZE]; BOOL success; ULONG depotBlockIndexPos; int index; @@ -5727,7 +5727,7 @@ static ULONG SmallBlockChainStream_GetNextFreeBlock( ULONG sbdIndex = This->parentStorage->smallBlockDepotStart; ULONG nextBlock, newsbdIndex; - BYTE smallBlockDepot[BIG_BLOCK_SIZE]; + BYTE smallBlockDepot[MAX_BIG_BLOCK_SIZE]; nextBlock = sbdIndex; while (nextBlock != BLOCK_END_OF_CHAIN) diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index b1c835b..73d17b6 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -81,6 +81,9 @@ static const ULONG DIRENTRY_NULL = 0xFFFFFFFF; #define HEADER_SIZE 512 +#define MIN_BIG_BLOCK_SIZE 0x200 +#define MAX_BIG_BLOCK_SIZE 0x1000 + /* * Type of child entry link */ @@ -98,7 +101,6 @@ static const ULONG DIRENTRY_NULL = 0xFFFFFFFF; * if the blocksize is different. Some changes will have to be done if it * becomes the case. */ -#define BIG_BLOCK_SIZE 0x200 #define COUNT_BBDEPOTINHEADER 109 #define LIMIT_TO_USE_SMALL_BLOCK 0x1000 #define NUM_BLOCKS_PER_DEPOT_BLOCK 128 -- 1.6.3.3