[PATCH 2/3] winepulse: Return offsets rather than ptrs to the strings.

Andrew Eikum aeikum at codeweavers.com
Thu Apr 14 14:38:29 CDT 2022


On Thu, Apr 14, 2022 at 10:03:10AM +0100, Huw Davies wrote:
> --- a/dlls/winepulse.drv/mmdevdrv.c
> +++ b/dlls/winepulse.drv/mmdevdrv.c
> @@ -457,13 +457,16 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids_out, GUID **ke
>      }
>  
>      for (i = 0; i < params.num; i++) {
> -        unsigned int size = (wcslen(params.endpoints[i].name) + 1) * sizeof(WCHAR);
> +        WCHAR *name = (WCHAR *)((char *)params.endpoints + params.endpoints[i].name);
> +        char *pulse_name = (char *)params.endpoints + params.endpoints[i].pulse_name;

It's unfortunate that we're losing type checking, both here and in the
"use handles" patch:

> diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
> index 7b5ef7cfe39..96b8b28d1b5 100644
> --- a/dlls/winepulse.drv/mmdevdrv.c
> +++ b/dlls/winepulse.drv/mmdevdrv.c
> @@ -156,7 +156,7 @@ struct ACImpl {
>      UINT32 channel_count;
>      HANDLE timer;
>  
> -    struct pulse_stream *pulse_stream;
> +    unsigned int pulse_stream;
>  
>      AudioSession *session;
>      AudioSessionWrapper *session_wrapper;

Is there any way we could get compile-time type checking back? Using
typedefs or something...?

Andrew



More information about the wine-devel mailing list