qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrzej Zaborowski <balrogg@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [4373] Avoid arithmetics on void * in MusicPal audio code (Jan Kiszka).
Date: Wed, 07 May 2008 13:52:49 +0000	[thread overview]
Message-ID: <E1Jtk4f-00076e-4G@cvs.savannah.gnu.org> (raw)

Revision: 4373
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4373
Author:   balrog
Date:     2008-05-07 13:52:48 +0000 (Wed, 07 May 2008)

Log Message:
-----------
Avoid arithmetics on void * in MusicPal audio code (Jan Kiszka).

Modified Paths:
--------------
    trunk/hw/musicpal.c

Modified: trunk/hw/musicpal.c
===================================================================
--- trunk/hw/musicpal.c	2008-05-07 13:47:01 UTC (rev 4372)
+++ trunk/hw/musicpal.c	2008-05-07 13:52:48 UTC (rev 4373)
@@ -244,7 +244,7 @@
     uint32_t status;
     uint32_t irq_enable;
     unsigned long phys_buf;
-    void *target_buffer;
+    int8_t *target_buffer;
     unsigned int threshold;
     unsigned int play_pos;
     unsigned int last_free;
@@ -256,7 +256,7 @@
 {
     musicpal_audio_state *s = opaque;
     int16_t *codec_buffer;
-    void *mem_buffer;
+    int8_t *mem_buffer;
     int pos, block_size;
 
     if (!(s->playback_mode & MP_AUDIO_PLAYBACK_EN))
@@ -277,8 +277,8 @@
         if (s->playback_mode & MP_AUDIO_MONO) {
             codec_buffer = wm8750_dac_buffer(s->wm, block_size >> 1);
             for (pos = 0; pos < block_size; pos += 2) {
-                *codec_buffer++ = *(uint16_t *)mem_buffer;
-                *codec_buffer++ = *(uint16_t *)mem_buffer;
+                *codec_buffer++ = *(int16_t *)mem_buffer;
+                *codec_buffer++ = *(int16_t *)mem_buffer;
                 mem_buffer += 2;
             }
         } else
@@ -288,14 +288,14 @@
         if (s->playback_mode & MP_AUDIO_MONO) {
             codec_buffer = wm8750_dac_buffer(s->wm, block_size);
             for (pos = 0; pos < block_size; pos++) {
-                *codec_buffer++ = cpu_to_le16(256 * *(int8_t *)mem_buffer);
-                *codec_buffer++ = cpu_to_le16(256 * *(int8_t *)mem_buffer++);
+                *codec_buffer++ = cpu_to_le16(256 * *mem_buffer);
+                *codec_buffer++ = cpu_to_le16(256 * *mem_buffer++);
             }
         } else {
             codec_buffer = wm8750_dac_buffer(s->wm, block_size >> 1);
             for (pos = 0; pos < block_size; pos += 2) {
-                *codec_buffer++ = cpu_to_le16(256 * *(int8_t *)mem_buffer++);
-                *codec_buffer++ = cpu_to_le16(256 * *(int8_t *)mem_buffer++);
+                *codec_buffer++ = cpu_to_le16(256 * *mem_buffer++);
+                *codec_buffer++ = cpu_to_le16(256 * *mem_buffer++);
             }
         }
     }

                 reply	other threads:[~2008-05-07 13:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1Jtk4f-00076e-4G@cvs.savannah.gnu.org \
    --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).