<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'Monospace'; font-size:9pt; font-weight:400; font-style:normal;">On Monday 21 December 2009 05:05:25 pm Alexandre Julliard wrote:<br>
&gt; Paul Chitescu &lt;paulc@voip.null.ro&gt; writes:<br>
&gt; <br>
&gt; &gt; Changelog:<br>
&gt; &gt;         qedit.dll: Add minimal stubs for NullRenderer and SampleGrabber.<br>
&gt; &gt;<br>
&gt; &gt; It doesn't make much sense to break this patch in two since most applications <br>
&gt; &gt; connect a SampleGrabber to a NullRenderer to capture frames.<br>
&gt; <br>
&gt; That doesn't mean you can't split the patch.<br>
&gt; <br>
&gt; &gt; +#define DEF_COMMON(iface)\<br>
&gt; &gt; +static ULONG WINAPI NullRenderer_ ## iface ## _AddRef(iface *ptr)\<br>
&gt; &gt; +{\<br>
&gt; &gt; +    return InterlockedIncrement(&amp;GET_THIS(ptr,iface)-&gt;refCount);\<br>
&gt; &gt; +}\<br>
&gt; &gt; +static ULONG WINAPI NullRenderer_ ## iface ## _Release(iface *ptr)\<br>
&gt; &gt; +{\<br>
&gt; &gt; +    NR_Impl *This = GET_THIS(ptr,iface);\<br>
&gt; &gt; +    ULONG refCount = InterlockedDecrement(&amp;This-&gt;refCount);\<br>
&gt; &gt; +    if (refCount == 0) \<br>
&gt; &gt; +    {\<br>
&gt; &gt; +        NullRenderer_cleanup(This);\<br>
&gt; &gt; +        CoTaskMemFree(This);\<br>
&gt; &gt; +        return 0;\<br>
&gt; &gt; +    }\<br>
&gt; &gt; +    return refCount;\<br>
&gt; &gt; +}\<br>
&gt; &gt; +static HRESULT WINAPI NullRenderer_ ## iface ## _QueryInterface(iface *ptr, REFIID riid, void **ppvObject)\<br>
&gt; &gt; +{\<br>
&gt; &gt; +    return NullRenderer_query(GET_THIS(ptr,iface), riid, ppvObject);\<br>
&gt; &gt; +}<br>
&gt; &gt; +<br>
&gt; &gt; +/* Macro to put common IUnknown pointers in interface's vtable */<br>
&gt; &gt; +#define VTBL_COMMON(iface)\<br>
&gt; &gt; +NullRenderer_ ## iface ## _QueryInterface,\<br>
&gt; &gt; +NullRenderer_ ## iface ## _AddRef,\<br>
&gt; &gt; +NullRenderer_ ## iface ## _Release,<br>
&gt; <br>
&gt; Please don't add ugly macros like those, spell things out explicitly.<br>
&gt; <br>
&gt; -- <br>
&gt; Alexandre Julliard<br>
&gt; julliard@winehq.org<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>I'll split it.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>About the macros - were you talking about the VTBL_COMMON which is pretty short or DEF_COMMON which is long and would cause the source code to grow unnecessarily? There are more interfaces to be implemented and I find easier to mantain _one_ macro rather than 6 copies of same code.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Paul<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p></body></html>