1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-22 23:58:48 -05:00

Do a dumb-ass static string copy for const-incorrect old versions of ov_fopen

This commit is contained in:
Perttu Ahola 2012-03-27 00:06:26 +03:00
parent d01387a82f
commit cbe11fc7aa

View File

@ -117,8 +117,13 @@ SoundBuffer* loadOggFile(const std::string &filepath)
vorbis_info *pInfo;
OggVorbis_File oggFile;
// Do a dumb-ass static string copy for old versions of ov_fopen
// because they expect a non-const char*
char nonconst[10000];
snprintf(nonconst, 10000, "%s", filepath.c_str());
// Try opening the given file
if(ov_fopen(filepath.c_str(), &oggFile) != 0)
//if(ov_fopen(filepath.c_str(), &oggFile) != 0)
if(ov_fopen(nonconst, &oggFile) != 0)
{
infostream<<"Audio: Error opening "<<filepath<<" for decoding"<<std::endl;
return NULL;