1
0
forked from 0ad/0ad

add FILE_LONG_LIVED flag when opening XML file in the process of building XMB (avoids warning)

This was SVN commit r3471.
This commit is contained in:
janwas 2006-02-04 22:31:25 +00:00
parent 67f8087b6f
commit 7bf48e95c4
3 changed files with 7 additions and 4 deletions

View File

@ -86,7 +86,7 @@ public:
// Open a VFS path for XML parsing
// returns 0 if successful, -1 on failure
int OpenFile(const char *path);
int OpenFile(const char *path, uint flags);
// Allow the use of externally-loaded files
void OpenBuffer(const char* path, const void* buffer, const size_t buffersize);

View File

@ -49,9 +49,9 @@ XMLCh *XMLTranscode(const char *str)
return XMLString::transcode(str);
}
int CVFSInputSource::OpenFile(const char *path)
int CVFSInputSource::OpenFile(const char *path, uint flags = 0)
{
LibError ret = vfs_load(path, m_pBuffer, m_BufferSize);
LibError ret = vfs_load(path, m_pBuffer, m_BufferSize, flags);
if(ret != ERR_OK)
{
LOG(ERROR, LOG_CATEGORY, "CVFSInputSource: file %s couldn't be loaded (vfs_load: %d)", path, ret);
@ -80,6 +80,7 @@ CVFSInputSource::~CVFSInputSource()
{
// our buffer was vfs_load-ed; free it now
(void)file_buf_free(m_pBuffer);
m_pBuffer = 0;
}
BinInputStream *CVFSInputSource::makeStream() const

View File

@ -247,8 +247,10 @@ PSRETURN CXeromyces::Load(const char* filename)
}
// Open the .xml file
// note: FILE_LONG_LIVED is necessary because we load XML, load DTD,
// and only then free XML.
CVFSInputSource source;
if (source.OpenFile(filename) < 0)
if (source.OpenFile(filename, FILE_LONG_LIVED) < 0)
{
LOG(ERROR, LOG_CATEGORY, "CXeromyces: Failed to open XML file %s", filename);
return PSRETURN_Xeromyces_XMLOpenFailed;