qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/7] audio: Let HWVoice write() handlers take a const buffer


From: Volker Rümelin
Subject: Re: [PATCH 5/7] audio: Let HWVoice write() handlers take a const buffer
Date: Wed, 6 May 2020 08:22:09 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

> diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
> index 4cdf19ab67..bba6bafda4 100644
> --- a/audio/dsoundaudio.c
> +++ b/audio/dsoundaudio.c
> @@ -454,7 +454,7 @@ static void *dsound_get_buffer_out(HWVoiceOut *hw, size_t 
> *size)
>      return ret;
>  }
>  
> -static size_t dsound_put_buffer_out(HWVoiceOut *hw, void *buf, size_t len)
> +static size_t dsound_put_buffer_out(HWVoiceOut *hw, const void *buf, size_t 
> len)
>  {
>      DSoundVoiceOut *ds = (DSoundVoiceOut *) hw;
>      LPDIRECTSOUNDBUFFER dsb = ds->dsound_buffer;

You forgot to make the buffer const in dsound_put_buffer_in().

I had to cast buf to LPVOID in dsound_get_buffer_in() and 
dsound_put_buffer_in() because otherwise I see:

C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c: In function 
'dsound_put_buffer_out':
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c:466:38: error: passing 
argument 2 of 'dsound_unlock_out' discards 'const' qualifier from pointer 
target type [-Werror=discarded-qualifiers]
  466 |     int err = dsound_unlock_out(dsb, buf, NULL, len, 0);
      |                                      ^~~
In file included from 
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c:266:
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsound_template.h:48:12: note: 
expected 'LPVOID' {aka 'void *'} but argument is of type 'const void *'
   48 |     LPVOID p1,
      |     ~~~~~~~^~
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c: In function 
'dsound_put_buffer_in':
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c:571:38: error: passing 
argument 2 of 'dsound_unlock_in' discards 'const' qualifier from pointer target 
type [-Werror=discarded-qualifiers]
  571 |     int err = dsound_unlock_in(dscb, buf, NULL, len, 0);
      |                                      ^~~
In file included from 
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c:268:
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsound_template.h:48:12: note: 
expected 'LPVOID' {aka 'void *'} but argument is of type 'const void *'
   48 |     LPVOID p1,
      |     ~~~~~~~^~

With best regards,
Volker



reply via email to

[Prev in Thread] Current Thread [Next in Thread]