ole32: Use IsEqualIID rather than memcmp.

This commit is contained in:
Huw Davies 2009-03-17 14:33:33 +00:00 committed by Alexandre Julliard
parent 319d0ddca6
commit c0fbbe7d91
1 changed files with 4 additions and 20 deletions

View File

@ -730,40 +730,24 @@ static HRESULT WINAPI OLEClipbrd_IDataObject_QueryInterface(
void** ppvObject) void** ppvObject)
{ {
ole_clipbrd *This = impl_from_IDataObject(iface); ole_clipbrd *This = impl_from_IDataObject(iface);
TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObject); TRACE("(%p)->(IID:%s, %p)\n", This, debugstr_guid(riid), ppvObject);
/*
* Perform a sanity check on the parameters.
*/
if ( (This==0) || (ppvObject==0) ) if ( (This==0) || (ppvObject==0) )
return E_INVALIDARG; return E_INVALIDARG;
/*
* Initialize the return parameter.
*/
*ppvObject = 0; *ppvObject = 0;
/* if (IsEqualIID(&IID_IUnknown, riid) ||
* Compare the riid with the interface IDs implemented by this object. IsEqualIID(&IID_IDataObject, riid))
*/
if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
{ {
*ppvObject = iface; *ppvObject = iface;
} }
else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) else
{
*ppvObject = &This->lpvtbl;
}
else /* We only support IUnknown and IDataObject */
{ {
WARN( "() : asking for unsupported interface %s\n", debugstr_guid(riid)); WARN( "() : asking for unsupported interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE; return E_NOINTERFACE;
} }
/*
* Query Interface always increases the reference count by one when it is
* successful.
*/
IUnknown_AddRef((IUnknown*)*ppvObject); IUnknown_AddRef((IUnknown*)*ppvObject);
return S_OK; return S_OK;