Use RW_SEEK constants for RWseek()
authorSam Lantinga <slouken@libsdl.org>
Sun, 08 Nov 2009 17:11:09 +0000
changeset 47360b7e1c4f6b2
parent 472 463ba3222193
child 474 a2c238c0c4b2
Use RW_SEEK constants for RWseek()
load_aiff.c
load_flac.c
load_ogg.c
load_voc.c
mixer.c
music.c
music_flac.c
music_mad.c
music_mod.c
native_midi_gpl/native_midi_gpl.c
timidity/readmidi.c
wavestream.c
     1.1 --- a/load_aiff.c	Sun Nov 08 17:03:07 2009 +0000
     1.2 +++ b/load_aiff.c	Sun Nov 08 17:11:09 2009 +0000
     1.3 @@ -177,7 +177,7 @@
     1.4  			next_chunk++;
     1.5  	} while ( ( ( (AIFFmagic == AIFF) && ( !found_SSND || !found_COMM ) )
     1.6  		  || ( (AIFFmagic == _8SVX ) && ( !found_VHDR || !found_BODY ) ) )
     1.7 -		  && SDL_RWseek(src, next_chunk, SEEK_SET) != 1 );
     1.8 +		  && SDL_RWseek(src, next_chunk, RW_SEEK_SET) != 1 );
     1.9  
    1.10  	if ( (AIFFmagic == AIFF) && !found_SSND ) {
    1.11  		SDL_SetError("Bad AIFF (no SSND chunk)");
    1.12 @@ -227,7 +227,7 @@
    1.13  		SDL_SetError("Out of memory");
    1.14  		return(NULL);
    1.15  	}
    1.16 -	SDL_RWseek(src, start, SEEK_SET);
    1.17 +	SDL_RWseek(src, start, RW_SEEK_SET);
    1.18  	if ( SDL_RWread(src, *audio_buf, *audio_len, 1) != 1 ) {
    1.19  		SDL_SetError("Unable to read audio data");
    1.20  		return(NULL);
     2.1 --- a/load_flac.c	Sun Nov 08 17:03:07 2009 +0000
     2.2 +++ b/load_flac.c	Sun Nov 08 17:11:09 2009 +0000
     2.3 @@ -81,7 +81,7 @@
     2.4  {
     2.5  	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
     2.6  
     2.7 -	if (SDL_RWseek (data->sdl_src, absolute_byte_offset, SEEK_SET) < 0) {
     2.8 +	if (SDL_RWseek (data->sdl_src, absolute_byte_offset, RW_SEEK_SET) < 0) {
     2.9  		return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
    2.10  	}
    2.11  	else {
    2.12 @@ -115,9 +115,9 @@
    2.13  	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
    2.14  
    2.15  	int pos = SDL_RWtell (data->sdl_src);
    2.16 -	int length = SDL_RWseek (data->sdl_src, 0, SEEK_END);
    2.17 +	int length = SDL_RWseek (data->sdl_src, 0, RW_SEEK_END);
    2.18  
    2.19 -	if (SDL_RWseek (data->sdl_src, pos, SEEK_SET) != pos || length < 0) {
    2.20 +	if (SDL_RWseek (data->sdl_src, pos, RW_SEEK_SET) != pos || length < 0) {
    2.21  		/* there was an error attempting to return the stream to the original
    2.22  		 * position, or the length was invalid. */
    2.23  		return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
    2.24 @@ -134,7 +134,7 @@
    2.25  	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
    2.26  
    2.27  	int pos = SDL_RWtell (data->sdl_src);
    2.28 -	int end = SDL_RWseek (data->sdl_src, 0, SEEK_END);
    2.29 +	int end = SDL_RWseek (data->sdl_src, 0, RW_SEEK_END);
    2.30  
    2.31  	// was the original position equal to the end (a.k.a. the seek didn't move)?
    2.32  	if (pos == end) {
    2.33 @@ -143,7 +143,7 @@
    2.34  	}
    2.35  	else {
    2.36  		// not EOF, return to the original position
    2.37 -		SDL_RWseek (data->sdl_src, pos, SEEK_SET);
    2.38 +		SDL_RWseek (data->sdl_src, pos, RW_SEEK_SET);
    2.39  
    2.40  		return false;
    2.41  	}
    2.42 @@ -328,7 +328,7 @@
    2.43  		if (freesrc)
    2.44  			SDL_RWclose (src);
    2.45  		else
    2.46 -			SDL_RWseek (src, 0, SEEK_SET);
    2.47 +			SDL_RWseek (src, 0, RW_SEEK_SET);
    2.48  	}
    2.49  
    2.50  	if (was_error)
     3.1 --- a/load_ogg.c	Sun Nov 08 17:03:07 2009 +0000
     3.2 +++ b/load_ogg.c	Sun Nov 08 17:11:09 2009 +0000
     3.3 @@ -53,7 +53,7 @@
     3.4  
     3.5  static int sdl_close_func_nofreesrc(void *datasource)
     3.6  {
     3.7 -    return SDL_RWseek((SDL_RWops*)datasource, 0, SEEK_SET);
     3.8 +    return SDL_RWseek((SDL_RWops*)datasource, 0, RW_SEEK_SET);
     3.9  }
    3.10  
    3.11  static long sdl_tell_func(void *datasource)
    3.12 @@ -147,7 +147,7 @@
    3.13          if (freesrc)
    3.14              SDL_RWclose(src);
    3.15          else
    3.16 -            SDL_RWseek(src, 0, SEEK_SET);
    3.17 +            SDL_RWseek(src, 0, RW_SEEK_SET);
    3.18      }
    3.19  
    3.20      if ( was_error )
     4.1 --- a/load_voc.c	Sun Nov 08 17:03:07 2009 +0000
     4.2 +++ b/load_voc.c	Sun Nov 08 17:11:09 2009 +0000
     4.3 @@ -92,7 +92,7 @@
     4.4      Uint8  signature[20];  /* "Creative Voice File\032" */
     4.5      Uint16 datablockofs;
     4.6  
     4.7 -    SDL_RWseek(src, 0, SEEK_SET);
     4.8 +    SDL_RWseek(src, 0, RW_SEEK_SET);
     4.9  
    4.10      if (SDL_RWread(src, signature, sizeof (signature), 1) != 1)
    4.11          return(0);
    4.12 @@ -108,7 +108,7 @@
    4.13  
    4.14      datablockofs = SDL_SwapLE16(datablockofs);
    4.15  
    4.16 -    if (SDL_RWseek(src, datablockofs, SEEK_SET) != datablockofs)
    4.17 +    if (SDL_RWseek(src, datablockofs, RW_SEEK_SET) != datablockofs)
    4.18          return(0);
    4.19  
    4.20      return(1);  /* success! */
    4.21 @@ -448,7 +448,7 @@
    4.22          if (freesrc)
    4.23              SDL_RWclose(src);
    4.24          else
    4.25 -            SDL_RWseek(src, 0, SEEK_SET);
    4.26 +            SDL_RWseek(src, 0, RW_SEEK_SET);
    4.27      }
    4.28  
    4.29      if ( was_error )
     5.1 --- a/mixer.c	Sun Nov 08 17:03:07 2009 +0000
     5.2 +++ b/mixer.c	Sun Nov 08 17:11:09 2009 +0000
     5.3 @@ -555,7 +555,7 @@
     5.4  	/* Find out what kind of audio file this is */
     5.5  	magic = SDL_ReadLE32(src);
     5.6  	/* Seek backwards for compatibility with older loaders */
     5.7 -	SDL_RWseek(src, -(int)sizeof(Uint32), SEEK_CUR);
     5.8 +	SDL_RWseek(src, -(int)sizeof(Uint32), RW_SEEK_CUR);
     5.9  
    5.10  	switch (magic) {
    5.11  		case WAVE:
     6.1 --- a/music.c	Sun Nov 08 17:03:07 2009 +0000
     6.2 +++ b/music.c	Sun Nov 08 17:11:09 2009 +0000
     6.3 @@ -1248,7 +1248,7 @@
     6.4  		Mix_SetError("Couldn't read from RWops");
     6.5  		return NULL;
     6.6  	}
     6.7 -	SDL_RWseek(rw, start, SEEK_SET);
     6.8 +	SDL_RWseek(rw, start, RW_SEEK_SET);
     6.9  	magic[4]='\0';
    6.10  	moremagic[8] = '\0';
    6.11  
     7.1 --- a/music_flac.c	Sun Nov 08 17:03:07 2009 +0000
     7.2 +++ b/music_flac.c	Sun Nov 08 17:11:09 2009 +0000
     7.3 @@ -99,7 +99,7 @@
     7.4  {
     7.5  	FLAC_music *data = (FLAC_music*)client_data;
     7.6  
     7.7 -	if (SDL_RWseek (data->rwops, absolute_byte_offset, SEEK_SET) < 0) {
     7.8 +	if (SDL_RWseek (data->rwops, absolute_byte_offset, RW_SEEK_SET) < 0) {
     7.9  		return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
    7.10  	}
    7.11  	else {
    7.12 @@ -133,9 +133,9 @@
    7.13  	FLAC_music *data = (FLAC_music*)client_data;
    7.14  
    7.15  	int pos = SDL_RWtell (data->rwops);
    7.16 -	int length = SDL_RWseek (data->rwops, 0, SEEK_END);
    7.17 +	int length = SDL_RWseek (data->rwops, 0, RW_SEEK_END);
    7.18  
    7.19 -	if (SDL_RWseek (data->rwops, pos, SEEK_SET) != pos || length < 0) {
    7.20 +	if (SDL_RWseek (data->rwops, pos, RW_SEEK_SET) != pos || length < 0) {
    7.21  		/* there was an error attempting to return the stream to the original
    7.22  		 * position, or the length was invalid. */
    7.23  		return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
    7.24 @@ -153,7 +153,7 @@
    7.25  	FLAC_music *data = (FLAC_music*)client_data;
    7.26  
    7.27  	int pos = SDL_RWtell (data->rwops);
    7.28 -	int end = SDL_RWseek (data->rwops, 0, SEEK_END);
    7.29 +	int end = SDL_RWseek (data->rwops, 0, RW_SEEK_END);
    7.30  
    7.31  	// was the original position equal to the end (a.k.a. the seek didn't move)?
    7.32  	if (pos == end) {
    7.33 @@ -162,7 +162,7 @@
    7.34  	}
    7.35  	else {
    7.36  		// not EOF, return to the original position
    7.37 -		SDL_RWseek (data->rwops, pos, SEEK_SET);
    7.38 +		SDL_RWseek (data->rwops, pos, RW_SEEK_SET);
    7.39  
    7.40  		return false;
    7.41  	}
     8.1 --- a/music_mad.c	Sun Nov 08 17:03:07 2009 +0000
     8.2 +++ b/music_mad.c	Sun Nov 08 17:11:09 2009 +0000
     8.3 @@ -314,7 +314,7 @@
     8.4  	mp3_mad->output_begin = 0;
     8.5  	mp3_mad->output_end = 0;
     8.6  
     8.7 -	SDL_RWseek(mp3_mad->rw, 0, SEEK_SET);
     8.8 +	SDL_RWseek(mp3_mad->rw, 0, RW_SEEK_SET);
     8.9    }
    8.10  
    8.11    /* Now we have to skip frames until we come to the right one.
     9.1 --- a/music_mod.c	Sun Nov 08 17:03:07 2009 +0000
     9.2 +++ b/music_mod.c	Sun Nov 08 17:11:09 2009 +0000
     9.3 @@ -206,9 +206,9 @@
     9.4  		0
     9.5  	};
     9.6  	lmmmr.offset = SDL_RWtell(rw);
     9.7 -	SDL_RWseek(rw, 0, SEEK_END);
     9.8 +	SDL_RWseek(rw, 0, RW_SEEK_END);
     9.9  	lmmmr.eof = SDL_RWtell(rw);
    9.10 -	SDL_RWseek(rw, lmmmr.offset, SEEK_SET);
    9.11 +	SDL_RWseek(rw, lmmmr.offset, RW_SEEK_SET);
    9.12          lmmmr.rw = rw;
    9.13  	return mikmod.Player_LoadGeneric((MREADER*)&lmmmr, maxchan, 0);
    9.14  }
    10.1 --- a/native_midi_gpl/native_midi_gpl.c	Sun Nov 08 17:03:07 2009 +0000
    10.2 +++ b/native_midi_gpl/native_midi_gpl.c	Sun Nov 08 17:11:09 2009 +0000
    10.3 @@ -222,9 +222,9 @@
    10.4  		return NULL;
    10.5  	};
    10.6  
    10.7 -	SDL_RWseek(rw, 0, SEEK_END);
    10.8 +	SDL_RWseek(rw, 0, RW_SEEK_END);
    10.9  	song->file_size = SDL_RWtell(rw);
   10.10 -	SDL_RWseek(rw, 0, SEEK_SET);
   10.11 +	SDL_RWseek(rw, 0, RW_SEEK_SET);
   10.12  
   10.13  	song->filebuf = malloc(song->file_size);
   10.14  	if (!song->filebuf) {
    11.1 --- a/timidity/readmidi.c	Sun Nov 08 17:03:07 2009 +0000
    11.2 +++ b/timidity/readmidi.c	Sun Nov 08 17:11:09 2009 +0000
    11.3 @@ -349,7 +349,7 @@
    11.4  			  "(MIDI port number %d)", midi_port_number);
    11.5  		    midi_port_number &= 0x03;
    11.6  		}
    11.7 -		else SDL_RWseek(rw, len, SEEK_CUR);
    11.8 +		else SDL_RWseek(rw, len, RW_SEEK_CUR);
    11.9  		break;
   11.10  
   11.11  	      case 0x2F: /* End of Track */
   11.12 @@ -362,7 +362,7 @@
   11.13  	      default:
   11.14  		ctl->cmsg(CMSG_INFO, VERB_DEBUG, 
   11.15  		     "(Meta event type 0x%02x, length %ld)", type, len);
   11.16 -		SDL_RWseek(rw, len, SEEK_CUR);
   11.17 +		SDL_RWseek(rw, len, RW_SEEK_CUR);
   11.18  		break;
   11.19  	      }
   11.20  	}
   11.21 @@ -1028,7 +1028,7 @@
   11.22        ctl->cmsg(CMSG_WARNING, VERB_NORMAL, 
   11.23  	   "%s: MIDI file header size %ld bytes", 
   11.24  	   current_filename, len);
   11.25 -      SDL_RWseek(rw, len-6, SEEK_CUR); /* skip the excess */
   11.26 +      SDL_RWseek(rw, len-6, RW_SEEK_CUR); /* skip the excess */
   11.27      }
   11.28    if (format<0 || format >2)
   11.29      {
    12.1 --- a/wavestream.c	Sun Nov 08 17:03:07 2009 +0000
    12.2 +++ b/wavestream.c	Sun Nov 08 17:11:09 2009 +0000
    12.3 @@ -169,7 +169,7 @@
    12.4  /* Start playback of a given WAV stream */
    12.5  void WAVStream_Start(WAVStream *wave)
    12.6  {
    12.7 -	SDL_RWseek (wave->rw, wave->start, SEEK_SET);
    12.8 +	SDL_RWseek (wave->rw, wave->start, RW_SEEK_SET);
    12.9  	music = wave;
   12.10  }
   12.11  
   12.12 @@ -281,7 +281,7 @@
   12.13  			return(-1);
   12.14  		}
   12.15  	} else {
   12.16 -		SDL_RWseek(src, chunk->length, SEEK_CUR);
   12.17 +		SDL_RWseek(src, chunk->length, RW_SEEK_CUR);
   12.18  	}
   12.19  	return(chunk->length);
   12.20  }
   12.21 @@ -487,7 +487,7 @@
   12.22  		    break;
   12.23  	    }
   12.24  	} while ((!found_SSND || !found_COMM)
   12.25 -		 && SDL_RWseek(src, next_chunk, SEEK_SET) != -1);
   12.26 +		 && SDL_RWseek(src, next_chunk, RW_SEEK_SET) != -1);
   12.27  
   12.28  	if (!found_SSND) {
   12.29  	    Mix_SetError("Bad AIFF file (no SSND chunk)");