Skip to content

Commit

Permalink
Another set of warnings fixes
Browse files Browse the repository at this point in the history
- Unnecessary comma at last element of list
- Unused arguments
- Casting between types
  • Loading branch information
Wohlstand committed Nov 26, 2019
1 parent 3571243 commit f784177
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/codecs/music_cmd.c
Expand Up @@ -284,7 +284,7 @@ Mix_MusicInterface Mix_MusicInterface_CMD =
MusicCMD_Stop,
MusicCMD_Delete,
NULL, /* Close */
NULL, /* Unload */
NULL /* Unload */
};

#endif /* MUSIC_CMD */
Expand Down
4 changes: 2 additions & 2 deletions src/codecs/music_flac.c
Expand Up @@ -400,7 +400,7 @@ static void flac_metadata_music_cb(
music->sample_rate = metadata->data.stream_info.sample_rate;
music->channels = metadata->data.stream_info.channels;
music->bits_per_sample = metadata->data.stream_info.bits_per_sample;
/*printf("FLAC: Sample rate = %d, channels = %d, bits_per_sample = %d\n", music->sample_rate, music->channels, music->bits_per_sample);*/
/*printf("FLAC: Sample rate = %d, channels = %d, bits_per_sample = %d\n", music->sample_rate, music->channels, music->bits_per_sample);*/

/* SDL's channel mapping and FLAC channel mapping are the same,
except for 3 channels: SDL is FL FR LFE and FLAC is FL FR FC
Expand Down Expand Up @@ -703,7 +703,7 @@ Mix_MusicInterface Mix_MusicInterface_FLAC =
NULL, /* Stop */
FLAC_Delete,
NULL, /* Close */
FLAC_Unload,
FLAC_Unload
};

#endif /* MUSIC_FLAC */
Expand Down
10 changes: 7 additions & 3 deletions src/codecs/music_fluidsynth.c
Expand Up @@ -128,6 +128,7 @@ static int SDLCALL fluidsynth_check_soundfont(const char *path, void *data)
{
FILE *file = fopen(path, "r");

(void)data;
if (file) {
fclose(file);
return 1;
Expand All @@ -146,6 +147,7 @@ static int SDLCALL fluidsynth_load_soundfont(const char *path, void *data)

static int FLUIDSYNTH_Open(const SDL_AudioSpec *spec)
{
(void)spec;
if (!Mix_EachSoundFont(fluidsynth_check_soundfont, NULL)) {
return -1;
}
Expand All @@ -159,10 +161,10 @@ static FLUIDSYNTH_Music *FLUIDSYNTH_LoadMusic(void *data)
fluid_settings_t *settings;

if ((music = SDL_calloc(1, sizeof(FLUIDSYNTH_Music)))) {
int channels = 2;
Uint8 channels = 2;
if ((music->stream = SDL_NewAudioStream(AUDIO_S16SYS, channels, music_spec.freq, music_spec.format, music_spec.channels, music_spec.freq))) {
music->buffer_size = music_spec.samples * sizeof(Sint16) * channels;
if ((music->buffer = SDL_malloc(music->buffer_size))) {
if ((music->buffer = SDL_malloc((size_t)music->buffer_size))) {
if ((settings = fluidsynth.new_fluid_settings())) {
fluidsynth.fluid_settings_setnum(settings, "synth.sample-rate", (double) music_spec.freq);

Expand Down Expand Up @@ -245,6 +247,8 @@ static int FLUIDSYNTH_GetSome(void *context, void *data, int bytes, SDL_bool *do
FLUIDSYNTH_Music *music = (FLUIDSYNTH_Music *)context;
int filled;

(void)done;

filled = SDL_AudioStreamGet(music->stream, data, bytes);
if (filled != 0) {
return filled;
Expand Down Expand Up @@ -301,7 +305,7 @@ Mix_MusicInterface Mix_MusicInterface_FLUIDSYNTH =
FLUIDSYNTH_Stop,
FLUIDSYNTH_Delete,
NULL, /* Close */
FLUIDSYNTH_Unload,
FLUIDSYNTH_Unload
};

#endif /* MUSIC_MID_FLUIDSYNTH */
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/music_mad.c
Expand Up @@ -668,7 +668,7 @@ Mix_MusicInterface Mix_MusicInterface_MAD =
NULL, /* Stop */
MAD_Delete,
NULL, /* Close */
NULL, /* Unload */
NULL /* Unload */
};

#endif /* MUSIC_MP3_MAD */
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/music_mikmod.c
Expand Up @@ -486,7 +486,7 @@ Mix_MusicInterface Mix_MusicInterface_MIKMOD =
MIKMOD_Stop,
MIKMOD_Delete,
MIKMOD_Close,
MIKMOD_Unload,
MIKMOD_Unload
};

#endif /* MUSIC_MOD_MIKMOD */
Expand Down
4 changes: 2 additions & 2 deletions src/codecs/music_modplug.c
Expand Up @@ -41,7 +41,7 @@ typedef struct {
void (*ModPlug_Seek)(ModPlugFile* file, int millisecond);
void (*ModPlug_GetSettings)(ModPlug_Settings* settings);
void (*ModPlug_SetSettings)(const ModPlug_Settings* settings);
void (*ModPlug_SetMasterVolume)(ModPlugFile* file,unsigned int cvol) ;
void (*ModPlug_SetMasterVolume)(ModPlugFile* file,unsigned int cvol);
} modplug_loader;

static modplug_loader modplug = {
Expand Down Expand Up @@ -302,7 +302,7 @@ Mix_MusicInterface Mix_MusicInterface_MODPLUG =
NULL, /* Stop */
MODPLUG_Delete,
NULL, /* Close */
MODPLUG_Unload,
MODPLUG_Unload
};

#endif /* MUSIC_MOD_MODPLUG */
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/music_nativemidi.c
Expand Up @@ -105,7 +105,7 @@ Mix_MusicInterface Mix_MusicInterface_NATIVEMIDI =
NATIVEMIDI_Stop,
NATIVEMIDI_Delete,
NULL, /* Close */
NULL, /* Unload */
NULL /* Unload */
};

#endif /* MUSIC_MID_NATIVE */
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/music_ogg.c
Expand Up @@ -498,7 +498,7 @@ Mix_MusicInterface Mix_MusicInterface_OGG =
NULL, /* Stop */
OGG_Delete,
NULL, /* Close */
OGG_Unload,
OGG_Unload
};

#endif /* MUSIC_OGG */
Expand Down
10 changes: 5 additions & 5 deletions src/codecs/music_opus.c
Expand Up @@ -182,14 +182,14 @@ static int OPUS_UpdateSection(OPUS_music *music)
music->stream = NULL;
}

music->stream = SDL_NewAudioStream(AUDIO_S16, op_info->channel_count, 48000,
music->stream = SDL_NewAudioStream(AUDIO_S16, (Uint8)op_info->channel_count, 48000,
music_spec.format, music_spec.channels, music_spec.freq);
if (!music->stream) {
return -1;
}

music->buffer_size = music_spec.samples * sizeof(opus_int16) * op_info->channel_count;
music->buffer = (char *)SDL_malloc(music->buffer_size);
music->buffer_size = (int)music_spec.samples * (int)sizeof(opus_int16) * op_info->channel_count;
music->buffer = (char *)SDL_malloc((size_t)music->buffer_size);
if (!music->buffer) {
return -1;
}
Expand Down Expand Up @@ -273,7 +273,7 @@ static int OPUS_GetSome(void *context, void *data, int bytes, SDL_bool *done)
}

section = music->section;
samples = opus.op_read(music->of, (opus_int16 *)music->buffer, music->buffer_size / sizeof(opus_int16), &section);
samples = opus.op_read(music->of, (opus_int16 *)music->buffer, music->buffer_size / (int)sizeof(opus_int16), &section);
if (samples < 0) {
set_op_error("op_read", samples);
return -1;
Expand Down Expand Up @@ -365,7 +365,7 @@ Mix_MusicInterface Mix_MusicInterface_Opus =
NULL, /* Stop */
OPUS_Delete,
NULL, /* Close */
OPUS_Unload,
OPUS_Unload
};

#endif /* MUSIC_OPUS */
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/music_timidity.c
Expand Up @@ -213,7 +213,7 @@ Mix_MusicInterface Mix_MusicInterface_TIMIDITY =
NULL, /* Stop */
TIMIDITY_Delete,
TIMIDITY_Close,
NULL, /* Unload */
NULL /* Unload */
};

#endif /* MUSIC_MID_TIMIDITY */
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/music_wav.c
Expand Up @@ -632,7 +632,7 @@ Mix_MusicInterface Mix_MusicInterface_WAV =
NULL, /* Stop */
WAV_Delete,
NULL, /* Close */
NULL, /* Unload */
NULL /* Unload */
};

#endif /* MUSIC_WAV */
Expand Down

0 comments on commit f784177

Please sign in to comment.