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

oleaut32: Use an iface instead of a vtbl pointer in IRecordInfoImpl.

parent f3810015
...@@ -41,7 +41,7 @@ typedef struct { ...@@ -41,7 +41,7 @@ typedef struct {
} fieldstr; } fieldstr;
typedef struct { typedef struct {
const IRecordInfoVtbl *lpVtbl; IRecordInfo IRecordInfo_iface;
LONG ref; LONG ref;
GUID guid; GUID guid;
...@@ -53,6 +53,11 @@ typedef struct { ...@@ -53,6 +53,11 @@ typedef struct {
ITypeInfo *pTypeInfo; ITypeInfo *pTypeInfo;
} IRecordInfoImpl; } IRecordInfoImpl;
static inline IRecordInfoImpl *impl_from_IRecordInfo(IRecordInfo *iface)
{
return CONTAINING_RECORD(iface, IRecordInfoImpl, IRecordInfo_iface);
}
static HRESULT copy_to_variant(void *src, VARIANT *pvar, enum VARENUM vt) static HRESULT copy_to_variant(void *src, VARIANT *pvar, enum VARENUM vt)
{ {
TRACE("%p %p %d\n", src, pvar, vt); TRACE("%p %p %d\n", src, pvar, vt);
...@@ -155,7 +160,7 @@ static HRESULT WINAPI IRecordInfoImpl_QueryInterface(IRecordInfo *iface, REFIID ...@@ -155,7 +160,7 @@ static HRESULT WINAPI IRecordInfoImpl_QueryInterface(IRecordInfo *iface, REFIID
static ULONG WINAPI IRecordInfoImpl_AddRef(IRecordInfo *iface) static ULONG WINAPI IRecordInfoImpl_AddRef(IRecordInfo *iface)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) -> %d\n", This, ref); TRACE("(%p) -> %d\n", This, ref);
return ref; return ref;
...@@ -163,7 +168,7 @@ static ULONG WINAPI IRecordInfoImpl_AddRef(IRecordInfo *iface) ...@@ -163,7 +168,7 @@ static ULONG WINAPI IRecordInfoImpl_AddRef(IRecordInfo *iface)
static ULONG WINAPI IRecordInfoImpl_Release(IRecordInfo *iface) static ULONG WINAPI IRecordInfoImpl_Release(IRecordInfo *iface)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) -> %d\n", This, ref); TRACE("(%p) -> %d\n", This, ref);
...@@ -182,7 +187,7 @@ static ULONG WINAPI IRecordInfoImpl_Release(IRecordInfo *iface) ...@@ -182,7 +187,7 @@ static ULONG WINAPI IRecordInfoImpl_Release(IRecordInfo *iface)
static HRESULT WINAPI IRecordInfoImpl_RecordInit(IRecordInfo *iface, PVOID pvNew) static HRESULT WINAPI IRecordInfoImpl_RecordInit(IRecordInfo *iface, PVOID pvNew)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
TRACE("(%p)->(%p)\n", This, pvNew); TRACE("(%p)->(%p)\n", This, pvNew);
if(!pvNew) if(!pvNew)
...@@ -194,7 +199,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordInit(IRecordInfo *iface, PVOID pvNew ...@@ -194,7 +199,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordInit(IRecordInfo *iface, PVOID pvNew
static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvExisting) static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvExisting)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
int i; int i;
PVOID var; PVOID var;
...@@ -251,7 +256,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvEx ...@@ -251,7 +256,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvEx
static HRESULT WINAPI IRecordInfoImpl_RecordCopy(IRecordInfo *iface, PVOID pvExisting, static HRESULT WINAPI IRecordInfoImpl_RecordCopy(IRecordInfo *iface, PVOID pvExisting,
PVOID pvNew) PVOID pvNew)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
TRACE("(%p)->(%p %p)\n", This, pvExisting, pvNew); TRACE("(%p)->(%p %p)\n", This, pvExisting, pvNew);
...@@ -264,7 +269,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordCopy(IRecordInfo *iface, PVOID pvExi ...@@ -264,7 +269,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordCopy(IRecordInfo *iface, PVOID pvExi
static HRESULT WINAPI IRecordInfoImpl_GetGuid(IRecordInfo *iface, GUID *pguid) static HRESULT WINAPI IRecordInfoImpl_GetGuid(IRecordInfo *iface, GUID *pguid)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
TRACE("(%p)->(%p)\n", This, pguid); TRACE("(%p)->(%p)\n", This, pguid);
...@@ -277,7 +282,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetGuid(IRecordInfo *iface, GUID *pguid) ...@@ -277,7 +282,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetGuid(IRecordInfo *iface, GUID *pguid)
static HRESULT WINAPI IRecordInfoImpl_GetName(IRecordInfo *iface, BSTR *pbstrName) static HRESULT WINAPI IRecordInfoImpl_GetName(IRecordInfo *iface, BSTR *pbstrName)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
TRACE("(%p)->(%p)\n", This, pbstrName); TRACE("(%p)->(%p)\n", This, pbstrName);
...@@ -290,8 +295,8 @@ static HRESULT WINAPI IRecordInfoImpl_GetName(IRecordInfo *iface, BSTR *pbstrNam ...@@ -290,8 +295,8 @@ static HRESULT WINAPI IRecordInfoImpl_GetName(IRecordInfo *iface, BSTR *pbstrNam
static HRESULT WINAPI IRecordInfoImpl_GetSize(IRecordInfo *iface, ULONG *pcbSize) static HRESULT WINAPI IRecordInfoImpl_GetSize(IRecordInfo *iface, ULONG *pcbSize)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
TRACE("(%p)->(%p)\n", This, pcbSize); TRACE("(%p)->(%p)\n", This, pcbSize);
if(!pcbSize) if(!pcbSize)
...@@ -303,7 +308,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetSize(IRecordInfo *iface, ULONG *pcbSize ...@@ -303,7 +308,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetSize(IRecordInfo *iface, ULONG *pcbSize
static HRESULT WINAPI IRecordInfoImpl_GetTypeInfo(IRecordInfo *iface, ITypeInfo **ppTypeInfo) static HRESULT WINAPI IRecordInfoImpl_GetTypeInfo(IRecordInfo *iface, ITypeInfo **ppTypeInfo)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
TRACE("(%p)->(%p)\n", This, ppTypeInfo); TRACE("(%p)->(%p)\n", This, ppTypeInfo);
...@@ -319,7 +324,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetTypeInfo(IRecordInfo *iface, ITypeInfo ...@@ -319,7 +324,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetTypeInfo(IRecordInfo *iface, ITypeInfo
static HRESULT WINAPI IRecordInfoImpl_GetField(IRecordInfo *iface, PVOID pvData, static HRESULT WINAPI IRecordInfoImpl_GetField(IRecordInfo *iface, PVOID pvData,
LPCOLESTR szFieldName, VARIANT *pvarField) LPCOLESTR szFieldName, VARIANT *pvarField)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
int i; int i;
TRACE("(%p)->(%p %s %p)\n", This, pvData, debugstr_w(szFieldName), pvarField); TRACE("(%p)->(%p %s %p)\n", This, pvData, debugstr_w(szFieldName), pvarField);
...@@ -341,7 +346,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetField(IRecordInfo *iface, PVOID pvData, ...@@ -341,7 +346,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetField(IRecordInfo *iface, PVOID pvData,
static HRESULT WINAPI IRecordInfoImpl_GetFieldNoCopy(IRecordInfo *iface, PVOID pvData, static HRESULT WINAPI IRecordInfoImpl_GetFieldNoCopy(IRecordInfo *iface, PVOID pvData,
LPCOLESTR szFieldName, VARIANT *pvarField, PVOID *ppvDataCArray) LPCOLESTR szFieldName, VARIANT *pvarField, PVOID *ppvDataCArray)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
int i; int i;
TRACE("(%p)->(%p %s %p %p)\n", This, pvData, debugstr_w(szFieldName), pvarField, ppvDataCArray); TRACE("(%p)->(%p %s %p %p)\n", This, pvData, debugstr_w(szFieldName), pvarField, ppvDataCArray);
...@@ -365,7 +370,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetFieldNoCopy(IRecordInfo *iface, PVOID p ...@@ -365,7 +370,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetFieldNoCopy(IRecordInfo *iface, PVOID p
static HRESULT WINAPI IRecordInfoImpl_PutField(IRecordInfo *iface, ULONG wFlags, PVOID pvData, static HRESULT WINAPI IRecordInfoImpl_PutField(IRecordInfo *iface, ULONG wFlags, PVOID pvData,
LPCOLESTR szFieldName, VARIANT *pvarField) LPCOLESTR szFieldName, VARIANT *pvarField)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
int i; int i;
TRACE("(%p)->(%08x %p %s %p)\n", This, wFlags, pvData, debugstr_w(szFieldName), TRACE("(%p)->(%08x %p %s %p)\n", This, wFlags, pvData, debugstr_w(szFieldName),
...@@ -393,7 +398,7 @@ static HRESULT WINAPI IRecordInfoImpl_PutField(IRecordInfo *iface, ULONG wFlags, ...@@ -393,7 +398,7 @@ static HRESULT WINAPI IRecordInfoImpl_PutField(IRecordInfo *iface, ULONG wFlags,
static HRESULT WINAPI IRecordInfoImpl_PutFieldNoCopy(IRecordInfo *iface, ULONG wFlags, static HRESULT WINAPI IRecordInfoImpl_PutFieldNoCopy(IRecordInfo *iface, ULONG wFlags,
PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField) PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
int i; int i;
FIXME("(%p)->(%08x %p %s %p) stub\n", This, wFlags, pvData, debugstr_w(szFieldName), pvarField); FIXME("(%p)->(%08x %p %s %p) stub\n", This, wFlags, pvData, debugstr_w(szFieldName), pvarField);
...@@ -414,7 +419,7 @@ static HRESULT WINAPI IRecordInfoImpl_PutFieldNoCopy(IRecordInfo *iface, ULONG w ...@@ -414,7 +419,7 @@ static HRESULT WINAPI IRecordInfoImpl_PutFieldNoCopy(IRecordInfo *iface, ULONG w
static HRESULT WINAPI IRecordInfoImpl_GetFieldNames(IRecordInfo *iface, ULONG *pcNames, static HRESULT WINAPI IRecordInfoImpl_GetFieldNames(IRecordInfo *iface, ULONG *pcNames,
BSTR *rgBstrNames) BSTR *rgBstrNames)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
ULONG n = This->n_vars, i; ULONG n = This->n_vars, i;
TRACE("(%p)->(%p %p)\n", This, pcNames, rgBstrNames); TRACE("(%p)->(%p %p)\n", This, pcNames, rgBstrNames);
...@@ -436,7 +441,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetFieldNames(IRecordInfo *iface, ULONG *p ...@@ -436,7 +441,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetFieldNames(IRecordInfo *iface, ULONG *p
static BOOL WINAPI IRecordInfoImpl_IsMatchingType(IRecordInfo *iface, IRecordInfo *pRecordInfo) static BOOL WINAPI IRecordInfoImpl_IsMatchingType(IRecordInfo *iface, IRecordInfo *pRecordInfo)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
FIXME("(%p)->(%p) stub\n", This, pRecordInfo); FIXME("(%p)->(%p) stub\n", This, pRecordInfo);
...@@ -445,7 +450,7 @@ static BOOL WINAPI IRecordInfoImpl_IsMatchingType(IRecordInfo *iface, IRecordInf ...@@ -445,7 +450,7 @@ static BOOL WINAPI IRecordInfoImpl_IsMatchingType(IRecordInfo *iface, IRecordInf
static PVOID WINAPI IRecordInfoImpl_RecordCreate(IRecordInfo *iface) static PVOID WINAPI IRecordInfoImpl_RecordCreate(IRecordInfo *iface)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -455,7 +460,7 @@ static PVOID WINAPI IRecordInfoImpl_RecordCreate(IRecordInfo *iface) ...@@ -455,7 +460,7 @@ static PVOID WINAPI IRecordInfoImpl_RecordCreate(IRecordInfo *iface)
static HRESULT WINAPI IRecordInfoImpl_RecordCreateCopy(IRecordInfo *iface, PVOID pvSource, static HRESULT WINAPI IRecordInfoImpl_RecordCreateCopy(IRecordInfo *iface, PVOID pvSource,
PVOID *ppvDest) PVOID *ppvDest)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
TRACE("(%p)->(%p %p)\n", This, pvSource, ppvDest); TRACE("(%p)->(%p %p)\n", This, pvSource, ppvDest);
...@@ -468,7 +473,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordCreateCopy(IRecordInfo *iface, PVOID ...@@ -468,7 +473,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordCreateCopy(IRecordInfo *iface, PVOID
static HRESULT WINAPI IRecordInfoImpl_RecordDestroy(IRecordInfo *iface, PVOID pvRecord) static HRESULT WINAPI IRecordInfoImpl_RecordDestroy(IRecordInfo *iface, PVOID pvRecord)
{ {
IRecordInfoImpl *This = (IRecordInfoImpl*)iface; IRecordInfoImpl *This = impl_from_IRecordInfo(iface);
HRESULT hres; HRESULT hres;
TRACE("(%p)->(%p)\n", This, pvRecord); TRACE("(%p)->(%p)\n", This, pvRecord);
...@@ -585,7 +590,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo ...@@ -585,7 +590,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
} }
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(*ret)); ret = HeapAlloc(GetProcessHeap(), 0, sizeof(*ret));
ret->lpVtbl = &IRecordInfoImplVtbl; ret->IRecordInfo_iface.lpVtbl = &IRecordInfoImplVtbl;
ret->ref = 1; ret->ref = 1;
ret->pTypeInfo = pTypeInfo; ret->pTypeInfo = pTypeInfo;
ret->n_vars = typeattr->cVars; ret->n_vars = typeattr->cVars;
...@@ -621,8 +626,8 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo ...@@ -621,8 +626,8 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
WARN("GetDocumentation failed: %08x\n", hres); WARN("GetDocumentation failed: %08x\n", hres);
ITypeInfo_ReleaseVarDesc(pTypeInfo, vardesc); ITypeInfo_ReleaseVarDesc(pTypeInfo, vardesc);
} }
*ppRecInfo = (IRecordInfo*)ret; *ppRecInfo = &ret->IRecordInfo_iface;
return S_OK; return S_OK;
} }
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