From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jti0D-0006iU-1O for qemu-devel@nongnu.org; Wed, 07 May 2008 07:40:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jti08-0006hX-N8 for qemu-devel@nongnu.org; Wed, 07 May 2008 07:40:04 -0400 Received: from [199.232.76.173] (port=59870 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jti08-0006hU-FN for qemu-devel@nongnu.org; Wed, 07 May 2008 07:40:00 -0400 Received: from ug-out-1314.google.com ([66.249.92.169]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jti08-0008Oj-88 for qemu-devel@nongnu.org; Wed, 07 May 2008 07:40:00 -0400 Received: by ug-out-1314.google.com with SMTP id j40so129262ugd.4 for ; Wed, 07 May 2008 04:39:57 -0700 (PDT) Message-ID: Date: Wed, 7 May 2008 13:39:57 +0200 From: "andrzej zaborowski" Subject: Re: [Qemu-devel] Re: [4363] MusicPal: fix gcc4 build (Jan Kiszka). In-Reply-To: <4820810A.6060607@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200805061625.39329.paul@codesourcery.com> <4820810A.6060607@web.de> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 06/05/2008, Jan Kiszka 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