[Swfdec] test/sound test/swfdec-extract.c
Benjamin Otte
company at kemper.freedesktop.org
Mon Dec 10 13:41:51 PST 2007
test/sound/downsample.c | 8 ++++----
test/swfdec-extract.c | 18 +++++++++---------
2 files changed, 13 insertions(+), 13 deletions(-)
New commits:
commit 9fbece5af176e4d1153200560901541107e6dc27
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Dec 10 22:41:45 2007 +0100
silence alignment warnings in tests
diff --git a/test/sound/downsample.c b/test/sound/downsample.c
index 4e05d06..f8619cd 100644
--- a/test/sound/downsample.c
+++ b/test/sound/downsample.c
@@ -124,15 +124,15 @@ main (int argc, char **argv)
}
length /= 4;
copy = g_malloc (length * 2);
- convert_le_be ((gint16 *) data, length * 2);
+ convert_le_be ((void *) data, length * 2);
- if (downsample_to_mono ((gint16 *) copy, (gint16 *) data, length)) {
+ if (downsample_to_mono ((void *) copy, (void *) data, length)) {
guint rate;
char *tmp = data;
data = copy;
copy = tmp;
for (rate = 44100; rate > 5512 && length % 2 == 0; rate /= 2) {
- if (!downsample_rate_mono ((gint16 *) copy, (gint16 *) data, length / 2))
+ if (!downsample_rate_mono ((void *) copy, (void *) data, length / 2))
break;
length /= 2;
g_print ("Info: downsampling from %u => %u successful\n", rate, rate / 2);
@@ -151,7 +151,7 @@ main (int argc, char **argv)
length = cut_silence (data, length / 2, 4);
}
- convert_le_be ((gint16 *) data, length);
+ convert_le_be ((void *) data, length);
length *= 2;
if (!g_file_set_contents (argv[2], data, length, &error)) {
g_printerr ("Error: %s\n", error->message);
diff --git a/test/swfdec-extract.c b/test/swfdec-extract.c
index cdc74a7..8a36820 100644
--- a/test/swfdec-extract.c
+++ b/test/swfdec-extract.c
@@ -54,23 +54,23 @@ encode_wav (SwfdecBuffer *buffer, SwfdecAudioFormat format)
/* FIXME: too much magic in this memmove */
memmove (data, "RIFF----WAVEfmt \020\0\0\0"
"\001\0ccRRRRbbbbAAbbdata", 40);
- *(guint32 *) &data[4] = GUINT32_TO_LE (buffer->length + 36);
- *(guint16 *) &data[22] = GUINT16_TO_LE (swfdec_audio_format_get_channels (format));
- *(guint32 *) &data[24] = GUINT32_TO_LE (swfdec_audio_format_get_rate (format));
+ *(guint32 *) (void *) &data[4] = GUINT32_TO_LE (buffer->length + 36);
+ *(guint16 *) (void *) &data[22] = GUINT16_TO_LE (swfdec_audio_format_get_channels (format));
+ *(guint32 *) (void *) &data[24] = GUINT32_TO_LE (swfdec_audio_format_get_rate (format));
/* bits per sample */
i = swfdec_audio_format_is_16bit (format) ? 2 : 1;
- *(guint16 *) &data[34] = GUINT16_TO_LE (i * 8);
+ *(guint16 *) (void *) &data[34] = GUINT16_TO_LE (i * 8);
/* block align */
i *= swfdec_audio_format_get_channels (format);
- *(guint16 *) &data[32] = GUINT16_TO_LE (i);
+ *(guint16 *) (void *) &data[32] = GUINT16_TO_LE (i);
/* bytes per second */
i *= swfdec_audio_format_get_rate (format);
- *(guint32 *) &data[28] = GUINT32_TO_LE (i);
- *(guint32 *) &data[40] = GUINT32_TO_LE (buffer->length);
+ *(guint32 *) (void *) &data[28] = GUINT32_TO_LE (i);
+ *(guint32 *) (void *) &data[40] = GUINT32_TO_LE (buffer->length);
data += 44;
if (swfdec_audio_format_is_16bit (format)) {
for (i = 0; i < buffer->length; i += 2) {
- *(gint16 *) (data + i) = GINT16_TO_LE (*(gint16* )(buffer->data + i));
+ *(gint16 *) (void *) (data + i) = GINT16_TO_LE (*(gint16* ) (void *) (buffer->data + i));
}
} else {
memcpy (data, buffer->data, buffer->length);
@@ -134,7 +134,7 @@ export_sprite_sound (SwfdecSprite *sprite, const char *filename)
} else
#endif
{
- swfdec_audio_render (audio, (gint16 *) buffer->data, 0, i);
+ swfdec_audio_render (audio, (gint16 *) (void *) buffer->data, 0, i);
}
i = swfdec_audio_iterate (audio, i);
i = MIN (i, 4096);
More information about the Swfdec
mailing list