[Spice-devel] [spice-server 3/3] audio: Improve snd_receive type-safety
Pavel Grunt
pgrunt at redhat.com
Tue Apr 5 14:08:48 UTC 2016
On Tue, 2016-04-05 at 15:09 +0200, Christophe Fergeau wrote:
> We can pass it a SndChannel rather than an opaque void* data pointer
> which we then blindly cast.
> This came to light through a -Wshadow warning as there was a local
> variable 'data' in addition to the 'data' parameter.
Acked-by: Pavel Grunt <pgrunt at redhat.com>
> ---
> server/sound.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/server/sound.c b/server/sound.c
> index 7ec0c6a..46f2cb1 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -185,7 +185,7 @@ typedef struct RecordChannel {
> static SndWorker *workers;
> static uint32_t playback_compression = TRUE;
>
> -static void snd_receive(void* data);
> +static void snd_receive(SndChannel *channel);
>
> static SndChannel *snd_channel_ref(SndChannel *channel)
> {
> @@ -420,9 +420,8 @@ static int snd_record_handle_message(SndChannel
> *channel, size_t size, uint32_t
> return TRUE;
> }
>
> -static void snd_receive(void* data)
> +static void snd_receive(SndChannel *channel)
> {
> - SndChannel *channel = (SndChannel*)data;
> SpiceDataHeaderOpaque *header;
>
> if (!channel) {
> @@ -1364,7 +1363,7 @@ SPICE_GNUC_VISIBLE uint32_t
> spice_server_record_get_samples(SpiceRecordInstance
>
> if (len < bufsize) {
> SndWorker *worker = record_channel->base.worker;
> - snd_receive(record_channel);
> + snd_receive(&record_channel->base);
> if (!worker->connection) {
> return 0;
> }
More information about the Spice-devel
mailing list