From c15d40c4afdabd2b045dcf78faf984b9216cff77 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 8 Nov 2009 17:11:09 +0000 Subject: [PATCH] Use RW_SEEK constants for RWseek() --- load_aiff.c | 4 ++-- load_flac.c | 12 ++++++------ load_ogg.c | 4 ++-- load_voc.c | 6 +++--- mixer.c | 2 +- music.c | 2 +- music_flac.c | 10 +++++----- music_mad.c | 2 +- music_mod.c | 4 ++-- native_midi_gpl/native_midi_gpl.c | 4 ++-- timidity/readmidi.c | 6 +++--- wavestream.c | 6 +++--- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/load_aiff.c b/load_aiff.c index f99079df..69f35a08 100644 --- a/load_aiff.c +++ b/load_aiff.c @@ -177,7 +177,7 @@ SDL_AudioSpec *Mix_LoadAIFF_RW (SDL_RWops *src, int freesrc, next_chunk++; } while ( ( ( (AIFFmagic == AIFF) && ( !found_SSND || !found_COMM ) ) || ( (AIFFmagic == _8SVX ) && ( !found_VHDR || !found_BODY ) ) ) - && SDL_RWseek(src, next_chunk, SEEK_SET) != 1 ); + && SDL_RWseek(src, next_chunk, RW_SEEK_SET) != 1 ); if ( (AIFFmagic == AIFF) && !found_SSND ) { SDL_SetError("Bad AIFF (no SSND chunk)"); @@ -227,7 +227,7 @@ SDL_AudioSpec *Mix_LoadAIFF_RW (SDL_RWops *src, int freesrc, SDL_SetError("Out of memory"); return(NULL); } - SDL_RWseek(src, start, SEEK_SET); + SDL_RWseek(src, start, RW_SEEK_SET); if ( SDL_RWread(src, *audio_buf, *audio_len, 1) != 1 ) { SDL_SetError("Unable to read audio data"); return(NULL); diff --git a/load_flac.c b/load_flac.c index 26b02606..fa3655d7 100644 --- a/load_flac.c +++ b/load_flac.c @@ -81,7 +81,7 @@ static FLAC__StreamDecoderSeekStatus flac_seek_load_cb( { FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data; - if (SDL_RWseek (data->sdl_src, absolute_byte_offset, SEEK_SET) < 0) { + if (SDL_RWseek (data->sdl_src, absolute_byte_offset, RW_SEEK_SET) < 0) { return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; } else { @@ -115,9 +115,9 @@ static FLAC__StreamDecoderLengthStatus flac_length_load_cb( FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data; int pos = SDL_RWtell (data->sdl_src); - int length = SDL_RWseek (data->sdl_src, 0, SEEK_END); + int length = SDL_RWseek (data->sdl_src, 0, RW_SEEK_END); - if (SDL_RWseek (data->sdl_src, pos, SEEK_SET) != pos || length < 0) { + if (SDL_RWseek (data->sdl_src, pos, RW_SEEK_SET) != pos || length < 0) { /* there was an error attempting to return the stream to the original * position, or the length was invalid. */ return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; @@ -134,7 +134,7 @@ static FLAC__bool flac_eof_load_cb(const FLAC__StreamDecoder *decoder, FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data; int pos = SDL_RWtell (data->sdl_src); - int end = SDL_RWseek (data->sdl_src, 0, SEEK_END); + int end = SDL_RWseek (data->sdl_src, 0, RW_SEEK_END); // was the original position equal to the end (a.k.a. the seek didn't move)? if (pos == end) { @@ -143,7 +143,7 @@ static FLAC__bool flac_eof_load_cb(const FLAC__StreamDecoder *decoder, } else { // not EOF, return to the original position - SDL_RWseek (data->sdl_src, pos, SEEK_SET); + SDL_RWseek (data->sdl_src, pos, RW_SEEK_SET); return false; } @@ -328,7 +328,7 @@ SDL_AudioSpec *Mix_LoadFLAC_RW (SDL_RWops *src, int freesrc, if (freesrc) SDL_RWclose (src); else - SDL_RWseek (src, 0, SEEK_SET); + SDL_RWseek (src, 0, RW_SEEK_SET); } if (was_error) diff --git a/load_ogg.c b/load_ogg.c index 9ac072f0..4a128586 100644 --- a/load_ogg.c +++ b/load_ogg.c @@ -53,7 +53,7 @@ static int sdl_close_func_freesrc(void *datasource) static int sdl_close_func_nofreesrc(void *datasource) { - return SDL_RWseek((SDL_RWops*)datasource, 0, SEEK_SET); + return SDL_RWseek((SDL_RWops*)datasource, 0, RW_SEEK_SET); } static long sdl_tell_func(void *datasource) @@ -147,7 +147,7 @@ SDL_AudioSpec *Mix_LoadOGG_RW (SDL_RWops *src, int freesrc, if (freesrc) SDL_RWclose(src); else - SDL_RWseek(src, 0, SEEK_SET); + SDL_RWseek(src, 0, RW_SEEK_SET); } if ( was_error ) diff --git a/load_voc.c b/load_voc.c index 6e022d14..cf2dcccd 100644 --- a/load_voc.c +++ b/load_voc.c @@ -92,7 +92,7 @@ static int voc_check_header(SDL_RWops *src) Uint8 signature[20]; /* "Creative Voice File\032" */ Uint16 datablockofs; - SDL_RWseek(src, 0, SEEK_SET); + SDL_RWseek(src, 0, RW_SEEK_SET); if (SDL_RWread(src, signature, sizeof (signature), 1) != 1) return(0); @@ -108,7 +108,7 @@ static int voc_check_header(SDL_RWops *src) datablockofs = SDL_SwapLE16(datablockofs); - if (SDL_RWseek(src, datablockofs, SEEK_SET) != datablockofs) + if (SDL_RWseek(src, datablockofs, RW_SEEK_SET) != datablockofs) return(0); return(1); /* success! */ @@ -448,7 +448,7 @@ SDL_AudioSpec *Mix_LoadVOC_RW (SDL_RWops *src, int freesrc, if (freesrc) SDL_RWclose(src); else - SDL_RWseek(src, 0, SEEK_SET); + SDL_RWseek(src, 0, RW_SEEK_SET); } if ( was_error ) diff --git a/mixer.c b/mixer.c index 28ed89af..8b96ed1a 100644 --- a/mixer.c +++ b/mixer.c @@ -555,7 +555,7 @@ Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc) /* Find out what kind of audio file this is */ magic = SDL_ReadLE32(src); /* Seek backwards for compatibility with older loaders */ - SDL_RWseek(src, -(int)sizeof(Uint32), SEEK_CUR); + SDL_RWseek(src, -(int)sizeof(Uint32), RW_SEEK_CUR); switch (magic) { case WAVE: diff --git a/music.c b/music.c index 00dbd8b1..7e9e3f1b 100644 --- a/music.c +++ b/music.c @@ -1248,7 +1248,7 @@ Mix_Music *Mix_LoadMUS_RW(SDL_RWops *rw) Mix_SetError("Couldn't read from RWops"); return NULL; } - SDL_RWseek(rw, start, SEEK_SET); + SDL_RWseek(rw, start, RW_SEEK_SET); magic[4]='\0'; moremagic[8] = '\0'; diff --git a/music_flac.c b/music_flac.c index 1ca0059f..ceb9d526 100644 --- a/music_flac.c +++ b/music_flac.c @@ -99,7 +99,7 @@ static FLAC__StreamDecoderSeekStatus flac_seek_music_cb( { FLAC_music *data = (FLAC_music*)client_data; - if (SDL_RWseek (data->rwops, absolute_byte_offset, SEEK_SET) < 0) { + if (SDL_RWseek (data->rwops, absolute_byte_offset, RW_SEEK_SET) < 0) { return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; } else { @@ -133,9 +133,9 @@ static FLAC__StreamDecoderLengthStatus flac_length_music_cb ( FLAC_music *data = (FLAC_music*)client_data; int pos = SDL_RWtell (data->rwops); - int length = SDL_RWseek (data->rwops, 0, SEEK_END); + int length = SDL_RWseek (data->rwops, 0, RW_SEEK_END); - if (SDL_RWseek (data->rwops, pos, SEEK_SET) != pos || length < 0) { + if (SDL_RWseek (data->rwops, pos, RW_SEEK_SET) != pos || length < 0) { /* there was an error attempting to return the stream to the original * position, or the length was invalid. */ return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; @@ -153,7 +153,7 @@ static FLAC__bool flac_eof_music_cb( FLAC_music *data = (FLAC_music*)client_data; int pos = SDL_RWtell (data->rwops); - int end = SDL_RWseek (data->rwops, 0, SEEK_END); + int end = SDL_RWseek (data->rwops, 0, RW_SEEK_END); // was the original position equal to the end (a.k.a. the seek didn't move)? if (pos == end) { @@ -162,7 +162,7 @@ static FLAC__bool flac_eof_music_cb( } else { // not EOF, return to the original position - SDL_RWseek (data->rwops, pos, SEEK_SET); + SDL_RWseek (data->rwops, pos, RW_SEEK_SET); return false; } diff --git a/music_mad.c b/music_mad.c index ff21e64b..e9dfead3 100644 --- a/music_mad.c +++ b/music_mad.c @@ -314,7 +314,7 @@ mad_seek(mad_data *mp3_mad, double position) { mp3_mad->output_begin = 0; mp3_mad->output_end = 0; - SDL_RWseek(mp3_mad->rw, 0, SEEK_SET); + SDL_RWseek(mp3_mad->rw, 0, RW_SEEK_SET); } /* Now we have to skip frames until we come to the right one. diff --git a/music_mod.c b/music_mod.c index cffada8b..7617bf98 100644 --- a/music_mod.c +++ b/music_mod.c @@ -206,9 +206,9 @@ MODULE *MikMod_LoadSongRW(SDL_RWops *rw, int maxchan) 0 }; lmmmr.offset = SDL_RWtell(rw); - SDL_RWseek(rw, 0, SEEK_END); + SDL_RWseek(rw, 0, RW_SEEK_END); lmmmr.eof = SDL_RWtell(rw); - SDL_RWseek(rw, lmmmr.offset, SEEK_SET); + SDL_RWseek(rw, lmmmr.offset, RW_SEEK_SET); lmmmr.rw = rw; return mikmod.Player_LoadGeneric((MREADER*)&lmmmr, maxchan, 0); } diff --git a/native_midi_gpl/native_midi_gpl.c b/native_midi_gpl/native_midi_gpl.c index 3b54c557..eaa96a85 100644 --- a/native_midi_gpl/native_midi_gpl.c +++ b/native_midi_gpl/native_midi_gpl.c @@ -222,9 +222,9 @@ NativeMidiSong *native_midi_loadsong_RW(SDL_RWops *rw) return NULL; }; - SDL_RWseek(rw, 0, SEEK_END); + SDL_RWseek(rw, 0, RW_SEEK_END); song->file_size = SDL_RWtell(rw); - SDL_RWseek(rw, 0, SEEK_SET); + SDL_RWseek(rw, 0, RW_SEEK_SET); song->filebuf = malloc(song->file_size); if (!song->filebuf) { diff --git a/timidity/readmidi.c b/timidity/readmidi.c index 8002041d..b90e63af 100644 --- a/timidity/readmidi.c +++ b/timidity/readmidi.c @@ -349,7 +349,7 @@ static MidiEventList *read_midi_event(void) "(MIDI port number %d)", midi_port_number); midi_port_number &= 0x03; } - else SDL_RWseek(rw, len, SEEK_CUR); + else SDL_RWseek(rw, len, RW_SEEK_CUR); break; case 0x2F: /* End of Track */ @@ -362,7 +362,7 @@ static MidiEventList *read_midi_event(void) default: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "(Meta event type 0x%02x, length %ld)", type, len); - SDL_RWseek(rw, len, SEEK_CUR); + SDL_RWseek(rw, len, RW_SEEK_CUR); break; } } @@ -1028,7 +1028,7 @@ MidiEvent *read_midi_file(SDL_RWops *mrw, int32 *count, int32 *sp) ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "%s: MIDI file header size %ld bytes", current_filename, len); - SDL_RWseek(rw, len-6, SEEK_CUR); /* skip the excess */ + SDL_RWseek(rw, len-6, RW_SEEK_CUR); /* skip the excess */ } if (format<0 || format >2) { diff --git a/wavestream.c b/wavestream.c index b1305d19..74d79b09 100644 --- a/wavestream.c +++ b/wavestream.c @@ -169,7 +169,7 @@ WAVStream *WAVStream_LoadSong_RW(SDL_RWops *rw, const char *magic) /* Start playback of a given WAV stream */ void WAVStream_Start(WAVStream *wave) { - SDL_RWseek (wave->rw, wave->start, SEEK_SET); + SDL_RWseek (wave->rw, wave->start, RW_SEEK_SET); music = wave; } @@ -281,7 +281,7 @@ static int ReadChunk(SDL_RWops *src, Chunk *chunk, int read_data) return(-1); } } else { - SDL_RWseek(src, chunk->length, SEEK_CUR); + SDL_RWseek(src, chunk->length, RW_SEEK_CUR); } return(chunk->length); } @@ -487,7 +487,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec, break; } } while ((!found_SSND || !found_COMM) - && SDL_RWseek(src, next_chunk, SEEK_SET) != -1); + && SDL_RWseek(src, next_chunk, RW_SEEK_SET) != -1); if (!found_SSND) { Mix_SetError("Bad AIFF file (no SSND chunk)");