ole32: COM cleanup of IPropertySetStorage interface.

This commit is contained in:
Nikolay Sivov 2012-07-14 20:42:48 +04:00 committed by Alexandre Julliard
parent 0f36dc8df8
commit ac032593c0
4 changed files with 16 additions and 19 deletions

View File

@ -60,7 +60,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(storage);
static inline StorageImpl *impl_from_IPropertySetStorage( IPropertySetStorage *iface )
{
return (StorageImpl *)((char*)iface - FIELD_OFFSET(StorageImpl, base.pssVtbl));
return CONTAINING_RECORD(iface, StorageImpl, base.IPropertySetStorage_iface);
}
/* These are documented in MSDN,
@ -2100,7 +2100,7 @@ static HRESULT WINAPI IPropertySetStorage_fnQueryInterface(
void** ppvObject)
{
StorageImpl *This = impl_from_IPropertySetStorage(ppstg);
return IStorage_QueryInterface( (IStorage*)This, riid, ppvObject );
return IStorage_QueryInterface( &This->base.IStorage_iface, riid, ppvObject );
}
/************************************************************************
@ -2112,7 +2112,7 @@ static ULONG WINAPI IPropertySetStorage_fnAddRef(
IPropertySetStorage *ppstg)
{
StorageImpl *This = impl_from_IPropertySetStorage(ppstg);
return IStorage_AddRef( (IStorage*)This );
return IStorage_AddRef( &This->base.IStorage_iface );
}
/************************************************************************
@ -2124,7 +2124,7 @@ static ULONG WINAPI IPropertySetStorage_fnRelease(
IPropertySetStorage *ppstg)
{
StorageImpl *This = impl_from_IPropertySetStorage(ppstg);
return IStorage_Release( (IStorage*)This );
return IStorage_Release( &This->base.IStorage_iface );
}
/************************************************************************
@ -2173,7 +2173,7 @@ static HRESULT WINAPI IPropertySetStorage_fnCreate(
if (FAILED(r))
goto end;
r = IStorage_CreateStream( (IStorage*)This, name, grfMode, 0, 0, &stm );
r = IStorage_CreateStream( &This->base.IStorage_iface, name, grfMode, 0, 0, &stm );
if (FAILED(r))
goto end;
@ -2218,7 +2218,7 @@ static HRESULT WINAPI IPropertySetStorage_fnOpen(
if (FAILED(r))
goto end;
r = IStorage_OpenStream((IStorage*) This, name, 0, grfMode, 0, &stm );
r = IStorage_OpenStream( &This->base.IStorage_iface, name, 0, grfMode, 0, &stm );
if (FAILED(r))
goto end;
@ -2237,7 +2237,6 @@ static HRESULT WINAPI IPropertySetStorage_fnDelete(
REFFMTID rfmtid)
{
StorageImpl *This = impl_from_IPropertySetStorage(ppstg);
IStorage *stg = NULL;
WCHAR name[CCH_MAX_PROPSTG_NAME];
HRESULT r;
@ -2250,8 +2249,7 @@ static HRESULT WINAPI IPropertySetStorage_fnDelete(
if (FAILED(r))
return r;
stg = (IStorage*) This;
return IStorage_DestroyElement(stg, name);
return IStorage_DestroyElement(&This->base.IStorage_iface, name);
}
/************************************************************************

View File

@ -57,7 +57,7 @@ static void StgStreamImpl_Destroy(StgStreamImpl* This)
/*
* Release the reference we are holding on the parent storage.
* IStorage_Release((IStorage*)This->parentStorage);
* IStorage_Release(&This->parentStorage->IStorage_iface);
*
* No, don't do this. Some apps call IStorage_Release without
* calling IStream_Release first. If we grab a reference the
@ -719,7 +719,7 @@ StgStreamImpl* StgStreamImpl_Construct(
* We want to nail-down the reference to the storage in case the
* stream out-lives the storage in the client application.
*
* -- IStorage_AddRef((IStorage*)newStream->parentStorage);
* -- IStorage_AddRef(&newStream->parentStorage->IStorage_iface);
*
* No, don't do this. Some apps call IStorage_Release without
* calling IStream_Release first. If we grab a reference the

View File

@ -373,11 +373,11 @@ static HRESULT WINAPI StorageBaseImpl_QueryInterface(
if (IsEqualGUID(&IID_IUnknown, riid) ||
IsEqualGUID(&IID_IStorage, riid))
{
*ppvObject = This;
*ppvObject = &This->IStorage_iface;
}
else if (IsEqualGUID(&IID_IPropertySetStorage, riid))
{
*ppvObject = &This->pssVtbl;
*ppvObject = &This->IPropertySetStorage_iface;
}
if ((*ppvObject)==0)
@ -2718,7 +2718,7 @@ static HRESULT StorageImpl_Construct(
list_init(&This->base.storageHead);
This->base.IStorage_iface.lpVtbl = &Storage32Impl_Vtbl;
This->base.pssVtbl = &IPropertySetStorage_Vtbl;
This->base.IPropertySetStorage_iface.lpVtbl = &IPropertySetStorage_Vtbl;
This->base.baseVtbl = &StorageImpl_BaseVtbl;
This->base.openFlags = (openFlags & ~STGM_CREATE);
This->base.ref = 1;
@ -5095,8 +5095,7 @@ static HRESULT TransactedSnapshotImpl_Construct(StorageBaseImpl *parentStorage,
(*result)->base.IStorage_iface.lpVtbl = &TransactedSnapshotImpl_Vtbl;
/* This is OK because the property set storage functions use the IStorage functions. */
(*result)->base.pssVtbl = parentStorage->pssVtbl;
(*result)->base.IPropertySetStorage_iface.lpVtbl = parentStorage->IPropertySetStorage_iface.lpVtbl;
(*result)->base.baseVtbl = &TransactedSnapshotImpl_BaseVtbl;
list_init(&(*result)->base.strmHead);
@ -5693,7 +5692,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct(
* Initialize the virtual function table.
*/
newStorage->base.IStorage_iface.lpVtbl = &Storage32InternalImpl_Vtbl;
newStorage->base.pssVtbl = &IPropertySetStorage_Vtbl;
newStorage->base.IPropertySetStorage_iface.lpVtbl = &IPropertySetStorage_Vtbl;
newStorage->base.baseVtbl = &StorageInternalImpl_BaseVtbl;
newStorage->base.openFlags = (openFlags & ~STGM_CREATE);
@ -9519,7 +9518,7 @@ HRESULT WINAPI ReadClassStm(IStream *pStm,CLSID *pclsid)
/* clear the output args */
*pclsid = CLSID_NULL;
res = IStream_Read(pStm,(void*)pclsid,sizeof(CLSID),&nbByte);
res = IStream_Read(pStm, pclsid, sizeof(CLSID), &nbByte);
if (FAILED(res))
return res;

View File

@ -176,7 +176,7 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName
struct StorageBaseImpl
{
IStorage IStorage_iface;
const IPropertySetStorageVtbl *pssVtbl; /* interface for adding a properties stream */
IPropertySetStorage IPropertySetStorage_iface; /* interface for adding a properties stream */
LONG ref;
/*