1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fix for compiler error in camera code.

This commit is contained in:
jules 2012-12-22 18:06:44 +00:00
parent 5d35a31f2e
commit 35991fb01c
4 changed files with 38 additions and 15 deletions

View file

@ -175,8 +175,8 @@ public:
HRESULT __stdcall QueryInterface (REFIID id, void __RPC_FAR* __RPC_FAR* result)
{
if (id == IID_IUnknown) { AddRef(); *result = (IUnknown*) this; return S_OK; }
else if (id == IID_IDispatch) { AddRef(); *result = (IDispatch*) this; return S_OK; }
if (id == IID_IUnknown) { AddRef(); *result = (IUnknown*) this; return S_OK; }
if (id == IID_IDispatch) { AddRef(); *result = (IDispatch*) this; return S_OK; }
*result = 0;
return E_NOINTERFACE;
@ -595,12 +595,12 @@ public:
HRESULT __stdcall QueryInterface (REFIID id, void __RPC_FAR* __RPC_FAR* result)
{
if (id == IID_IUnknown) { AddRef(); *result = (IUnknown*) this; return S_OK; }
else if (id == IID_IDispatch) { AddRef(); *result = (IDispatch*) this; return S_OK; }
else if (id == IID_IObjectWithSite) { AddRef(); *result = (IObjectWithSite*) this; return S_OK; }
else if (id == IID_IObjectSafety) { AddRef(); *result = (IObjectSafety*) this; return S_OK; }
else if (id == IID_IOleInPlaceObject) { AddRef(); *result = (IOleInPlaceObject*) this; return S_OK; }
else if (id == IID_IOleWindow) { AddRef(); *result = (IOleWindow*) (IOleInPlaceObject*) this; return S_OK; }
if (id == IID_IUnknown) { AddRef(); *result = (IUnknown*) this; return S_OK; }
if (id == IID_IDispatch) { AddRef(); *result = (IDispatch*) this; return S_OK; }
if (id == IID_IObjectWithSite) { AddRef(); *result = (IObjectWithSite*) this; return S_OK; }
if (id == IID_IObjectSafety) { AddRef(); *result = (IObjectSafety*) this; return S_OK; }
if (id == IID_IOleInPlaceObject) { AddRef(); *result = (IOleInPlaceObject*) this; return S_OK; }
if (id == IID_IOleWindow) { AddRef(); *result = (IOleWindow*) (IOleInPlaceObject*) this; return S_OK; }
*result = 0;
return E_NOINTERFACE;
@ -754,8 +754,8 @@ public:
HRESULT __stdcall QueryInterface (REFIID id, void __RPC_FAR* __RPC_FAR* result)
{
if (id == IID_IUnknown) { AddRef(); *result = (IUnknown*) this; return S_OK; }
else if (id == IID_IClassFactory) { AddRef(); *result = (IClassFactory*) this; return S_OK; }
if (id == IID_IUnknown) { AddRef(); *result = (IUnknown*) this; return S_OK; }
if (id == IID_IClassFactory) { AddRef(); *result = (IClassFactory*) this; return S_OK; }
*result = nullptr;
return E_NOINTERFACE;

View file

@ -105,6 +105,21 @@ public:
protected:
ULONG refCount;
JUCE_COMRESULT QueryInterface (REFIID refId, void** result)
{
if (refId == IID_IUnknown)
return castToType <IUnknown> (result);
*result = 0;
return E_NOINTERFACE;
}
template <class Type>
JUCE_COMRESULT castToType (void** result)
{
this->AddRef(); *result = dynamic_cast <Type*> (this); return S_OK;
}
};
/** Handy base class for writing COM objects, providing ref-counting and a basic QueryInterface method.
@ -118,11 +133,10 @@ public:
JUCE_COMRESULT QueryInterface (REFIID refId, void** result)
{
if (refId == __uuidof (ComClass)) { this->AddRef(); *result = dynamic_cast <ComClass*> (this); return S_OK; }
if (refId == IID_IUnknown) { this->AddRef(); *result = dynamic_cast <IUnknown*> (this); return S_OK; }
if (refId == __uuidof (ComClass))
return castToType <ComClass> (result);
*result = 0;
return E_NOINTERFACE;
return ComBaseClassHelperBase <ComClass>::QueryInterface (refId, result);
}
};

View file

@ -40,7 +40,8 @@ namespace DirectWriteTypeLayout
JUCE_COMRESULT QueryInterface (REFIID refId, void** result)
{
if (refId == __uuidof (IDWritePixelSnapping)) { AddRef(); *result = dynamic_cast <IDWritePixelSnapping*> (this); return S_OK; }
if (refId == __uuidof (IDWritePixelSnapping))
return castToType <IDWritePixelSnapping> (result);
return ComBaseClassHelper<IDWriteTextRenderer>::QueryInterface (refId, result);
}

View file

@ -680,6 +680,14 @@ private:
GrabberCallback (DShowCameraDeviceInteral& cam)
: ComBaseClassHelperBase <ISampleGrabberCB> (0), owner (cam) {}
JUCE_COMRESULT QueryInterface (REFIID refId, void** result)
{
if (refId == IID_ISampleGrabberCB)
return castToType <ISampleGrabberCB> (result);
return ComBaseClassHelperBase<ISampleGrabberCB>::QueryInterface (refId, result);
}
STDMETHODIMP SampleCB (double, IMediaSample*) { return E_FAIL; }
STDMETHODIMP BufferCB (double time, BYTE* buffer, long bufferSize)