Commit ac032593 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: COM cleanup of IPropertySetStorage interface.

parent 0f36dc8d
...@@ -60,7 +60,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(storage); ...@@ -60,7 +60,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(storage);
static inline StorageImpl *impl_from_IPropertySetStorage( IPropertySetStorage *iface ) 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, /* These are documented in MSDN,
...@@ -2100,7 +2100,7 @@ static HRESULT WINAPI IPropertySetStorage_fnQueryInterface( ...@@ -2100,7 +2100,7 @@ static HRESULT WINAPI IPropertySetStorage_fnQueryInterface(
void** ppvObject) void** ppvObject)
{ {
StorageImpl *This = impl_from_IPropertySetStorage(ppstg); 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( ...@@ -2112,7 +2112,7 @@ static ULONG WINAPI IPropertySetStorage_fnAddRef(
IPropertySetStorage *ppstg) IPropertySetStorage *ppstg)
{ {
StorageImpl *This = impl_from_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( ...@@ -2124,7 +2124,7 @@ static ULONG WINAPI IPropertySetStorage_fnRelease(
IPropertySetStorage *ppstg) IPropertySetStorage *ppstg)
{ {
StorageImpl *This = impl_from_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( ...@@ -2173,7 +2173,7 @@ static HRESULT WINAPI IPropertySetStorage_fnCreate(
if (FAILED(r)) if (FAILED(r))
goto end; 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)) if (FAILED(r))
goto end; goto end;
...@@ -2218,7 +2218,7 @@ static HRESULT WINAPI IPropertySetStorage_fnOpen( ...@@ -2218,7 +2218,7 @@ static HRESULT WINAPI IPropertySetStorage_fnOpen(
if (FAILED(r)) if (FAILED(r))
goto end; 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)) if (FAILED(r))
goto end; goto end;
...@@ -2237,7 +2237,6 @@ static HRESULT WINAPI IPropertySetStorage_fnDelete( ...@@ -2237,7 +2237,6 @@ static HRESULT WINAPI IPropertySetStorage_fnDelete(
REFFMTID rfmtid) REFFMTID rfmtid)
{ {
StorageImpl *This = impl_from_IPropertySetStorage(ppstg); StorageImpl *This = impl_from_IPropertySetStorage(ppstg);
IStorage *stg = NULL;
WCHAR name[CCH_MAX_PROPSTG_NAME]; WCHAR name[CCH_MAX_PROPSTG_NAME];
HRESULT r; HRESULT r;
...@@ -2250,8 +2249,7 @@ static HRESULT WINAPI IPropertySetStorage_fnDelete( ...@@ -2250,8 +2249,7 @@ static HRESULT WINAPI IPropertySetStorage_fnDelete(
if (FAILED(r)) if (FAILED(r))
return r; return r;
stg = (IStorage*) This; return IStorage_DestroyElement(&This->base.IStorage_iface, name);
return IStorage_DestroyElement(stg, name);
} }
/************************************************************************ /************************************************************************
......
...@@ -57,7 +57,7 @@ static void StgStreamImpl_Destroy(StgStreamImpl* This) ...@@ -57,7 +57,7 @@ static void StgStreamImpl_Destroy(StgStreamImpl* This)
/* /*
* Release the reference we are holding on the parent storage. * 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 * No, don't do this. Some apps call IStorage_Release without
* calling IStream_Release first. If we grab a reference the * calling IStream_Release first. If we grab a reference the
...@@ -719,7 +719,7 @@ StgStreamImpl* StgStreamImpl_Construct( ...@@ -719,7 +719,7 @@ StgStreamImpl* StgStreamImpl_Construct(
* We want to nail-down the reference to the storage in case the * We want to nail-down the reference to the storage in case the
* stream out-lives the storage in the client application. * 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 * No, don't do this. Some apps call IStorage_Release without
* calling IStream_Release first. If we grab a reference the * calling IStream_Release first. If we grab a reference the
......
...@@ -373,11 +373,11 @@ static HRESULT WINAPI StorageBaseImpl_QueryInterface( ...@@ -373,11 +373,11 @@ static HRESULT WINAPI StorageBaseImpl_QueryInterface(
if (IsEqualGUID(&IID_IUnknown, riid) || if (IsEqualGUID(&IID_IUnknown, riid) ||
IsEqualGUID(&IID_IStorage, riid)) IsEqualGUID(&IID_IStorage, riid))
{ {
*ppvObject = This; *ppvObject = &This->IStorage_iface;
} }
else if (IsEqualGUID(&IID_IPropertySetStorage, riid)) else if (IsEqualGUID(&IID_IPropertySetStorage, riid))
{ {
*ppvObject = &This->pssVtbl; *ppvObject = &This->IPropertySetStorage_iface;
} }
if ((*ppvObject)==0) if ((*ppvObject)==0)
...@@ -2718,7 +2718,7 @@ static HRESULT StorageImpl_Construct( ...@@ -2718,7 +2718,7 @@ static HRESULT StorageImpl_Construct(
list_init(&This->base.storageHead); list_init(&This->base.storageHead);
This->base.IStorage_iface.lpVtbl = &Storage32Impl_Vtbl; 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.baseVtbl = &StorageImpl_BaseVtbl;
This->base.openFlags = (openFlags & ~STGM_CREATE); This->base.openFlags = (openFlags & ~STGM_CREATE);
This->base.ref = 1; This->base.ref = 1;
...@@ -5095,8 +5095,7 @@ static HRESULT TransactedSnapshotImpl_Construct(StorageBaseImpl *parentStorage, ...@@ -5095,8 +5095,7 @@ static HRESULT TransactedSnapshotImpl_Construct(StorageBaseImpl *parentStorage,
(*result)->base.IStorage_iface.lpVtbl = &TransactedSnapshotImpl_Vtbl; (*result)->base.IStorage_iface.lpVtbl = &TransactedSnapshotImpl_Vtbl;
/* This is OK because the property set storage functions use the IStorage functions. */ /* 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; (*result)->base.baseVtbl = &TransactedSnapshotImpl_BaseVtbl;
list_init(&(*result)->base.strmHead); list_init(&(*result)->base.strmHead);
...@@ -5693,7 +5692,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct( ...@@ -5693,7 +5692,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct(
* Initialize the virtual function table. * Initialize the virtual function table.
*/ */
newStorage->base.IStorage_iface.lpVtbl = &Storage32InternalImpl_Vtbl; 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.baseVtbl = &StorageInternalImpl_BaseVtbl;
newStorage->base.openFlags = (openFlags & ~STGM_CREATE); newStorage->base.openFlags = (openFlags & ~STGM_CREATE);
...@@ -9519,7 +9518,7 @@ HRESULT WINAPI ReadClassStm(IStream *pStm,CLSID *pclsid) ...@@ -9519,7 +9518,7 @@ HRESULT WINAPI ReadClassStm(IStream *pStm,CLSID *pclsid)
/* clear the output args */ /* clear the output args */
*pclsid = CLSID_NULL; *pclsid = CLSID_NULL;
res = IStream_Read(pStm,(void*)pclsid,sizeof(CLSID),&nbByte); res = IStream_Read(pStm, pclsid, sizeof(CLSID), &nbByte);
if (FAILED(res)) if (FAILED(res))
return res; return res;
......
...@@ -176,7 +176,7 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName ...@@ -176,7 +176,7 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName
struct StorageBaseImpl struct StorageBaseImpl
{ {
IStorage IStorage_iface; IStorage IStorage_iface;
const IPropertySetStorageVtbl *pssVtbl; /* interface for adding a properties stream */ IPropertySetStorage IPropertySetStorage_iface; /* interface for adding a properties stream */
LONG ref; LONG ref;
/* /*
......
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