Commit 8b6842bb authored by Damien Fouilleul's avatar Damien Fouilleul

- all: fixed object interfaces queries and other fixes as reported by Jacob Lewallen

parent 9a7fb07f
......@@ -101,7 +101,7 @@ STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
pUnk->AddRef();
cd.pUnk = pUnk;
*pdwCookie = cd.dwCookie = _connections.size();
*pdwCookie = cd.dwCookie = _connections.size()+1;
_connections.push_back(cd);
......@@ -110,9 +110,9 @@ STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie)
{
if( pdwCookie < _connections.size() )
if( (0 < pdwCookie) && (pdwCookie <= _connections.size()) )
{
CONNECTDATA cd = _connections[pdwCookie];
CONNECTDATA cd = _connections[pdwCookie-1];
if( NULL != cd.pUnk )
{
cd.pUnk->Release();
......
......@@ -39,9 +39,11 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv ) return E_POINTER;
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
&& (IID_IConnectionPoint == riid) ) {
|| (IID_IConnectionPoint == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
......@@ -95,9 +97,11 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IConnectionPointContainer == riid) ) {
if( NULL == ppv)
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IConnectionPointContainer == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
......
......@@ -37,9 +37,10 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IDataObject == riid) ) {
if( NULL == ppv)
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDataObject == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
......
......@@ -67,9 +67,10 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IObjectSafety == riid) )
if( NULL == ppv)
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IObjectSafety == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
......
......@@ -36,9 +36,10 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleControl == riid) )
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IOleControl == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
......
......@@ -36,10 +36,11 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleWindow == riid)
&& (IID_IOleInPlaceActiveObject == riid) )
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IOleWindow == riid)
|| (IID_IOleInPlaceActiveObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
......
......@@ -34,10 +34,11 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleWindow == riid)
&& (IID_IOleInPlaceObject == riid) )
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IOleWindow == riid)
|| (IID_IOleInPlaceObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
......
......@@ -34,9 +34,10 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleObject == riid) )
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IOleObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
......
......@@ -36,10 +36,12 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistPropertyBag == riid) ) {
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IPersist == riid)
|| (IID_IPersistPropertyBag == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
......
......@@ -36,10 +36,12 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistStorage == riid) ) {
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IPersist == riid)
|| (IID_IPersistStorage == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
......
......@@ -213,7 +213,7 @@ public:
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
&& (IID_IPropertyBag == riid) )
|| (IID_IPropertyBag == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
......
......@@ -36,10 +36,12 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistStreamInit == riid) ) {
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IPersist == riid)
|| (IID_IPersistStreamInit == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
......
......@@ -180,7 +180,8 @@ STDMETHODIMP VLCPluginClass::QueryInterface(REFIID riid, void **ppv)
if( NULL == ppv )
return E_INVALIDARG;
if( (IID_IUnknown == riid) || (IID_IClassFactory == riid) )
if( (IID_IUnknown == riid)
|| (IID_IClassFactory == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
......
......@@ -36,10 +36,12 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IProvideClassInfo == riid)
&& (IID_IProvideClassInfo2 == riid) ) {
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IProvideClassInfo == riid)
|| (IID_IProvideClassInfo2 == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
......
......@@ -108,13 +108,16 @@ VLCEnum<T>& VLCEnum<T>::operator=(const VLCEnum<T> &e)
template<class T>
STDMETHODIMP VLCEnum<T>::QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv ) return E_POINTER;
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
&& ( _riid == riid) ) {
|| (_riid == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
// standalone object
return E_NOINTERFACE;
};
......
......@@ -37,11 +37,12 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IViewObject == riid)
&& (IID_IViewObject2 == riid) ) {
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IViewObject == riid)
|| (IID_IViewObject2 == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
......
......@@ -37,10 +37,12 @@ public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IDispatch == riid)
&& (IID_IVLCControl == riid) ) {
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCControl == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
......
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