qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "andrzej zaborowski" <balrogg@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [4363] MusicPal: fix gcc4 build (Jan Kiszka).
Date: Wed, 7 May 2008 13:39:57 +0200	[thread overview]
Message-ID: <fb249edb0805070439x333212dkb99856e58c97e20b@mail.gmail.com> (raw)
In-Reply-To: <4820810A.6060607@web.de>

On 06/05/2008, Jan Kiszka <jan.kiszka@web.de> 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	other threads:[~2008-05-07 11:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-06 15:01 [Qemu-devel] [4363] MusicPal: fix gcc4 build (Jan Kiszka) Andrzej Zaborowski
2008-05-06 15:25 ` Paul Brook
2008-05-06 16:02   ` [Qemu-devel] " Jan Kiszka
2008-05-07 11:39     ` andrzej zaborowski [this message]
2008-05-07 11:53       ` Paul Brook
2008-05-07 12:01         ` Daniel P. Berrange
2008-05-07 12:26           ` Andreas Schwab
2008-05-07 12:04         ` Andreas Schwab
2008-05-07 13:53         ` andrzej zaborowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb249edb0805070439x333212dkb99856e58c97e20b@mail.gmail.com \
    --to=balrogg@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).