Commit 14f8f9d5 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Remove the BigBlockFile abstraction and always use an ILockBytes.

parent 41714994
......@@ -21,6 +21,7 @@ C_SRCS = \
dictionary.c \
enumx.c \
errorinfo.c \
filelockbytes.c \
filemoniker.c \
ftmarshal.c \
git.c \
......@@ -39,7 +40,6 @@ C_SRCS = \
pointermoniker.c \
regsvr.c \
rpc.c \
stg_bigblockfile.c \
stg_prop.c \
stg_stream.c \
storage32.c \
......
......@@ -327,7 +327,7 @@ static HRESULT StorageImpl_ReadAt(StorageImpl* This,
ULONG size,
ULONG* bytesRead)
{
return BIGBLOCKFILE_ReadAt(This->bigBlockFile,offset,buffer,size,bytesRead);
return ILockBytes_ReadAt(This->lockBytes,offset,buffer,size,bytesRead);
}
static HRESULT StorageImpl_WriteAt(StorageImpl* This,
......@@ -336,7 +336,7 @@ static HRESULT StorageImpl_WriteAt(StorageImpl* This,
const ULONG size,
ULONG* bytesWritten)
{
return BIGBLOCKFILE_WriteAt(This->bigBlockFile,offset,buffer,size,bytesWritten);
return ILockBytes_WriteAt(This->lockBytes,offset,buffer,size,bytesWritten);
}
/************************************************************************
......@@ -2683,17 +2683,17 @@ static HRESULT StorageImpl_Construct(
*/
This->bigBlockSize = sector_size;
This->smallBlockSize = DEF_SMALL_BLOCK_SIZE;
This->bigBlockFile = BIGBLOCKFILE_Construct(hFile,
pLkbyt,
openFlags,
fileBased);
if (This->bigBlockFile == 0)
if (hFile)
hr = FileLockBytesImpl_Construct(hFile, openFlags, &This->lockBytes);
else
{
hr = E_FAIL;
goto end;
This->lockBytes = pLkbyt;
ILockBytes_AddRef(pLkbyt);
}
if (FAILED(hr))
goto end;
if (create)
{
ULARGE_INTEGER size;
......@@ -2729,7 +2729,7 @@ static HRESULT StorageImpl_Construct(
*/
size.u.HighPart = 0;
size.u.LowPart = This->bigBlockSize * 3;
BIGBLOCKFILE_SetSize(This->bigBlockFile, size);
ILockBytes_SetSize(This->lockBytes, size);
/*
* Initialize the big block depot
......@@ -2884,8 +2884,8 @@ static void StorageImpl_Destroy(StorageBaseImpl* iface)
for (i=0; i<BLOCKCHAIN_CACHE_SIZE; i++)
BlockChainStream_Destroy(This->blockChainCache[i]);
if (This->bigBlockFile)
BIGBLOCKFILE_Destructor(This->bigBlockFile);
if (This->lockBytes)
ILockBytes_Release(This->lockBytes);
HeapFree(GetProcessHeap(), 0, This);
}
......@@ -2908,6 +2908,7 @@ static ULONG StorageImpl_GetNextFreeBigBlock(
int depotIndex = 0;
ULONG freeBlock = BLOCK_UNUSED;
ULARGE_INTEGER neededSize;
STATSTG statstg;
depotIndex = This->prevFreeBlock / blocksPerDepot;
depotBlockOffset = (This->prevFreeBlock % blocksPerDepot) * sizeof(ULONG);
......@@ -3022,7 +3023,11 @@ static ULONG StorageImpl_GetNextFreeBigBlock(
* make sure that the block physically exists before using it
*/
neededSize.QuadPart = StorageImpl_GetBigBlockOffset(This, freeBlock)+This->bigBlockSize;
BIGBLOCKFILE_Expand(This->bigBlockFile, neededSize);
ILockBytes_Stat(This->lockBytes, &statstg, STATFLAG_NONAME);
if (neededSize.QuadPart > statstg.cbSize.QuadPart)
ILockBytes_SetSize(This->lockBytes, neededSize);
This->prevFreeBlock = freeBlock;
......
......@@ -11,6 +11,7 @@
*
* Copyright 1998,1999 Francis Beaudet
* Copyright 1998,1999 Thuy Nguyen
* Copyright 2010 Vincent Povirk for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -153,31 +154,7 @@ struct DirEntry
ULARGE_INTEGER size;
};
/*************************************************************************
* Big Block File support
*
* The big block file is an abstraction of a flat file separated in
* same sized blocks. The implementation for the methods described in
* this section appear in stg_bigblockfile.c
*/
typedef struct BigBlockFile BigBlockFile,*LPBIGBLOCKFILE;
/*
* Declaration of the functions used to manipulate the BigBlockFile
* data structure.
*/
BigBlockFile* BIGBLOCKFILE_Construct(HANDLE hFile,
ILockBytes* pLkByt,
DWORD openFlags,
BOOL fileBased);
void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This);
HRESULT BIGBLOCKFILE_Expand(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
HRESULT BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
HRESULT BIGBLOCKFILE_ReadAt(LPBIGBLOCKFILE This, ULARGE_INTEGER offset,
void* buffer, ULONG size, ULONG* bytesRead);
HRESULT BIGBLOCKFILE_WriteAt(LPBIGBLOCKFILE This, ULARGE_INTEGER offset,
const void* buffer, ULONG size, ULONG* bytesRead);
HRESULT FileLockBytesImpl_Construct(HANDLE hFile, DWORD openFlags, ILockBytes **pLockBytes);
/*************************************************************************
* Ole Convert support
......@@ -395,10 +372,7 @@ struct StorageImpl
BlockChainStream* blockChainCache[BLOCKCHAIN_CACHE_SIZE];
UINT blockChainToEvict;
/*
* Pointer to the big block file abstraction
*/
BigBlockFile* bigBlockFile;
ILockBytes* lockBytes;
};
HRESULT StorageImpl_ReadRawDirEntry(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment