Const fix

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4402 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-03-28 23:09:32 +00:00
parent db7f049617
commit 359efe39ac
1 changed files with 4 additions and 2 deletions

View File

@ -422,6 +422,7 @@ TRACK* sound_LoadTrackFromFile(const char *fileName)
TRACK* pTrack; TRACK* pTrack;
PHYSFS_file* fileHandle; PHYSFS_file* fileHandle;
size_t filename_size; size_t filename_size;
char* track_name;
// Use PhysicsFS to open the file // Use PhysicsFS to open the file
fileHandle = PHYSFS_openRead(fileName); fileHandle = PHYSFS_openRead(fileName);
@ -458,13 +459,14 @@ TRACK* sound_LoadTrackFromFile(const char *fileName)
// Set filename pointer; if the filename (as returned by // Set filename pointer; if the filename (as returned by
// GetLastResourceFilename()) is a NULL pointer, then this will be a // GetLastResourceFilename()) is a NULL pointer, then this will be a
// NULL pointer as well. // NULL pointer as well.
pTrack->fileName = filename_size ? (const char*)pTrack + sizeof(TRACK) : NULL; track_name = filename_size ? (char*)(pTrack + 1) : NULL;
// Copy the filename into the struct, if we don't have a NULL pointer // Copy the filename into the struct, if we don't have a NULL pointer
if (filename_size != 0) if (filename_size != 0)
{ {
strcpy((char*)pTrack->fileName, GetLastResourceFilename()); strcpy(track_name, GetLastResourceFilename());
} }
pTrack->fileName = track_name;
// Now use sound_ReadTrackFromBuffer to decode the file's contents // Now use sound_ReadTrackFromBuffer to decode the file's contents
pTrack = sound_DecodeOggVorbisTrack(pTrack, fileHandle); pTrack = sound_DecodeOggVorbisTrack(pTrack, fileHandle);