mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-07 23:02:07 +00:00
Fixes to prev commit - restore ttvfs functionality when reading XML files, and minor other things
This commit is contained in:
parent
4bafcb3e18
commit
065def0674
9 changed files with 73 additions and 24 deletions
|
@ -538,6 +538,29 @@ char *readFile(const std::string& path, unsigned long *size_ret)
|
|||
return buffer;
|
||||
}
|
||||
|
||||
tinyxml2::XMLError readXML(const std::string& fn, tinyxml2::XMLDocument& doc)
|
||||
{
|
||||
unsigned long sz = 0;
|
||||
char *buf = readFile(fn, &sz);
|
||||
tinyxml2::XMLError err = doc.Parse(buf, sz);
|
||||
delete [] buf;
|
||||
return err;
|
||||
}
|
||||
|
||||
tinyxml2::XMLDocument *readXML(const std::string& fn, tinyxml2::XMLError *perr /* = 0 */)
|
||||
{
|
||||
tinyxml2::XMLDocument *doc = new tinyxml2::XMLDocument();
|
||||
tinyxml2::XMLError err = readXML(fn, *doc);
|
||||
if(perr)
|
||||
*perr = err;
|
||||
if(err != tinyxml2::XML_SUCCESS)
|
||||
{
|
||||
delete doc;
|
||||
doc = NULL;
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
/*
|
||||
void pForEachFile(std::string path, std::string type, void callback(const std::string &filename, int param), int param)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue