1
0
forked from 0ad/0ad

Used mem_free_h on the Handle returned by vfs_load

This was SVN commit r842.
This commit is contained in:
Ykkrosh 2004-07-29 16:12:27 +00:00
parent 7820919689
commit 36c502713b
3 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
$Id: unifont.cpp,v 1.10 2004/07/24 14:03:25 philip Exp $
$Id: unifont.cpp,v 1.11 2004/07/29 16:11:33 philip Exp $
Unicode OpenGL texture font
@ -66,14 +66,17 @@ static int UniFont_reload(UniFont* f, const char* fn, Handle UNUSEDPARAM(h))
size_t FNTSize;
std::string FilenameFnt = FilenameBase+".fnt";
const char* fnt_fn = FilenameFnt.c_str();
Handle err = vfs_load(fnt_fn, RawFNT, FNTSize);
Handle fh = vfs_load(fnt_fn, RawFNT, FNTSize);
if (err <= 0)
return (int)err;
if (fh <= 0)
return (int)fh;
// Get the data in a nicer object
std::istringstream FNTStream (std::string((char*)RawFNT, (int)FNTSize));
// Unload the file
mem_free_h(fh);
int Version;
FNTStream >> Version;
assert (Version == 100); // Make sure this is from a recent version of the font builder

View File

@ -6,6 +6,7 @@
#include "CLogger.h"
#include "res/vfs.h"
#include "res/file.h"
#include "res/mem.h"
#include "scripting/ScriptingHost.h"
#include "types.h"
@ -321,7 +322,7 @@ bool CConfigDB::Reload(EConfigNamespace ns)
// Close the correct file handle
if (m_UseVFS[ns])
{
vfs_close(fh);
mem_free_h(fh);
}
else
{

View File

@ -147,6 +147,7 @@ void CMusicPlayer::open(char *filename)
size_t sizeOfFile;
if(vfs_load(filename, p, sizeOfFile) <= 0)
return;
// TODO maybe: Free the mem handle returned by vfs_load (using mem_free_h) ??
memFile.dataPtr = (char*)p;
memFile.dataRead = 0;