diff --git a/Quake/common.c b/Quake/common.c index c33e2178..5c4b5bd0 100644 --- a/Quake/common.c +++ b/Quake/common.c @@ -470,7 +470,7 @@ float Q_atof (const char *str) ============================================================================ */ -qboolean bigendien; +qboolean host_bigendian; short (*BigShort) (short l); short (*LittleShort) (short l); @@ -1229,22 +1229,13 @@ void COM_Init (void) N U X I */ if ( *(char *)&i == 0x12 ) - bigendien = true; + host_bigendian = true; else if ( *(char *)&i == 0x78 ) - bigendien = false; + host_bigendian = false; else /* if ( *(char *)&i == 0x34 ) */ Sys_Error ("Unsupported endianism."); - if (bigendien == false) - { - BigShort = ShortSwap; - LittleShort = ShortNoSwap; - BigLong = LongSwap; - LittleLong = LongNoSwap; - BigFloat = FloatSwap; - LittleFloat = FloatNoSwap; - } - else /* we are big endian: */ + if (host_bigendian) { BigShort = ShortNoSwap; LittleShort = ShortSwap; @@ -1253,6 +1244,15 @@ void COM_Init (void) BigFloat = FloatNoSwap; LittleFloat = FloatSwap; } + else /* assumed LITTLE_ENDIAN. */ + { + BigShort = ShortSwap; + LittleShort = ShortNoSwap; + BigLong = LongSwap; + LittleLong = LongNoSwap; + BigFloat = FloatSwap; + LittleFloat = FloatNoSwap; + } if (COM_CheckParm("-fitz")) fitzmode = true; diff --git a/Quake/common.h b/Quake/common.h index c8051085..1e5db27d 100644 --- a/Quake/common.h +++ b/Quake/common.h @@ -85,7 +85,7 @@ void InsertLinkAfter (link_t *l, link_t *after); //============================================================================ -extern qboolean bigendien; +extern qboolean host_bigendian; extern short (*BigShort) (short l); extern short (*LittleShort) (short l); diff --git a/Quake/snd_mp3.c b/Quake/snd_mp3.c index a778c4b5..4330a3e9 100644 --- a/Quake/snd_mp3.c +++ b/Quake/snd_mp3.c @@ -295,13 +295,13 @@ static int mp3_decode(snd_stream_t *stream, byte *buf, int len) sample = 0x7FFF; else sample >>= (MAD_F_FRACBITS + 1 - 16); - if (bigendien) + if (host_bigendian) { *buf++ = (sample >> 8) & 0xFF; *buf++ = sample & 0xFF; } - else - { /* LITTLE_ENDIAN */ + else /* assumed LITTLE_ENDIAN. */ + { *buf++ = sample & 0xFF; *buf++ = (sample >> 8) & 0xFF; } diff --git a/Quake/snd_oss.c b/Quake/snd_oss.c index 68c39922..a077cfb8 100644 --- a/Quake/snd_oss.c +++ b/Quake/snd_oss.c @@ -31,8 +31,9 @@ #include #include #include -// FIXME: is "by the book" but we should take care of -// , and someday. +/* FIXME: is by the book, but we might + * have to take care of , + * and someday. */ #include #include @@ -53,8 +54,8 @@ qboolean SNDDMA_Init (dma_t *dma) unsigned long sz; struct audio_buf_info info; - if (bigendien) FORMAT_S16 = AFMT_S16_BE; - else FORMAT_S16 = AFMT_S16_LE; + if (host_bigendian) FORMAT_S16 = AFMT_S16_BE; + else FORMAT_S16 = AFMT_S16_LE; tmp = COM_CheckParm("-ossdev"); if (tmp != 0 && tmp < com_argc - 1) diff --git a/Quake/snd_vorbis.c b/Quake/snd_vorbis.c index 272d9edf..c754eb2c 100644 --- a/Quake/snd_vorbis.c +++ b/Quake/snd_vorbis.c @@ -35,8 +35,6 @@ #define OGG_SAMPLEWIDTH 2 #define OGG_SIGNED_DATA 1 -static int ogg_bigendian = 0; - /* CALLBACK FUNCTIONS: */ static int ovc_fclose (void *f) @@ -60,8 +58,6 @@ static const ov_callbacks ovc_qfs = static qboolean S_OGG_CodecInitialize (void) { - ogg_bigendian = (bigendien == true) ? 1 : 0; - ogg_codec.initialized = true; return true; } @@ -120,7 +116,7 @@ static snd_stream_t *S_OGG_CodecOpenStream (const char *filename) static int S_OGG_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer) { - int section; /* FIXME: handle section changes! */ + int section; /* FIXME: handle section changes */ int cnt, res, rem; char * ptr; @@ -128,7 +124,7 @@ static int S_OGG_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer) ptr = (char *) buffer; while (1) { - res = ov_read((OggVorbis_File *) stream->priv, ptr, rem, ogg_bigendian, + res = ov_read((OggVorbis_File *) stream->priv, ptr, rem, host_bigendian, OGG_SAMPLEWIDTH, OGG_SIGNED_DATA, §ion); if (res <= 0) break; @@ -156,7 +152,7 @@ static int S_OGG_CodecRewindStream (snd_stream_t *stream) snd_codec_t ogg_codec = { CODECTYPE_OGG, - false, + true, /* always available. */ "ogg", S_OGG_CodecInitialize, S_OGG_CodecShutdown,