<!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>
> Paul Chitescu <paulc@voip.null.ro> writes:<br>
> <br>
> > Changelog:<br>
> >         qedit.dll: Add minimal stubs for NullRenderer and SampleGrabber.<br>
> ><br>
> > It doesn't make much sense to break this patch in two since most applications <br>
> > connect a SampleGrabber to a NullRenderer to capture frames.<br>
> <br>
> That doesn't mean you can't split the patch.<br>
> <br>
> > +#define DEF_COMMON(iface)\<br>
> > +static ULONG WINAPI NullRenderer_ ## iface ## _AddRef(iface *ptr)\<br>
> > +{\<br>
> > + return InterlockedIncrement(&GET_THIS(ptr,iface)->refCount);\<br>
> > +}\<br>
> > +static ULONG WINAPI NullRenderer_ ## iface ## _Release(iface *ptr)\<br>
> > +{\<br>
> > + NR_Impl *This = GET_THIS(ptr,iface);\<br>
> > + ULONG refCount = InterlockedDecrement(&This->refCount);\<br>
> > + if (refCount == 0) \<br>
> > + {\<br>
> > + NullRenderer_cleanup(This);\<br>
> > + CoTaskMemFree(This);\<br>
> > + return 0;\<br>
> > + }\<br>
> > + return refCount;\<br>
> > +}\<br>
> > +static HRESULT WINAPI NullRenderer_ ## iface ## _QueryInterface(iface *ptr, REFIID riid, void **ppvObject)\<br>
> > +{\<br>
> > + return NullRenderer_query(GET_THIS(ptr,iface), riid, ppvObject);\<br>
> > +}<br>
> > +<br>
> > +/* Macro to put common IUnknown pointers in interface's vtable */<br>
> > +#define VTBL_COMMON(iface)\<br>
> > +NullRenderer_ ## iface ## _QueryInterface,\<br>
> > +NullRenderer_ ## iface ## _AddRef,\<br>
> > +NullRenderer_ ## iface ## _Release,<br>
> <br>
> Please don't add ugly macros like those, spell things out explicitly.<br>
> <br>
> -- <br>
> Alexandre Julliard<br>
> 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>