Fixed bug #832
authorSam Lantinga <slouken@libsdl.org>
Sat, 10 Oct 2009 10:23:03 +0000
changeset 4368ec227cabdd4
parent 435 4b5aa99968ea
child 437 cd21b80e524f
Fixed bug #832

Fixed building FLAC support with older gcc
load_flac.c
music_flac.c
     1.1 --- a/load_flac.c	Sat Oct 10 09:58:24 2009 +0000
     1.2 +++ b/load_flac.c	Sat Oct 10 10:23:03 2009 +0000
     1.3 @@ -50,7 +50,8 @@
     1.4  									const FLAC__StreamDecoder *decoder,
     1.5  									FLAC__byte buffer[],
     1.6  									size_t *bytes,
     1.7 -									void *client_data) {
     1.8 +									void *client_data)
     1.9 +{
    1.10  	// make sure there is something to be reading
    1.11  	if (*bytes > 0) {
    1.12  		FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
    1.13 @@ -76,7 +77,8 @@
    1.14  static FLAC__StreamDecoderSeekStatus flac_seek_load_cb(
    1.15  									const FLAC__StreamDecoder *decoder,
    1.16  									FLAC__uint64 absolute_byte_offset,
    1.17 -									void *client_data) {
    1.18 +									void *client_data)
    1.19 +{
    1.20  	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
    1.21  
    1.22  	if (SDL_RWseek (data->sdl_src, absolute_byte_offset, SEEK_SET) < 0) {
    1.23 @@ -90,7 +92,8 @@
    1.24  static FLAC__StreamDecoderTellStatus flac_tell_load_cb(
    1.25  									const FLAC__StreamDecoder *decoder,
    1.26  									FLAC__uint64 *absolute_byte_offset,
    1.27 -									void *client_data) {
    1.28 +									void *client_data)
    1.29 +{
    1.30  	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
    1.31  
    1.32  	int pos = SDL_RWtell (data->sdl_src);
    1.33 @@ -107,7 +110,8 @@
    1.34  static FLAC__StreamDecoderLengthStatus flac_length_load_cb(
    1.35  									const FLAC__StreamDecoder *decoder,
    1.36  									FLAC__uint64 *stream_length,
    1.37 -									void *client_data) {
    1.38 +									void *client_data)
    1.39 +{
    1.40  	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
    1.41  
    1.42  	int pos = SDL_RWtell (data->sdl_src);
    1.43 @@ -125,7 +129,8 @@
    1.44  }
    1.45  
    1.46  static FLAC__bool flac_eof_load_cb(const FLAC__StreamDecoder *decoder,
    1.47 -									void *client_data) {
    1.48 +									void *client_data)
    1.49 +{
    1.50  	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
    1.51  
    1.52  	int pos = SDL_RWtell (data->sdl_src);
    1.53 @@ -148,9 +153,11 @@
    1.54  									const FLAC__StreamDecoder *decoder,
    1.55  									const FLAC__Frame *frame,
    1.56  									const FLAC__int32 *const buffer[],
    1.57 -									void *client_data) {
    1.58 +									void *client_data)
    1.59 +{
    1.60  	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
    1.61  	size_t i;
    1.62 +	Uint8 *buf;
    1.63  
    1.64  	if (data->flac_total_samples == 0) {
    1.65  		SDL_SetError ("Given FLAC file does not specify its sample count.");
    1.66 @@ -176,7 +183,7 @@
    1.67      	}
    1.68  	}
    1.69  
    1.70 -	Uint8 *buf = *(data->sdl_audio_buf);
    1.71 +	buf = *(data->sdl_audio_buf);
    1.72  
    1.73  	for (i = 0; i < frame->header.blocksize; i++) {
    1.74  		FLAC__int16 i16;
     2.1 --- a/music_flac.c	Sat Oct 10 09:58:24 2009 +0000
     2.2 +++ b/music_flac.c	Sat Oct 10 10:23:03 2009 +0000
     2.3 @@ -189,6 +189,9 @@
     2.4  	}
     2.5  
     2.6  	for (i = 0; i < frame->header.blocksize; i++) {
     2.7 +		FLAC__int16 i16;
     2.8 +		FLAC__uint16 ui16;
     2.9 +
    2.10  		// make sure we still have at least two bytes that can be read (one for
    2.11  		// each channel)
    2.12  		if (data->flac_data.max_to_read >= 4) {
    2.13 @@ -206,9 +209,6 @@
    2.14  				}
    2.15  			}
    2.16  
    2.17 -			FLAC__int16 i16;
    2.18 -			FLAC__uint16 ui16;
    2.19 -
    2.20  			i16 = (FLAC__int16)buffer[0][i];
    2.21  			ui16 = (FLAC__uint16)i16;
    2.22  
    2.23 @@ -249,9 +249,6 @@
    2.24  				}
    2.25  			}
    2.26  
    2.27 -			FLAC__int16 i16;
    2.28 -			FLAC__uint16 ui16;
    2.29 -
    2.30  			i16 = (FLAC__int16)buffer[0][i];
    2.31  			ui16 = (FLAC__uint16)i16;
    2.32