[PATCH 2/2] mapi32: COM cleanup for the IPropData iface.
Michael Stefaniuc
mstefani at redhat.de
Tue Dec 28 19:44:19 CST 2010
---
dlls/mapi32/prop.c | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/dlls/mapi32/prop.c b/dlls/mapi32/prop.c
index d89a318..b8b7e0d 100644
--- a/dlls/mapi32/prop.c
+++ b/dlls/mapi32/prop.c
@@ -1401,7 +1401,7 @@ typedef struct
/* The main property data collection structure */
typedef struct
{
- const IPropDataVtbl *lpVtbl;
+ IPropData IPropData_iface;
LONG lRef; /* Reference count */
ALLOCATEBUFFER *lpAlloc; /* Memory allocation routine */
ALLOCATEMORE *lpMore; /* Linked memory allocation routine */
@@ -1412,6 +1412,11 @@ typedef struct
CRITICAL_SECTION cs; /* Lock for thread safety */
} IPropDataImpl;
+static inline IPropDataImpl *impl_from_IPropData(IPropData *iface)
+{
+ return CONTAINING_RECORD(iface, IPropDataImpl, IPropData_iface);
+}
+
/* Internal - Get a property value, assumes lock is held */
static IPropDataItem *IMAPIPROP_GetValue(IPropDataImpl *This, ULONG ulPropTag)
{
@@ -1488,7 +1493,7 @@ static inline void IMAPIPROP_Unlock(IPropDataImpl *This)
static inline WINAPI HRESULT IPropData_fnQueryInterface(LPPROPDATA iface, REFIID riid,
LPVOID *ppvObj)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ IPropDataImpl *This = impl_from_IPropData(iface);
TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObj);
@@ -1519,7 +1524,7 @@ static inline WINAPI HRESULT IPropData_fnQueryInterface(LPPROPDATA iface, REFIID
*/
static ULONG WINAPI IPropData_fnAddRef(LPPROPDATA iface)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ IPropDataImpl *This = impl_from_IPropData(iface);
TRACE("(%p)->(count before=%u)\n", This, This->lRef);
@@ -1534,7 +1539,7 @@ static ULONG WINAPI IPropData_fnAddRef(LPPROPDATA iface)
*/
static ULONG WINAPI IPropData_fnRelease(LPPROPDATA iface)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ IPropDataImpl *This = impl_from_IPropData(iface);
LONG lRef;
TRACE("(%p)->(count before=%u)\n", This, This->lRef);
@@ -1643,9 +1648,9 @@ static HRESULT WINAPI IPropData_fnSaveChanges(LPPROPDATA iface, ULONG ulFlags)
static HRESULT WINAPI IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpTags, ULONG ulFlags,
ULONG *lpCount, LPSPropValue *lppProps)
{
+ IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i;
HRESULT hRet = S_OK;
- IPropDataImpl *This = (IPropDataImpl*)iface;
TRACE("(%p,%p,0x%08x,%p,%p) stub\n", iface, lpTags, ulFlags,
lpCount, lppProps);
@@ -1709,7 +1714,7 @@ static HRESULT WINAPI IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpT
static HRESULT WINAPI IPropData_fnGetPropList(LPPROPDATA iface, ULONG ulFlags,
LPSPropTagArray *lppTags)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i;
HRESULT hRet;
@@ -1780,7 +1785,7 @@ static HRESULT WINAPI IPropData_fnOpenProperty(LPPROPDATA iface, ULONG ulPropTag
static HRESULT WINAPI IPropData_fnSetProps(LPPROPDATA iface, ULONG ulValues, LPSPropValue lpProps,
LPSPropProblemArray *lppProbs)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ IPropDataImpl *This = impl_from_IPropData(iface);
HRESULT hRet = S_OK;
ULONG i;
@@ -1866,7 +1871,7 @@ static HRESULT WINAPI IPropData_fnSetProps(LPPROPDATA iface, ULONG ulValues, LPS
static HRESULT WINAPI IPropData_fnDeleteProps(LPPROPDATA iface, LPSPropTagArray lpTags,
LPSPropProblemArray *lppProbs)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i, numProbs = 0;
HRESULT hRet = S_OK;
@@ -2056,7 +2061,7 @@ static HRESULT WINAPI IPropData_fnGetIDsFromNames(LPPROPDATA iface, ULONG ulName
static HRESULT WINAPI
IPropData_fnHrSetObjAccess(LPPROPDATA iface, ULONG ulAccess)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ IPropDataImpl *This = impl_from_IPropData(iface);
TRACE("(%p,%x)\n", iface, ulAccess);
@@ -2110,8 +2115,7 @@ static HRESULT WINAPI
IPropData_fnHrSetPropAccess(LPPROPDATA iface, LPSPropTagArray lpTags,
ULONG *lpAccess)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
-
+ IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i;
TRACE("(%p,%p,%p)\n", iface, lpTags, lpAccess);
@@ -2162,7 +2166,7 @@ static HRESULT WINAPI
IPropData_fnHrGetPropAccess(LPPROPDATA iface, LPSPropTagArray *lppTags,
ULONG **lppAccess)
{
- IPropDataImpl *This = (IPropDataImpl*)iface;
+ IPropDataImpl *This = impl_from_IPropData(iface);
LPVOID lpMem;
HRESULT hRet;
ULONG i;
@@ -2317,7 +2321,7 @@ SCODE WINAPI CreateIProp(LPCIID iid, ALLOCATEBUFFER *lpAlloc,
if (SUCCEEDED(scode))
{
- lpPropData->lpVtbl = &IPropDataImpl_vtbl;
+ lpPropData->IPropData_iface.lpVtbl = &IPropDataImpl_vtbl;
lpPropData->lRef = 1;
lpPropData->lpAlloc = lpAlloc;
lpPropData->lpMore = lpMore;
@@ -2327,7 +2331,7 @@ SCODE WINAPI CreateIProp(LPCIID iid, ALLOCATEBUFFER *lpAlloc,
list_init(&lpPropData->values);
InitializeCriticalSection(&lpPropData->cs);
lpPropData->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IPropDataImpl.cs");
- *lppPropData = (LPPROPDATA)lpPropData;
+ *lppPropData = &lpPropData->IPropData_iface;
}
return scode;
}
--
1.7.3.4
More information about the wine-patches
mailing list