Troy Rollo : ole32: Fix excessive file sizes for Storage files.

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 23 06:12:09 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 1be295fb471fdd0606f0d57cce22804dd7a1086c
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=1be295fb471fdd0606f0d57cce22804dd7a1086c

Author: Troy Rollo <wine at troy.rollo.name>
Date:   Tue May 23 11:42:25 2006 +1000

ole32: Fix excessive file sizes for Storage files.

The IStorage (DocFile) implementation was adding empty blocks at the
end of the file every time a caller wrote data that was not a multiple
of 512 bytes.  If the caller made a lot of very small writes the file
size could be huge even though the data in the file was tiny. This was
caused by BlockChainStream_SetSize trying to allocate file blocks for
the new data using a condition that bore no relationship to the
required condition, and it was not necessary to do so at that time
since it is done (the right way) by StorageImpl_GetNextFreeBigBlock
(called via BlockChainStream_Enlarge).

---

 dlls/ole32/storage32.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index a42841a..6c2ec60 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -4812,21 +4812,6 @@ BOOL BlockChainStream_SetSize(
   }
   else
   {
-    ULARGE_INTEGER fileSize =
-      BIGBLOCKFILE_GetSize(This->parentStorage->bigBlockFile);
-
-    ULONG diff = newSize.u.LowPart - size.u.LowPart;
-
-    /*
-     * Make sure the file stays a multiple of blocksize
-     */
-    if ((diff % This->parentStorage->bigBlockSize) != 0)
-      diff += (This->parentStorage->bigBlockSize -
-                (diff % This->parentStorage->bigBlockSize) );
-
-    fileSize.u.LowPart += diff;
-    BIGBLOCKFILE_SetSize(This->parentStorage->bigBlockFile, fileSize);
-
     BlockChainStream_Enlarge(This, newSize);
   }
 




More information about the wine-cvs mailing list