Piotr Caban : strmbase: Add structure size parameter in BaseInputPin_Construct function.

Alexandre Julliard julliard at winehq.org
Mon Nov 25 13:33:16 CST 2013


Module: wine
Branch: master
Commit: 5c8339df4a8d9cd095827a8f57b65823c3edf58a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5c8339df4a8d9cd095827a8f57b65823c3edf58a

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Nov 25 16:28:50 2013 +0100

strmbase: Add structure size parameter in BaseInputPin_Construct function.

---

 dlls/amstream/mediastreamfilter.c |    3 ++-
 dlls/strmbase/pin.c               |    5 +++--
 dlls/strmbase/renderer.c          |    3 ++-
 dlls/strmbase/transform.c         |    3 ++-
 include/wine/strmbase.h           |    4 +++-
 5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/dlls/amstream/mediastreamfilter.c b/dlls/amstream/mediastreamfilter.c
index 49ee6fe..defabd9 100644
--- a/dlls/amstream/mediastreamfilter.c
+++ b/dlls/amstream/mediastreamfilter.c
@@ -367,7 +367,8 @@ static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* i
     /* Pin name is "I{guid MSPID_PrimaryVideo or MSPID_PrimaryAudio}" */
     info.achName[0] = 'I';
     StringFromGUID2(&purpose_id, info.achName + 1, 40);
-    hr = BaseInputPin_Construct(&MediaStreamFilter_InputPin_Vtbl, &info, &input_BaseFuncTable, &input_BaseInputFuncTable, &This->filter.csFilter, NULL, &This->pins[This->nb_streams]);
+    hr = BaseInputPin_Construct(&MediaStreamFilter_InputPin_Vtbl, sizeof(BaseInputPin), &info, &input_BaseFuncTable,
+            &input_BaseInputFuncTable, &This->filter.csFilter, NULL, &This->pins[This->nb_streams]);
     if (FAILED(hr))
         return hr;
 
diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c
index 750752e..d99a0bb 100644
--- a/dlls/strmbase/pin.c
+++ b/dlls/strmbase/pin.c
@@ -1237,7 +1237,7 @@ static HRESULT InputPin_Init(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPi
     return S_OK;
 }
 
-HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo,
+HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO * pPinInfo,
                                const BasePinFuncTable* pBaseFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable,
                                LPCRITICAL_SECTION pCritSec, IMemAllocator *allocator, IPin ** ppPin)
 {
@@ -1245,6 +1245,7 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * p
 
     *ppPin = NULL;
 
+    assert(inputpin_size >= sizeof(BaseInputPin));
     assert(pBaseFuncsTable->pfnCheckMediaType);
 
     if (pPinInfo->dir != PINDIR_INPUT)
@@ -1253,7 +1254,7 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * p
         return E_INVALIDARG;
     }
 
-    pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl));
+    pPinImpl = CoTaskMemAlloc(inputpin_size);
 
     if (!pPinImpl)
         return E_OUTOFMEMORY;
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c
index 8bbb1f8..56f72f1 100644
--- a/dlls/strmbase/renderer.c
+++ b/dlls/strmbase/renderer.c
@@ -253,7 +253,8 @@ HRESULT WINAPI BaseRenderer_Init(BaseRenderer * This, const IBaseFilterVtbl *Vtb
     piInput.pFilter = &This->filter.IBaseFilter_iface;
     lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
 
-    hr = BaseInputPin_Construct(&BaseRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &This->filter.csFilter, NULL, (IPin **)&This->pInputPin);
+    hr = BaseInputPin_Construct(&BaseRenderer_InputPin_Vtbl, sizeof(BaseInputPin), &piInput, &input_BaseFuncTable,
+            &input_BaseInputFuncTable, &This->filter.csFilter, NULL, (IPin **)&This->pInputPin);
 
     if (SUCCEEDED(hr))
     {
diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c
index df72d99..2290bed 100644
--- a/dlls/strmbase/transform.c
+++ b/dlls/strmbase/transform.c
@@ -225,7 +225,8 @@ static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* p
     piOutput.pFilter = &pTransformFilter->filter.IBaseFilter_iface;
     lstrcpynW(piOutput.achName, wcsOutputPinName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0]));
 
-    hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, &piInput, &tf_input_BaseFuncTable, &tf_input_BaseInputFuncTable, &pTransformFilter->filter.csFilter, NULL, &pTransformFilter->ppPins[0]);
+    hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, sizeof(BaseInputPin), &piInput, &tf_input_BaseFuncTable,
+            &tf_input_BaseInputFuncTable, &pTransformFilter->filter.csFilter, NULL, &pTransformFilter->ppPins[0]);
 
     if (SUCCEEDED(hr))
     {
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index ecb53c4..b2046d4 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -145,7 +145,9 @@ HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface);
 HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface);
 HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
 
-HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, const BasePinFuncTable* pBaseFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
+HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO * pPinInfo,
+        const BasePinFuncTable* pBaseFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable,
+        LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
 
 typedef struct BaseFilter
 {




More information about the wine-cvs mailing list