Navigation Menu

Skip to content

Commit

Permalink
Fixed bug #832
Browse files Browse the repository at this point in the history
Fixed building FLAC support with older gcc
  • Loading branch information
slouken committed Oct 10, 2009
1 parent 08df374 commit 7741747
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
21 changes: 14 additions & 7 deletions load_flac.c
Expand Up @@ -50,7 +50,8 @@ static FLAC__StreamDecoderReadStatus flac_read_load_cb(
const FLAC__StreamDecoder *decoder,
FLAC__byte buffer[],
size_t *bytes,
void *client_data) {
void *client_data)
{
// make sure there is something to be reading
if (*bytes > 0) {
FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
Expand All @@ -76,7 +77,8 @@ static FLAC__StreamDecoderReadStatus flac_read_load_cb(
static FLAC__StreamDecoderSeekStatus flac_seek_load_cb(
const FLAC__StreamDecoder *decoder,
FLAC__uint64 absolute_byte_offset,
void *client_data) {
void *client_data)
{
FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;

if (SDL_RWseek (data->sdl_src, absolute_byte_offset, SEEK_SET) < 0) {
Expand All @@ -90,7 +92,8 @@ static FLAC__StreamDecoderSeekStatus flac_seek_load_cb(
static FLAC__StreamDecoderTellStatus flac_tell_load_cb(
const FLAC__StreamDecoder *decoder,
FLAC__uint64 *absolute_byte_offset,
void *client_data) {
void *client_data)
{
FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;

int pos = SDL_RWtell (data->sdl_src);
Expand All @@ -107,7 +110,8 @@ static FLAC__StreamDecoderTellStatus flac_tell_load_cb(
static FLAC__StreamDecoderLengthStatus flac_length_load_cb(
const FLAC__StreamDecoder *decoder,
FLAC__uint64 *stream_length,
void *client_data) {
void *client_data)
{
FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;

int pos = SDL_RWtell (data->sdl_src);
Expand All @@ -125,7 +129,8 @@ static FLAC__StreamDecoderLengthStatus flac_length_load_cb(
}

static FLAC__bool flac_eof_load_cb(const FLAC__StreamDecoder *decoder,
void *client_data) {
void *client_data)
{
FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;

int pos = SDL_RWtell (data->sdl_src);
Expand All @@ -148,9 +153,11 @@ static FLAC__StreamDecoderWriteStatus flac_write_load_cb(
const FLAC__StreamDecoder *decoder,
const FLAC__Frame *frame,
const FLAC__int32 *const buffer[],
void *client_data) {
void *client_data)
{
FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
size_t i;
Uint8 *buf;

if (data->flac_total_samples == 0) {
SDL_SetError ("Given FLAC file does not specify its sample count.");
Expand All @@ -176,7 +183,7 @@ static FLAC__StreamDecoderWriteStatus flac_write_load_cb(
}
}

Uint8 *buf = *(data->sdl_audio_buf);
buf = *(data->sdl_audio_buf);

for (i = 0; i < frame->header.blocksize; i++) {
FLAC__int16 i16;
Expand Down
9 changes: 3 additions & 6 deletions music_flac.c
Expand Up @@ -189,6 +189,9 @@ static FLAC__StreamDecoderWriteStatus flac_write_music_cb(
}

for (i = 0; i < frame->header.blocksize; i++) {
FLAC__int16 i16;
FLAC__uint16 ui16;

// make sure we still have at least two bytes that can be read (one for
// each channel)
if (data->flac_data.max_to_read >= 4) {
Expand All @@ -206,9 +209,6 @@ static FLAC__StreamDecoderWriteStatus flac_write_music_cb(
}
}

FLAC__int16 i16;
FLAC__uint16 ui16;

i16 = (FLAC__int16)buffer[0][i];
ui16 = (FLAC__uint16)i16;

Expand Down Expand Up @@ -249,9 +249,6 @@ static FLAC__StreamDecoderWriteStatus flac_write_music_cb(
}
}

FLAC__int16 i16;
FLAC__uint16 ui16;

i16 = (FLAC__int16)buffer[0][i];
ui16 = (FLAC__uint16)i16;

Expand Down

0 comments on commit 7741747

Please sign in to comment.