[PATCH 2/2] dsound: Simplify duplex code

Alexandre Julliard julliard at winehq.org
Mon Nov 16 08:00:16 CST 2009


Maarten Lankhorst <m.b.lankhorst at gmail.com> writes:

> @@ -48,37 +50,20 @@ typedef struct IDirectSoundFullDuplexImpl
>  
>      /* IDirectSoundFullDuplexImpl fields */
>      DirectSoundDevice                *renderer_device;
> -    DirectSoundCaptureDevice         *capture_device;
> -
> -    LPUNKNOWN                         pUnknown;
> -    LPDIRECTSOUND                     pDS;
> -    LPDIRECTSOUND8                    pDS8;
> -    LPDIRECTSOUNDCAPTURE              pDSC;
> +    IDirectSoundCapture *capture_device;
> +
> +    const IUnknownVtbl *lpUnkVtbl;
> +    const IDirectSoundVtbl *lpDSVtbl;
> +    const IDirectSound8Vtbl *lpDS8Vtbl;
> +    const IDirectSoundCaptureVtbl *lpDSCVtbl;
> +    LONG unk_ref;
> +    LONG ds_ref;
> +    LONG ds8_ref;
> +    LONG dsc_ref;
>  } IDirectSoundFullDuplexImpl;
>  
> -typedef struct IDirectSoundFullDuplex_IUnknown {
> -    const IUnknownVtbl         *lpVtbl;
> -    LONG                        ref;
> -    IDirectSoundFullDuplexImpl *pdsfd;
> -} IDirectSoundFullDuplex_IUnknown;
> -
> -typedef struct IDirectSoundFullDuplex_IDirectSound {
> -    const IDirectSoundVtbl     *lpVtbl;
> -    LONG                        ref;
> -    IDirectSoundFullDuplexImpl *pdsfd;
> -} IDirectSoundFullDuplex_IDirectSound;
> -
> -typedef struct IDirectSoundFullDuplex_IDirectSound8 {
> -    const IDirectSound8Vtbl    *lpVtbl;
> -    LONG                        ref;
> -    IDirectSoundFullDuplexImpl *pdsfd;
> -} IDirectSoundFullDuplex_IDirectSound8;
> -
> -typedef struct IDirectSoundFullDuplex_IDirectSoundCapture {
> -    const IDirectSoundCaptureVtbl *lpVtbl;
> -    LONG                           ref;
> -    IDirectSoundFullDuplexImpl    *pdsfd;
> -} IDirectSoundFullDuplex_IDirectSoundCapture;
> +#define ICOM_THIS_MULTI(impl,field,iface) \
> +    impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))

Please define inline functions instead of ICOM_THIS_MULTI. Also the
IUnknown vtable is most likely unnecessary.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list