Skip to content

Commit

Permalink
removed MIX_UNUSED macro and replaced its uses with plain (void)x.
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Nov 18, 2019
1 parent 82a4f3f commit 4378df0
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 66 deletions.
63 changes: 32 additions & 31 deletions effect_position.c
Expand Up @@ -99,7 +99,7 @@ void _Eff_PositionDeinit(void)
/* This just frees up the callback-specific data. */
static void SDLCALL _Eff_PositionDone(int channel, void *udata)
{
MIX_UNUSED(udata);
(void)udata;

if (channel < 0) {
if (pos_args_global != NULL) {
Expand All @@ -119,7 +119,7 @@ static void SDLCALL _Eff_position_u8(int chan, void *stream, int len, void *udat
Uint8 *ptr = (Uint8 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

/*
* if there's only a mono channnel (the only way we wouldn't have
Expand Down Expand Up @@ -159,7 +159,7 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u
Uint8 *ptr = (Uint8 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

/*
* if there's only a mono channnel (the only way we wouldn't have
Expand Down Expand Up @@ -245,8 +245,8 @@ static void SDLCALL _Eff_position_u8_c6(int chan, void *stream, int len, void *u
Uint8 *ptr = (Uint8 *) stream;
int i;

MIX_UNUSED(chan);
MIX_UNUSED(len);
(void)chan;
(void)len;

/*
* if there's only a mono channnel (the only way we wouldn't have
Expand Down Expand Up @@ -374,7 +374,7 @@ static void SDLCALL _Eff_position_table_u8(int chan, void *stream, int len, void
Uint8 *r = ((Uint8 *) _Eff_volume_table) + (256 * args->right_u8);
Uint8 *d = ((Uint8 *) _Eff_volume_table) + (256 * args->distance_u8);

MIX_UNUSED(chan);
(void)chan;

if (args->room_angle == 180) {
Uint8 *temp = l;
Expand Down Expand Up @@ -421,7 +421,7 @@ static void SDLCALL _Eff_position_s8(int chan, void *stream, int len, void *udat
Sint8 *ptr = (Sint8 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

/*
* if there's only a mono channnel (the only way we wouldn't have
Expand Down Expand Up @@ -455,7 +455,7 @@ static void SDLCALL _Eff_position_s8_c4(int chan, void *stream, int len, void *u
Sint8 *ptr = (Sint8 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

/*
* if there's only a mono channnel (the only way we wouldn't have
Expand Down Expand Up @@ -503,7 +503,7 @@ static void SDLCALL _Eff_position_s8_c6(int chan, void *stream, int len, void *u
Sint8 *ptr = (Sint8 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

/*
* if there's only a mono channnel (the only way we wouldn't have
Expand Down Expand Up @@ -576,7 +576,7 @@ static void SDLCALL _Eff_position_table_s8(int chan, void *stream, int len, void
Sint8 *r = ((Sint8 *) _Eff_volume_table) + (256 * args->right_u8);
Sint8 *d = ((Sint8 *) _Eff_volume_table) + (256 * args->distance_u8);

MIX_UNUSED(chan);
(void)chan;

if (args->room_angle == 180) {
Sint8 *temp = l;
Expand Down Expand Up @@ -621,7 +621,7 @@ static void SDLCALL _Eff_position_u16lsb(int chan, void *stream, int len, void *
Uint16 *ptr = (Uint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Uint16) * 2) {
Sint16 sampl = (Sint16) (SDL_SwapLE16(*(ptr+0)) - 32768);
Expand All @@ -648,7 +648,7 @@ static void SDLCALL _Eff_position_u16lsb_c4(int chan, void *stream, int len, voi
Uint16 *ptr = (Uint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Uint16) * 4) {
Sint16 sampl = (Sint16) (SDL_SwapLE16(*(ptr+0)) - 32768);
Expand Down Expand Up @@ -698,7 +698,8 @@ static void SDLCALL _Eff_position_u16lsb_c6(int chan, void *stream, int len, voi
volatile position_args *args = (volatile position_args *) udata;
Uint16 *ptr = (Uint16 *) stream;
int i;
MIX_UNUSED(chan);

(void)chan;

for (i = 0; i < len; i += sizeof (Uint16) * 6) {
Sint16 sampl = (Sint16) (SDL_SwapLE16(*(ptr+0)) - 32768);
Expand Down Expand Up @@ -765,7 +766,7 @@ static void SDLCALL _Eff_position_s16lsb(int chan, void *stream, int len, void *
Sint16 *ptr = (Sint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

#if 0
if (len % (int)(sizeof(Sint16) * 2)) {
Expand Down Expand Up @@ -796,7 +797,7 @@ static void SDLCALL _Eff_position_s16lsb_c4(int chan, void *stream, int len, voi
Sint16 *ptr = (Sint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint16) * 4) {
Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+0))) *
Expand Down Expand Up @@ -843,7 +844,7 @@ static void SDLCALL _Eff_position_s16lsb_c6(int chan, void *stream, int len, voi
Sint16 *ptr = (Sint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint16) * 6) {
Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+0))) *
Expand Down Expand Up @@ -902,7 +903,7 @@ static void SDLCALL _Eff_position_u16msb(int chan, void *stream, int len, void *
Uint16 *ptr = (Uint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint16) * 2) {
Sint16 sampl = (Sint16) (SDL_SwapBE16(*(ptr+0)) - 32768);
Expand Down Expand Up @@ -931,7 +932,7 @@ static void SDLCALL _Eff_position_u16msb_c4(int chan, void *stream, int len, voi
Uint16 *ptr = (Uint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint16) * 4) {
Sint16 sampl = (Sint16) (SDL_SwapBE16(*(ptr+0)) - 32768);
Expand Down Expand Up @@ -984,7 +985,7 @@ static void SDLCALL _Eff_position_u16msb_c6(int chan, void *stream, int len, voi
Uint16 *ptr = (Uint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint16) * 6) {
Sint16 sampl = (Sint16) (SDL_SwapBE16(*(ptr+0)) - 32768);
Expand Down Expand Up @@ -1051,7 +1052,7 @@ static void SDLCALL _Eff_position_s16msb(int chan, void *stream, int len, void *
Sint16 *ptr = (Sint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint16) * 2) {
Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+0))) *
Expand All @@ -1069,7 +1070,7 @@ static void SDLCALL _Eff_position_s16msb_c4(int chan, void *stream, int len, voi
Sint16 *ptr = (Sint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint16) * 4) {
Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+0))) *
Expand Down Expand Up @@ -1115,7 +1116,7 @@ static void SDLCALL _Eff_position_s16msb_c6(int chan, void *stream, int len, voi
Sint16 *ptr = (Sint16 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint16) * 6) {
Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+0))) *
Expand Down Expand Up @@ -1175,7 +1176,7 @@ static void SDLCALL _Eff_position_s32lsb(int chan, void *stream, int len, void *
Sint32 *ptr = (Sint32 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

#if 0
if (len % (int)(sizeof(Sint32) * 2)) {
Expand Down Expand Up @@ -1206,7 +1207,7 @@ static void SDLCALL _Eff_position_s32lsb_c4(int chan, void *stream, int len, voi
Sint32 *ptr = (Sint32 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint32) * 4) {
Sint32 swapl = (Sint32) ((((float) (Sint32) SDL_SwapLE32(*(ptr+0))) *
Expand Down Expand Up @@ -1253,7 +1254,7 @@ static void SDLCALL _Eff_position_s32lsb_c6(int chan, void *stream, int len, voi
Sint32 *ptr = (Sint32 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint32) * 6) {
Sint32 swapl = (Sint32) ((((float) (Sint32) SDL_SwapLE32(*(ptr+0))) *
Expand Down Expand Up @@ -1312,7 +1313,7 @@ static void SDLCALL _Eff_position_s32msb(int chan, void *stream, int len, void *
Sint32 *ptr = (Sint32 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint32) * 2) {
Sint32 swapl = (Sint32) ((((float) (Sint32) SDL_SwapBE32(*(ptr+0))) *
Expand All @@ -1330,7 +1331,7 @@ static void SDLCALL _Eff_position_s32msb_c4(int chan, void *stream, int len, voi
Sint32 *ptr = (Sint32 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint32) * 4) {
Sint32 swapl = (Sint32) ((((float) (Sint32) SDL_SwapBE32(*(ptr+0))) *
Expand Down Expand Up @@ -1376,7 +1377,7 @@ static void SDLCALL _Eff_position_s32msb_c6(int chan, void *stream, int len, voi
Sint32 *ptr = (Sint32 *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (Sint32) * 6) {
Sint32 swapl = (Sint32) ((((float) (Sint32) SDL_SwapBE32(*(ptr+0))) *
Expand Down Expand Up @@ -1436,7 +1437,7 @@ static void SDLCALL _Eff_position_f32sys(int chan, void *stream, int len, void *
float *ptr = (float *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (float) * 2) {
float swapl = ((*(ptr+0) * args->left_f) * args->distance_f);
Expand All @@ -1452,7 +1453,7 @@ static void SDLCALL _Eff_position_f32sys_c4(int chan, void *stream, int len, voi
float *ptr = (float *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (float) * 4) {
float swapl = ((*(ptr+0) * args->left_f) * args->distance_f);
Expand Down Expand Up @@ -1494,7 +1495,7 @@ static void SDLCALL _Eff_position_f32sys_c6(int chan, void *stream, int len, voi
float *ptr = (float *) stream;
int i;

MIX_UNUSED(chan);
(void)chan;

for (i = 0; i < len; i += sizeof (float) * 6) {
float swapl = ((*(ptr+0) * args->left_f) * args->distance_f);
Expand Down
12 changes: 6 additions & 6 deletions effect_stereoreverse.c
Expand Up @@ -59,8 +59,8 @@ static void SDLCALL _Eff_reversestereo32(int chan, void *stream, int len, void *
Uint32 tmp;
int i;

MIX_UNUSED(chan);
MIX_UNUSED(udata);
(void)chan;
(void)udata;

for (i = 0; i < len; i += 2 * sizeof (Uint32), ptr += 2) {
tmp = ptr[0];
Expand All @@ -75,8 +75,8 @@ static void SDLCALL _Eff_reversestereo16(int chan, void *stream, int len, void *
Uint32 *ptr = (Uint32 *) stream;
int i;

MIX_UNUSED(chan);
MIX_UNUSED(udata);
(void)chan;
(void)udata;

for (i = 0; i < len; i += sizeof (Uint32), ptr++) {
*ptr = (((*ptr) & 0xFFFF0000) >> 16) | (((*ptr) & 0x0000FFFF) << 16);
Expand All @@ -89,8 +89,8 @@ static void SDLCALL _Eff_reversestereo8(int chan, void *stream, int len, void *u
Uint32 *ptr = (Uint32 *) stream;
int i;

MIX_UNUSED(chan);
MIX_UNUSED(udata);
(void)chan;
(void)udata;

/* get the last two bytes if len is not divisible by four... */
if (len % (int)sizeof(Uint32) != 0) {
Expand Down
5 changes: 0 additions & 5 deletions effects_internal.h
Expand Up @@ -30,11 +30,6 @@

#include "SDL_mixer.h"

/* Prevent "Unused" warning on specified object */
#ifndef MIX_UNUSED
#define MIX_UNUSED(object) (void)object
#endif

extern int _Mix_effects_max_speed;
extern void *_Eff_volume_table;
void *_Eff_build_volume_table_u8(void);
Expand Down
8 changes: 1 addition & 7 deletions load_aiff.c
Expand Up @@ -32,11 +32,6 @@
#include "SDL_mixer.h"
#include "load_aiff.h"

/* Prevent "Unused" warning on specified object */
#ifndef MIX_UNUSED
#define MIX_UNUSED(object) (void)object
#endif

/*********************************************/
/* Define values for AIFF (IFF audio) format */
/*********************************************/
Expand Down Expand Up @@ -96,8 +91,6 @@ SDL_AudioSpec *Mix_LoadAIFF_RW (SDL_RWops *src, int freesrc,
Uint8 sane_freq[10];
Uint32 frequency = 0;

MIX_UNUSED(blocksize);

/* Make sure we are passed a valid data source */
was_error = 0;
if (src == NULL) {
Expand Down Expand Up @@ -141,6 +134,7 @@ SDL_AudioSpec *Mix_LoadAIFF_RW (SDL_RWops *src, int freesrc,
offset = SDL_ReadBE32(src);
blocksize = SDL_ReadBE32(src);
start = SDL_RWtell(src) + offset;
(void)blocksize; /* unused. */
break;

case COMM:
Expand Down
3 changes: 2 additions & 1 deletion mixer.c
Expand Up @@ -262,7 +262,8 @@ mix_channels(void *udata, Uint8 *stream, int len)
Uint8 *mix_input;
int i, mixable, volume = MIX_MAX_VOLUME;
Uint32 sdl_ticks;
MIX_UNUSED(udata);

(void)udata;

#if SDL_VERSION_ATLEAST(1, 3, 0)
/* Need to initialize the stream in SDL 1.3+ */
Expand Down
3 changes: 2 additions & 1 deletion music.c
Expand Up @@ -251,7 +251,8 @@ int music_pcm_getaudio(void *context, void *data, int bytes, int volume,
/* Mixing function */
void SDLCALL music_mixer(void *udata, Uint8 *stream, int len)
{
MIX_UNUSED(udata);
(void)udata;

while (music_playing && music_active && len > 0) {
/* Handle fading */
if (music_playing->fading != MIX_NO_FADING) {
Expand Down
6 changes: 1 addition & 5 deletions music.h
Expand Up @@ -23,10 +23,6 @@
#ifndef MUSIC_H_
#define MUSIC_H_

/* Prevent "Unused" warning on specified object */

#define MIX_UNUSED(object) (void)object

/* Supported music APIs, in order of preference */

typedef enum
Expand Down Expand Up @@ -123,7 +119,7 @@ extern void unload_music(void);
extern char *music_cmd;
extern SDL_AudioSpec music_spec;

/* Saafe strtok implementation */
/* Safe strtok implementation */
extern char *Mix_strtok_safe(char *str, const char *delim, char **nextp);

#endif /* MUSIC_H_ */
Expand Down
2 changes: 1 addition & 1 deletion music_mad.c
Expand Up @@ -308,8 +308,8 @@ static SDL_INLINE SDL_bool is_apetag(const unsigned char *data, size_t length)
static SDL_INLINE long get_ape_len(const unsigned char *data, long datalen, Uint32 *version)
{
long size = (long)((data[15]<<24) | (data[14]<<16) | (data[13]<<8) | data[12]);
MIX_UNUSED(datalen);
*version = (Uint32)((data[11]<<24) | (data[10]<<16) | (data[9]<<8) | data[8]);
(void)datalen;
return size; /* caller will handle the additional v2 header length */
}

Expand Down

0 comments on commit 4378df0

Please sign in to comment.