Module: wine Branch: master Commit: 7b431237629bea6f418c6c2dd9c40cbe41d67aa4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7b431237629bea6f418c6c2dd9...
Author: Vincent Povirk vincent@codeweavers.com Date: Wed Mar 10 14:46:53 2010 -0600
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 3996a01..6e3c849 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -2651,7 +2651,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: @@ -2848,7 +2848,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); @@ -2983,7 +2983,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 @@ -3066,7 +3066,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); @@ -3156,7 +3156,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; @@ -5745,7 +5745,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