Vincent Povirk : ole32: Remove the NUM_BLOCKS_PER_DEPOT_BLOCK define.

Alexandre Julliard julliard at winehq.org
Mon Mar 15 12:19:33 CDT 2010


Module: wine
Branch: master
Commit: 926669741edfaba22a2a9925d8550aeeb10737db
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=926669741edfaba22a2a9925d8550aeeb10737db

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Mar 10 14:51:37 2010 -0600

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 6e3c849..fefacb1 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -3159,7 +3159,7 @@ static HRESULT StorageImpl_GetNextBlockInChain(
   BYTE depotBuffer[MAX_BIG_BLOCK_SIZE];
   BOOL success;
   ULONG depotBlockIndexPos;
-  int index;
+  int index, num_blocks;
 
   *nextBlockIndex   = BLOCK_SPECIAL;
 
@@ -3194,7 +3194,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;
 




More information about the wine-cvs mailing list