diff options
author | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2006-06-01 00:14:56 +0000 |
---|---|---|
committer | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2006-06-01 00:14:56 +0000 |
commit | dbe20c32ad1d8212dbf71c624c8574deac2b224d (patch) | |
tree | 18c35c27dce5eab05bc7cd4e1bb1703d2fd4d83d /code/client/snd_codec.c | |
parent | cf0ba61ef51c48e1b61d342f91d0a8eebc8ac309 (diff) | |
download | ioquake3-aero-dbe20c32ad1d8212dbf71c624c8574deac2b224d.tar.gz ioquake3-aero-dbe20c32ad1d8212dbf71c624c8574deac2b224d.zip |
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.
git-svn-id: svn://svn.icculus.org/quake3/trunk@793 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/client/snd_codec.c')
-rw-r--r-- | code/client/snd_codec.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/code/client/snd_codec.c b/code/client/snd_codec.c index 666452b..1c1a42a 100644 --- a/code/client/snd_codec.c +++ b/code/client/snd_codec.c @@ -33,13 +33,16 @@ S_FileExtension */ 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 @@ static snd_codec_t *S_FindCodecForFile(const char *filename) 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) |