Browse Source

Fix for compiler error in camera code.

tags/2021-05-28
jules 13 years ago
parent
commit
35991fb01c
4 changed files with 38 additions and 15 deletions
  1. +10
    -10
      modules/juce_browser_plugin/wrapper/juce_ActiveX_GlueCode.cpp
  2. +18
    -4
      modules/juce_core/native/juce_win32_ComSmartPtr.h
  3. +2
    -1
      modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp
  4. +8
    -0
      modules/juce_video/native/juce_win32_CameraDevice.cpp

+ 10
- 10
modules/juce_browser_plugin/wrapper/juce_ActiveX_GlueCode.cpp View File

@@ -175,8 +175,8 @@ public:
HRESULT __stdcall QueryInterface (REFIID id, void __RPC_FAR* __RPC_FAR* result) 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; *result = 0;
return E_NOINTERFACE; return E_NOINTERFACE;
@@ -595,12 +595,12 @@ public:
HRESULT __stdcall QueryInterface (REFIID id, void __RPC_FAR* __RPC_FAR* result) 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; *result = 0;
return E_NOINTERFACE; return E_NOINTERFACE;
@@ -754,8 +754,8 @@ public:
HRESULT __stdcall QueryInterface (REFIID id, void __RPC_FAR* __RPC_FAR* result) 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; *result = nullptr;
return E_NOINTERFACE; return E_NOINTERFACE;


+ 18
- 4
modules/juce_core/native/juce_win32_ComSmartPtr.h View File

@@ -105,6 +105,21 @@ public:
protected: protected:
ULONG refCount; 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. /** 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) 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);
} }
}; };


+ 2
- 1
modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp View File

@@ -40,7 +40,8 @@ namespace DirectWriteTypeLayout
JUCE_COMRESULT QueryInterface (REFIID refId, void** result) 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); return ComBaseClassHelper<IDWriteTextRenderer>::QueryInterface (refId, result);
} }


+ 8
- 0
modules/juce_video/native/juce_win32_CameraDevice.cpp View File

@@ -680,6 +680,14 @@ private:
GrabberCallback (DShowCameraDeviceInteral& cam) GrabberCallback (DShowCameraDeviceInteral& cam)
: ComBaseClassHelperBase <ISampleGrabberCB> (0), owner (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 SampleCB (double, IMediaSample*) { return E_FAIL; }
STDMETHODIMP BufferCB (double time, BYTE* buffer, long bufferSize) STDMETHODIMP BufferCB (double time, BYTE* buffer, long bufferSize)


Loading…
Cancel
Save