Commit abcd84aa authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mapi32: COM cleanup for the IPropData iface.

parent e67e836e
...@@ -1401,7 +1401,7 @@ typedef struct ...@@ -1401,7 +1401,7 @@ typedef struct
/* The main property data collection structure */ /* The main property data collection structure */
typedef struct typedef struct
{ {
const IPropDataVtbl *lpVtbl; IPropData IPropData_iface;
LONG lRef; /* Reference count */ LONG lRef; /* Reference count */
ALLOCATEBUFFER *lpAlloc; /* Memory allocation routine */ ALLOCATEBUFFER *lpAlloc; /* Memory allocation routine */
ALLOCATEMORE *lpMore; /* Linked memory allocation routine */ ALLOCATEMORE *lpMore; /* Linked memory allocation routine */
...@@ -1412,6 +1412,11 @@ typedef struct ...@@ -1412,6 +1412,11 @@ typedef struct
CRITICAL_SECTION cs; /* Lock for thread safety */ CRITICAL_SECTION cs; /* Lock for thread safety */
} IPropDataImpl; } 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 */ /* Internal - Get a property value, assumes lock is held */
static IPropDataItem *IMAPIPROP_GetValue(IPropDataImpl *This, ULONG ulPropTag) static IPropDataItem *IMAPIPROP_GetValue(IPropDataImpl *This, ULONG ulPropTag)
{ {
...@@ -1487,7 +1492,7 @@ static inline void IMAPIPROP_Unlock(IPropDataImpl *This) ...@@ -1487,7 +1492,7 @@ static inline void IMAPIPROP_Unlock(IPropDataImpl *This)
*/ */
static WINAPI HRESULT IPropData_fnQueryInterface(LPPROPDATA iface, REFIID riid, LPVOID *ppvObj) static 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); TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObj);
...@@ -1518,7 +1523,7 @@ static WINAPI HRESULT IPropData_fnQueryInterface(LPPROPDATA iface, REFIID riid, ...@@ -1518,7 +1523,7 @@ static WINAPI HRESULT IPropData_fnQueryInterface(LPPROPDATA iface, REFIID riid,
*/ */
static ULONG WINAPI IPropData_fnAddRef(LPPROPDATA iface) 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); TRACE("(%p)->(count before=%u)\n", This, This->lRef);
...@@ -1533,7 +1538,7 @@ static ULONG WINAPI IPropData_fnAddRef(LPPROPDATA iface) ...@@ -1533,7 +1538,7 @@ static ULONG WINAPI IPropData_fnAddRef(LPPROPDATA iface)
*/ */
static ULONG WINAPI IPropData_fnRelease(LPPROPDATA iface) static ULONG WINAPI IPropData_fnRelease(LPPROPDATA iface)
{ {
IPropDataImpl *This = (IPropDataImpl*)iface; IPropDataImpl *This = impl_from_IPropData(iface);
LONG lRef; LONG lRef;
TRACE("(%p)->(count before=%u)\n", This, This->lRef); TRACE("(%p)->(count before=%u)\n", This, This->lRef);
...@@ -1642,9 +1647,9 @@ static HRESULT WINAPI IPropData_fnSaveChanges(LPPROPDATA iface, ULONG ulFlags) ...@@ -1642,9 +1647,9 @@ static HRESULT WINAPI IPropData_fnSaveChanges(LPPROPDATA iface, ULONG ulFlags)
static HRESULT WINAPI IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpTags, ULONG ulFlags, static HRESULT WINAPI IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpTags, ULONG ulFlags,
ULONG *lpCount, LPSPropValue *lppProps) ULONG *lpCount, LPSPropValue *lppProps)
{ {
IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i; ULONG i;
HRESULT hRet = S_OK; HRESULT hRet = S_OK;
IPropDataImpl *This = (IPropDataImpl*)iface;
TRACE("(%p,%p,0x%08x,%p,%p) stub\n", iface, lpTags, ulFlags, TRACE("(%p,%p,0x%08x,%p,%p) stub\n", iface, lpTags, ulFlags,
lpCount, lppProps); lpCount, lppProps);
...@@ -1708,7 +1713,7 @@ static HRESULT WINAPI IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpT ...@@ -1708,7 +1713,7 @@ static HRESULT WINAPI IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpT
static HRESULT WINAPI IPropData_fnGetPropList(LPPROPDATA iface, ULONG ulFlags, static HRESULT WINAPI IPropData_fnGetPropList(LPPROPDATA iface, ULONG ulFlags,
LPSPropTagArray *lppTags) LPSPropTagArray *lppTags)
{ {
IPropDataImpl *This = (IPropDataImpl*)iface; IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i; ULONG i;
HRESULT hRet; HRESULT hRet;
...@@ -1779,7 +1784,7 @@ static HRESULT WINAPI IPropData_fnOpenProperty(LPPROPDATA iface, ULONG ulPropTag ...@@ -1779,7 +1784,7 @@ static HRESULT WINAPI IPropData_fnOpenProperty(LPPROPDATA iface, ULONG ulPropTag
static HRESULT WINAPI IPropData_fnSetProps(LPPROPDATA iface, ULONG ulValues, LPSPropValue lpProps, static HRESULT WINAPI IPropData_fnSetProps(LPPROPDATA iface, ULONG ulValues, LPSPropValue lpProps,
LPSPropProblemArray *lppProbs) LPSPropProblemArray *lppProbs)
{ {
IPropDataImpl *This = (IPropDataImpl*)iface; IPropDataImpl *This = impl_from_IPropData(iface);
HRESULT hRet = S_OK; HRESULT hRet = S_OK;
ULONG i; ULONG i;
...@@ -1865,7 +1870,7 @@ static HRESULT WINAPI IPropData_fnSetProps(LPPROPDATA iface, ULONG ulValues, LPS ...@@ -1865,7 +1870,7 @@ static HRESULT WINAPI IPropData_fnSetProps(LPPROPDATA iface, ULONG ulValues, LPS
static HRESULT WINAPI IPropData_fnDeleteProps(LPPROPDATA iface, LPSPropTagArray lpTags, static HRESULT WINAPI IPropData_fnDeleteProps(LPPROPDATA iface, LPSPropTagArray lpTags,
LPSPropProblemArray *lppProbs) LPSPropProblemArray *lppProbs)
{ {
IPropDataImpl *This = (IPropDataImpl*)iface; IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i, numProbs = 0; ULONG i, numProbs = 0;
HRESULT hRet = S_OK; HRESULT hRet = S_OK;
...@@ -2055,7 +2060,7 @@ static HRESULT WINAPI IPropData_fnGetIDsFromNames(LPPROPDATA iface, ULONG ulName ...@@ -2055,7 +2060,7 @@ static HRESULT WINAPI IPropData_fnGetIDsFromNames(LPPROPDATA iface, ULONG ulName
static HRESULT WINAPI static HRESULT WINAPI
IPropData_fnHrSetObjAccess(LPPROPDATA iface, ULONG ulAccess) IPropData_fnHrSetObjAccess(LPPROPDATA iface, ULONG ulAccess)
{ {
IPropDataImpl *This = (IPropDataImpl*)iface; IPropDataImpl *This = impl_from_IPropData(iface);
TRACE("(%p,%x)\n", iface, ulAccess); TRACE("(%p,%x)\n", iface, ulAccess);
...@@ -2109,8 +2114,7 @@ static HRESULT WINAPI ...@@ -2109,8 +2114,7 @@ static HRESULT WINAPI
IPropData_fnHrSetPropAccess(LPPROPDATA iface, LPSPropTagArray lpTags, IPropData_fnHrSetPropAccess(LPPROPDATA iface, LPSPropTagArray lpTags,
ULONG *lpAccess) ULONG *lpAccess)
{ {
IPropDataImpl *This = (IPropDataImpl*)iface; IPropDataImpl *This = impl_from_IPropData(iface);
ULONG i; ULONG i;
TRACE("(%p,%p,%p)\n", iface, lpTags, lpAccess); TRACE("(%p,%p,%p)\n", iface, lpTags, lpAccess);
...@@ -2161,7 +2165,7 @@ static HRESULT WINAPI ...@@ -2161,7 +2165,7 @@ static HRESULT WINAPI
IPropData_fnHrGetPropAccess(LPPROPDATA iface, LPSPropTagArray *lppTags, IPropData_fnHrGetPropAccess(LPPROPDATA iface, LPSPropTagArray *lppTags,
ULONG **lppAccess) ULONG **lppAccess)
{ {
IPropDataImpl *This = (IPropDataImpl*)iface; IPropDataImpl *This = impl_from_IPropData(iface);
LPVOID lpMem; LPVOID lpMem;
HRESULT hRet; HRESULT hRet;
ULONG i; ULONG i;
...@@ -2316,7 +2320,7 @@ SCODE WINAPI CreateIProp(LPCIID iid, ALLOCATEBUFFER *lpAlloc, ...@@ -2316,7 +2320,7 @@ SCODE WINAPI CreateIProp(LPCIID iid, ALLOCATEBUFFER *lpAlloc,
if (SUCCEEDED(scode)) if (SUCCEEDED(scode))
{ {
lpPropData->lpVtbl = &IPropDataImpl_vtbl; lpPropData->IPropData_iface.lpVtbl = &IPropDataImpl_vtbl;
lpPropData->lRef = 1; lpPropData->lRef = 1;
lpPropData->lpAlloc = lpAlloc; lpPropData->lpAlloc = lpAlloc;
lpPropData->lpMore = lpMore; lpPropData->lpMore = lpMore;
...@@ -2326,7 +2330,7 @@ SCODE WINAPI CreateIProp(LPCIID iid, ALLOCATEBUFFER *lpAlloc, ...@@ -2326,7 +2330,7 @@ SCODE WINAPI CreateIProp(LPCIID iid, ALLOCATEBUFFER *lpAlloc,
list_init(&lpPropData->values); list_init(&lpPropData->values);
InitializeCriticalSection(&lpPropData->cs); InitializeCriticalSection(&lpPropData->cs);
lpPropData->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IPropDataImpl.cs"); lpPropData->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IPropDataImpl.cs");
*lppPropData = (LPPROPDATA)lpPropData; *lppPropData = &lpPropData->IPropData_iface;
} }
return scode; return scode;
} }
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