[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
- [PATCH 0/7] audio: Spring cleaning, Philippe Mathieu-Daudé, 2020/05/05
- [PATCH 2/7] audio: Let capture_callback handler use const buffer argument, Philippe Mathieu-Daudé, 2020/05/05
- [PATCH 1/7] audio: Let audio_sample_to_uint64() use const samples argument, Philippe Mathieu-Daudé, 2020/05/05
- [PATCH 3/7] audio: Move advance() helper to 'audio_int.h', Philippe Mathieu-Daudé, 2020/05/05
- [PATCH 4/7] audio: Split advance() helper as in() and out(), Philippe Mathieu-Daudé, 2020/05/05
- [PATCH 5/7] audio: Let HWVoice write() handlers take a const buffer, Philippe Mathieu-Daudé, 2020/05/05
- Re: [PATCH 5/7] audio: Let HWVoice write() handlers take a const buffer,
Volker Rümelin <=
- [PATCH 6/7] audio: Let AUD_write() use a const buffer argument, Philippe Mathieu-Daudé, 2020/05/05
- [PATCH 7/7] audio: Expose 'audio/audio.h' under the include/ directory, Philippe Mathieu-Daudé, 2020/05/05
- Re: [PATCH 0/7] audio: Spring cleaning, Philippe Mathieu-Daudé, 2020/05/26