Skip to content

Commit 32da70c

Browse files
committed
update after SDL_Swap rename in SDL3
1 parent 3f45cc3 commit 32da70c

File tree

5 files changed

+251
-251
lines changed

5 files changed

+251
-251
lines changed

src/codecs/load_voc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static int voc_check_header(SDL_IOStream *src)
102102
return 0;
103103
}
104104

105-
datablockofs = SDL_SwapLE16(datablockofs);
105+
datablockofs = SDL_Swap16LE(datablockofs);
106106

107107
if (SDL_SeekIO(src, datablockofs, SDL_IO_SEEK_SET) != datablockofs) {
108108
return 0;
@@ -183,7 +183,7 @@ static int voc_get_block(SDL_IOStream *src, vs_t *v, SDL_AudioSpec *spec)
183183
if (SDL_ReadIO(src, &new_rate_long, sizeof(new_rate_long)) != sizeof(new_rate_long)) {
184184
return 0;
185185
}
186-
new_rate_long = SDL_SwapLE32(new_rate_long);
186+
new_rate_long = SDL_Swap32LE(new_rate_long);
187187
if (new_rate_long == 0) {
188188
Mix_SetError("VOC Sample rate is zero?");
189189
return 0;
@@ -226,7 +226,7 @@ static int voc_get_block(SDL_IOStream *src, vs_t *v, SDL_AudioSpec *spec)
226226
if (SDL_ReadIO(src, &period, sizeof(period)) != sizeof(period)) {
227227
return 0;
228228
}
229-
period = SDL_SwapLE16(period);
229+
period = SDL_Swap16LE(period);
230230

231231
if (SDL_ReadIO(src, &uc, sizeof(uc)) != sizeof(uc)) {
232232
return 0;
@@ -267,7 +267,7 @@ static int voc_get_block(SDL_IOStream *src, vs_t *v, SDL_AudioSpec *spec)
267267
if (SDL_ReadIO(src, &new_rate_short, sizeof(new_rate_short)) != sizeof(new_rate_short)) {
268268
return 0;
269269
}
270-
new_rate_short = SDL_SwapLE16(new_rate_short);
270+
new_rate_short = SDL_Swap16LE(new_rate_short);
271271
if (new_rate_short == 0) {
272272
Mix_SetError("VOC sample rate is zero");
273273
return 0;
@@ -362,7 +362,7 @@ static Uint32 voc_read(SDL_IOStream *src, vs_t *v, Uint8 *buf, SDL_AudioSpec *sp
362362
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
363363
Uint16 *samples = (Uint16 *)buf;
364364
for (; v->rest > 0; v->rest -= 2) {
365-
*samples = SDL_SwapLE16(*samples);
365+
*samples = SDL_Swap16LE(*samples);
366366
samples++;
367367
}
368368
#endif

src/codecs/music_wav.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,9 @@ static int fetch_float64le(void *context, int length)
436436
static int MS_ADPCM_Init(ADPCM_DecoderState *state, const Uint8 *chunk_data, Uint32 chunk_length)
437437
{
438438
const WaveFMTEx *fmt = (WaveFMTEx *)chunk_data;
439-
const Uint16 channels = SDL_SwapLE16(fmt->format.channels);
440-
const Uint16 blockalign = SDL_SwapLE16(fmt->format.blockalign);
441-
const Uint16 bitspersample = SDL_SwapLE16(fmt->format.bitspersample);
439+
const Uint16 channels = SDL_Swap16LE(fmt->format.channels);
440+
const Uint16 blockalign = SDL_Swap16LE(fmt->format.blockalign);
441+
const Uint16 bitspersample = SDL_Swap16LE(fmt->format.bitspersample);
442442
const size_t blockheadersize = (size_t)channels * 7;
443443
const size_t blockdatasize = (size_t)blockalign - blockheadersize;
444444
const size_t blockframebitsize = (size_t)bitspersample * channels;
@@ -474,8 +474,8 @@ static int MS_ADPCM_Init(ADPCM_DecoderState *state, const Uint8 *chunk_data, Uin
474474
return Mix_SetError("Could not read MS ADPCM format header");
475475
}
476476

477-
cbExtSize = SDL_SwapLE16(fmt->cbSize);
478-
samplesperblock = SDL_SwapLE16(fmt->Samples.samplesperblock);
477+
cbExtSize = SDL_Swap16LE(fmt->cbSize);
478+
samplesperblock = SDL_Swap16LE(fmt->Samples.samplesperblock);
479479
/* Number of coefficient pairs. A pair has two 16-bit integers. */
480480
coeffcount = chunk_data[20] | ((size_t)chunk_data[21] << 8);
481481
/* bPredictor, the integer offset into the coefficients array, is only
@@ -711,10 +711,10 @@ static int MS_ADPCM_DecodeBlockData(ADPCM_DecoderState *state)
711711
static int IMA_ADPCM_Init(ADPCM_DecoderState *state, const Uint8 *chunk_data, Uint32 chunk_length)
712712
{
713713
const WaveFMTEx *fmt = (WaveFMTEx *)chunk_data;
714-
const Uint16 formattag = SDL_SwapLE16(fmt->format.encoding);
715-
const Uint16 channels = SDL_SwapLE16(fmt->format.channels);
716-
const Uint16 blockalign = SDL_SwapLE16(fmt->format.blockalign);
717-
const Uint16 bitspersample = SDL_SwapLE16(fmt->format.bitspersample);
714+
const Uint16 formattag = SDL_Swap16LE(fmt->format.encoding);
715+
const Uint16 channels = SDL_Swap16LE(fmt->format.channels);
716+
const Uint16 blockalign = SDL_Swap16LE(fmt->format.blockalign);
717+
const Uint16 bitspersample = SDL_Swap16LE(fmt->format.bitspersample);
718718
const size_t blockheadersize = (size_t)channels * 4;
719719
const size_t blockdatasize = (size_t)blockalign - blockheadersize;
720720
const size_t blockframebitsize = (size_t)bitspersample * channels;
@@ -742,9 +742,9 @@ static int IMA_ADPCM_Init(ADPCM_DecoderState *state, const Uint8 *chunk_data, Ui
742742
* format because the extensible header has wSampePerBlocks too.
743743
*/
744744
} else if (chunk_length >= 20) {
745-
Uint16 cbExtSize = SDL_SwapLE16(fmt->cbSize);
745+
Uint16 cbExtSize = SDL_Swap16LE(fmt->cbSize);
746746
if (cbExtSize >= 2) {
747-
samplesperblock = SDL_SwapLE16(fmt->Samples.samplesperblock);
747+
samplesperblock = SDL_Swap16LE(fmt->Samples.samplesperblock);
748748
}
749749
}
750750

@@ -1365,15 +1365,15 @@ static SDL_bool ParseFMT(WAV_Music *wave, Uint32 chunk_length)
13651365
SDL_zero(fmt);
13661366
SDL_memcpy(&fmt, chunk, size);
13671367

1368-
wave->encoding = SDL_SwapLE16(fmt.format.encoding);
1368+
wave->encoding = SDL_Swap16LE(fmt.format.encoding);
13691369

13701370
if (wave->encoding == EXTENSIBLE_CODE) {
13711371
if (size < sizeof(fmt)) {
13721372
Mix_SetError("Wave format chunk too small");
13731373
SDL_free(chunk);
13741374
return SDL_FALSE;
13751375
}
1376-
wave->encoding = (Uint16)SDL_SwapLE32(fmt.subencoding);
1376+
wave->encoding = (Uint16)SDL_Swap32LE(fmt.subencoding);
13771377
}
13781378

13791379
/* Decode the audio data format */
@@ -1410,8 +1410,8 @@ static SDL_bool ParseFMT(WAV_Music *wave, Uint32 chunk_length)
14101410
}
14111411
SDL_free(chunk);
14121412

1413-
spec->freq = (int)SDL_SwapLE32(fmt.format.frequency);
1414-
bits = (int)SDL_SwapLE16(fmt.format.bitspersample);
1413+
spec->freq = (int)SDL_Swap32LE(fmt.format.frequency);
1414+
bits = (int)SDL_Swap16LE(fmt.format.bitspersample);
14151415
switch (bits) {
14161416
case 4:
14171417
switch(wave->encoding) {
@@ -1464,7 +1464,7 @@ static SDL_bool ParseFMT(WAV_Music *wave, Uint32 chunk_length)
14641464
Mix_SetError("Unknown PCM format with %d bits", bits);
14651465
return SDL_FALSE;
14661466
}
1467-
spec->channels = (Uint8) SDL_SwapLE16(fmt.format.channels);
1467+
spec->channels = (Uint8) SDL_Swap16LE(fmt.format.channels);
14681468
wave->samplesize = spec->channels * (bits / 8);
14691469
/* SDL_CalculateAudioSpec */
14701470
wave->buflen = SDL_AUDIO_BITSIZE(spec->format) / 8;
@@ -1520,11 +1520,11 @@ static SDL_bool ParseSMPL(WAV_Music *wave, Uint32 chunk_length)
15201520
}
15211521
chunk = (SamplerChunk *)data;
15221522

1523-
for (i = 0; i < SDL_SwapLE32(chunk->sample_loops); ++i) {
1523+
for (i = 0; i < SDL_Swap32LE(chunk->sample_loops); ++i) {
15241524
const Uint32 LOOP_TYPE_FORWARD = 0;
1525-
Uint32 loop_type = SDL_SwapLE32(chunk->loops[i].type);
1525+
Uint32 loop_type = SDL_Swap32LE(chunk->loops[i].type);
15261526
if (loop_type == LOOP_TYPE_FORWARD) {
1527-
AddLoopPoint(wave, SDL_SwapLE32(chunk->loops[i].play_count), SDL_SwapLE32(chunk->loops[i].start), SDL_SwapLE32(chunk->loops[i].end));
1527+
AddLoopPoint(wave, SDL_Swap32LE(chunk->loops[i].play_count), SDL_Swap32LE(chunk->loops[i].start), SDL_Swap32LE(chunk->loops[i].end));
15281528
}
15291529
}
15301530

@@ -1540,8 +1540,8 @@ static void read_meta_field(Mix_MusicMetaTags *tags, Mix_MusicMetaTag tag_type,
15401540
char *field = NULL;
15411541
*i += 4;
15421542
len = isID3 ?
1543-
SDL_SwapBE32(*((Uint32 *)(data + *i))) : /* ID3 */
1544-
SDL_SwapLE32(*((Uint32 *)(data + *i))); /* LIST */
1543+
SDL_Swap32BE(*((Uint32 *)(data + *i))) : /* ID3 */
1544+
SDL_Swap32LE(*((Uint32 *)(data + *i))); /* LIST */
15451545
if (len > chunk_length) {
15461546
return; /* Do nothing due to broken lenght */
15471547
}

src/codecs/timidity/instrum.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ static void load_instrument(MidiSong *song, const char *name,
225225
thing = tmpchar;
226226
#define READ_SHORT(thing) \
227227
if (2 != SDL_ReadIO(io, &tmpshort, 2)) goto badread; \
228-
thing = SDL_SwapLE16(tmpshort);
228+
thing = SDL_Swap16LE(tmpshort);
229229
#define READ_LONG(thing) \
230230
if (4 != SDL_ReadIO(io, &tmplong, 4)) goto badread; \
231-
thing = (Sint32)SDL_SwapLE32((Uint32)tmplong);
231+
thing = (Sint32)SDL_Swap32LE((Uint32)tmplong);
232232

233233
SDL_SeekIO(io, 7, SDL_IO_SEEK_CUR); /* Skip the wave name */
234234

@@ -393,7 +393,7 @@ static void load_instrument(MidiSong *song, const char *name,
393393
Sint16 *tmp16=(Sint16 *)sp->data,s;
394394
while (k--)
395395
{
396-
s=SDL_SwapLE16(*tmp16);
396+
s=SDL_Swap16LE(*tmp16);
397397
*tmp16++=s;
398398
}
399399
}

src/codecs/timidity/readmidi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static int read_track(MidiSong *song, int append)
331331
SNDDBG(("Can't read track header.\n"));
332332
return -1;
333333
}
334-
len=(Sint32)SDL_SwapBE32((Uint32)len);
334+
len=(Sint32)SDL_Swap32BE((Uint32)len);
335335
next_pos = SDL_TellIO(song->io) + len;
336336
if (SDL_memcmp(tmp, "MTrk", 4))
337337
{
@@ -582,7 +582,7 @@ MidiEvent *read_midi_file(MidiSong *song, Sint32 *count, Sint32 *sp)
582582
return NULL;
583583
}
584584
}
585-
len=(Sint32)SDL_SwapBE32((Uint32)len);
585+
len=(Sint32)SDL_Swap32BE((Uint32)len);
586586
if (SDL_memcmp(tmp, "MThd", 4) || len < 6)
587587
{
588588
SNDDBG(("Not a MIDI file!\n"));

0 commit comments

Comments
 (0)