qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Re: [4363] MusicPal: fix gcc4 build (Jan Kiszka).


From: andrzej zaborowski
Subject: Re: [Qemu-devel] Re: [4363] MusicPal: fix gcc4 build (Jan Kiszka).
Date: Wed, 7 May 2008 13:39:57 +0200

On 06/05/2008, Jan Kiszka <address@hidden> wrote:
> Paul Brook wrote:
>  >> -    int16_t *codec_buffer, *mem_buffer;
>  >> +    int16_t *codec_buffer;
>  >> +    void *mem_buffer;
>  >> ...
>  >> +                mem_buffer += 2;
>  >
>  > I really dislike doing arithmetic on a void*.
>
>
> Only fair. Version below should be better (in several ways).
>
>  Index: qemu/hw/musicpal.c
>  ===================================================================
>  --- qemu/hw/musicpal.c  (Revision 4365)
>  +++ qemu/hw/musicpal.c  (Arbeitskopie)
>  @@ -256,7 +256,7 @@ static void audio_callback(void *opaque,
>
>  {
>      musicpal_audio_state *s = opaque;
>
>      int16_t *codec_buffer;
>  -    void *mem_buffer;
>
> +    int8_t *mem_buffer;

Well, s->targer_buffer is already void * and you have

    mem_buffer = s->target_buffer + s->play_pos;

I'm not sure what's wrong with void * arithmetics though. They are
specified (somewhere) to work as if the type was a char *, and the
only annoyance is that you have to remember that.

Cheers




reply via email to

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