Skip to content
Permalink
Browse files

More warning fixes

- __MIX_INTERNAL_EFFECT__ -> MIX_INTERNAL_EFFECT__ ("reserved identifier")
- add missing casts
- change seek_sample from double to FLAC__uint64 in FLAC_Seek()
- change 255.0 to 255.0f in float divisons
- replace two tabs with 4 spaces in mixer.c
  • Loading branch information
Wohlstand committed Nov 26, 2019
1 parent ebaea1d commit 840d849547f0bd59b3ba9b2dcdafb8c7a40e92ff
Showing with 20 additions and 20 deletions.
  1. +2 −2 src/codecs/music_flac.c
  2. +1 −1 src/effect_position.c
  3. +1 −1 src/effect_stereoreverse.c
  4. +3 −3 src/effects_internal.c
  5. +3 −3 src/effects_internal.h
  6. +7 −7 src/mixer.c
  7. +3 −3 src/music.c
@@ -647,11 +647,11 @@ static int FLAC_GetAudio(void *context, void *data, int bytes)
static int FLAC_Seek(void *context, double position)
{
FLAC_Music *music = (FLAC_Music *)context;
double seek_sample = music->sample_rate * position;
FLAC__uint64 seek_sample = (FLAC__uint64) (music->sample_rate * position);

SDL_AudioStreamClear(music->stream);
music->pcm_pos = seek_sample;
if (!flac.FLAC__stream_decoder_seek_absolute(music->flac_decoder, (FLAC__uint64)seek_sample)) {
if (!flac.FLAC__stream_decoder_seek_absolute(music->flac_decoder, seek_sample)) {
if (flac.FLAC__stream_decoder_get_state(music->flac_decoder) == FLAC__STREAM_DECODER_SEEK_ERROR) {
flac.FLAC__stream_decoder_flush(music->flac_decoder);
}
@@ -33,7 +33,7 @@
#include "SDL_mixer.h"
#include "mixer.h"

#define __MIX_INTERNAL_EFFECT__
#define MIX_INTERNAL_EFFECT__
#include "effects_internal.h"

/* profile code:
@@ -30,7 +30,7 @@
#include "SDL.h"
#include "SDL_mixer.h"

#define __MIX_INTERNAL_EFFECT__
#define MIX_INTERNAL_EFFECT__
#include "effects_internal.h"

/* profile code:
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include "SDL_mixer.h"

#define __MIX_INTERNAL_EFFECT__
#define MIX_INTERNAL_EFFECT__
#include "effects_internal.h"

/* Should we favor speed over memory usage and/or quality of output? */
@@ -74,7 +74,7 @@ void *_Eff_build_volume_table_u8(void)
_Eff_volume_table = (void *) rc;
for (volume = 0; volume < 256; volume++) {
for (sample = -128; sample < 128; sample ++) {
*rc = (Uint8)(((float) sample) * ((float) volume / 255.0))
*rc = (Uint8)(((float) sample) * ((float) volume / 255.0f))
+ 128;
rc++;
}
@@ -105,7 +105,7 @@ void *_Eff_build_volume_table_s8(void)
_Eff_volume_table = (void *) rc;
for (volume = 0; volume < 256; volume++) {
for (sample = -128; sample < 128; sample ++) {
*rc = (Sint8)(((float) sample) * ((float) volume / 255.0));
*rc = (Sint8)(((float) sample) * ((float) volume / 255.0f));
rc++;
}
}
@@ -21,10 +21,10 @@

/* $Id$ */

#ifndef _INCLUDE_EFFECTS_INTERNAL_H_
#define _INCLUDE_EFFECTS_INTERNAL_H_
#ifndef INCLUDE_EFFECTS_INTERNAL_H_
#define INCLUDE_EFFECTS_INTERNAL_H_

#ifndef __MIX_INTERNAL_EFFECT__
#ifndef MIX_INTERNAL_EFFECT__
#error You should not include this file or use these functions.
#endif

@@ -33,7 +33,7 @@
#include "load_aiff.h"
#include "load_voc.h"

#define __MIX_INTERNAL_EFFECT__
#define MIX_INTERNAL_EFFECT__
#include "effects_internal.h"

/* Magic numbers for various audio file formats */
@@ -130,7 +130,7 @@ void add_chunk_decoder(const char *decoder)
}
}

ptr = SDL_realloc((void *)chunk_decoders, (num_decoders + 1) * sizeof (const char *));
ptr = SDL_realloc((void *)chunk_decoders, (size_t)(num_decoders + 1) * sizeof (const char *));
if (ptr == NULL) {
return; /* oh well, go on without it. */
}
@@ -236,11 +236,11 @@ static void *Mix_DoEffects(int chan, void *snd, int len)
if (e != NULL) { /* are there any registered effects? */
/* if this is the postmix, we can just overwrite the original. */
if (!posteffect) {
buf = SDL_malloc(len);
buf = SDL_malloc((size_t)len);
if (buf == NULL) {
return(snd);
}
SDL_memcpy(buf, snd, len);
SDL_memcpy(buf, snd, (size_t)len);
}

for (; e != NULL; e = e->next) {
@@ -267,7 +267,7 @@ mix_channels(void *udata, Uint8 *stream, int len)

#if SDL_VERSION_ATLEAST(1, 3, 0)
/* Need to initialize the stream in SDL 1.3+ */
SDL_memset(stream, mixer.silence, len);
SDL_memset(stream, mixer.silence, (size_t)len);
#endif

/* Mix the music (must be done before the channels are added) */
@@ -532,7 +532,7 @@ typedef struct _MusicFragment
static SDL_AudioSpec *Mix_LoadMusic_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
{
int i;
Mix_MusicType music_type;
Mix_MusicType music_type;
Mix_MusicInterface *interface = NULL;
void *music = NULL;
Sint64 start;
@@ -541,7 +541,7 @@ static SDL_AudioSpec *Mix_LoadMusic_RW(SDL_RWops *src, int freesrc, SDL_AudioSpe
int count = 0;
int fragment_size;

music_type = detect_music_type(src);
music_type = detect_music_type(src);
if (!load_music_type(music_type) || !open_music_type(music_type)) {
return NULL;
}
@@ -153,7 +153,7 @@ static void add_music_decoder(const char *decoder)
}
}

ptr = SDL_realloc((void *)music_decoders, (num_decoders + 1) * sizeof (const char *));
ptr = SDL_realloc((void *)music_decoders, ((size_t)num_decoders + 1) * sizeof (const char *));
if (ptr == NULL) {
return; /* oh well, go on without it. */
}
@@ -194,7 +194,7 @@ int music_pcm_getaudio(void *context, void *data, int bytes, int volume,
if (volume == MIX_MAX_VOLUME) {
dst = snd;
} else {
dst = SDL_stack_alloc(Uint8, bytes);
dst = SDL_stack_alloc(Uint8, (size_t)bytes);
}
while (len > 0 && !done) {
int consumed = GetSome(context, dst, len, &done);
@@ -394,7 +394,7 @@ void open_music(const SDL_AudioSpec *spec)
Mix_VolumeMusic(MIX_MAX_VOLUME);

/* Calculate the number of ms for each callback */
ms_per_step = (int) (((float)spec->samples * 1000.0) / spec->freq);
ms_per_step = (int) (((float)spec->samples * 1000.0f) / spec->freq);
}

/* Return SDL_TRUE if the music type is available */

0 comments on commit 840d849

Please sign in to comment.