diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-05-07 13:52:48 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-05-07 13:52:48 +0000 |
commit | a350e694245c1ce9492c67db83e1fd325e767769 (patch) | |
tree | aa18ef90010abc612d467fff0d23b58be5936489 /hw | |
parent | 58565070ee887c9f7285e6d9e169179dddebdb53 (diff) |
Avoid arithmetics on void * in MusicPal audio code (Jan Kiszka).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4373 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r-- | hw/musicpal.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/hw/musicpal.c b/hw/musicpal.c index 2b60752636..a9e576754a 100644 --- a/hw/musicpal.c +++ b/hw/musicpal.c @@ -244,7 +244,7 @@ typedef struct musicpal_audio_state { 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 @@ static void audio_callback(void *opaque, int free_out, int free_in) { 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 @@ static void audio_callback(void *opaque, int free_out, int free_in) 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 @@ static void audio_callback(void *opaque, int free_out, int free_in) 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++); } } } |