r793 - trunk/code/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed May 31 20:14:56 EDT 2006
Author: thilo
Date: 2006-05-31 20:14:56 -0400 (Wed, 31 May 2006)
New Revision: 793
Modified:
trunk/code/client/snd_codec.c
trunk/code/client/snd_codec_ogg.c
Log:
Partially applied patch from Joerg Dietrich. Fixes:
- incorrect handling of file names when opening sound files by name without extension
- byte endian issues in ogg decoder.
Modified: trunk/code/client/snd_codec.c
===================================================================
--- trunk/code/client/snd_codec.c 2006-05-29 03:58:15 UTC (rev 792)
+++ trunk/code/client/snd_codec.c 2006-06-01 00:14:56 UTC (rev 793)
@@ -33,13 +33,16 @@
*/
static char *S_FileExtension(const char *fni)
{
- char *fn = (char *)fni;
+ // we should search from the ending to the last '/'
+
+ char *fn = (char *) fni + strlen(fni) - 1;
char *eptr = NULL;
- while(*fn)
+
+ while(*fn != '/' && fn != fni)
{
if(*fn == '.')
eptr = fn;
- fn++;
+ fn--;
}
return eptr;
@@ -63,8 +66,10 @@
while(codec)
{
char fn[MAX_QPATH];
- Q_strncpyz(fn, filename, sizeof(fn) - 4);
- COM_DefaultExtension(fn, sizeof(fn), codec->ext);
+
+ // there is no extension so we do not need to subtract 4 chars
+ Q_strncpyz(fn, filename, MAX_QPATH);
+ COM_DefaultExtension(fn, MAX_QPATH, codec->ext);
// Check it exists
if(FS_ReadFile(fn, NULL) != -1)
Modified: trunk/code/client/snd_codec_ogg.c
===================================================================
--- trunk/code/client/snd_codec_ogg.c 2006-05-29 03:58:15 UTC (rev 792)
+++ trunk/code/client/snd_codec_ogg.c 2006-06-01 00:14:56 UTC (rev 793)
@@ -360,6 +360,13 @@
// Bitstream for the decoder
int BS = 0;
+ // big endian machines want their samples in big endian order
+ int IsBigEndian = 0;
+
+# ifdef Q3_BIG_ENDIAN
+ IsBigEndian = 1;
+# endif // Q3_BIG_ENDIAN
+
// check if input is valid
if(!(stream && buffer))
{
@@ -379,7 +386,7 @@
while(-1)
{
// read some bytes from the OGG codec
- c = ov_read((OggVorbis_File *) stream->ptr, bufPtr, bytesLeft, 0, OGG_SAMPLEWIDTH, 1, &BS);
+ c = ov_read((OggVorbis_File *) stream->ptr, bufPtr, bytesLeft, IsBigEndian, OGG_SAMPLEWIDTH, 1, &BS);
// no more bytes are left
if(c <= 0)
More information about the quake3-commits
mailing list