Patch AIXML to work now for import

Not bothering with export at the moment

AIXML"Stream" wasn't even using its stream in its constructor...
Someone clearly hadn't been using ACTUAL C++ for longer than C++'s existence like was claimed
...but then, that's literally impossible, so what could we expect...
And dear lord please stop throwing in constructors...
There are so many better ways to do this...
This use of throwing is why people dislike goto
It's hard to follow flow control that would be better done another way...
One day I'll fix it so it is, until then meh.

Rips out AIFile, since nothing is actually using it anymore and GPL code needs purged.
This commit is contained in:
Lirusaito
2019-02-25 12:45:26 -05:00
parent 0cadfbaddb
commit f4a22ef857
11 changed files with 15 additions and 207 deletions

View File

@@ -32,7 +32,6 @@
#include "aixml.h"
#include "llmd5.h"
#include <boost/tokenizer.hpp>
#include "aifile.h"
//=============================================================================
// Overview
@@ -311,11 +310,10 @@ void AIXMLElement::child(LLDate const& element)
//-----------------------------------------------------------------------------
// AIXMLStream
AIXMLStream::AIXMLStream(LLFILE* fp, bool standalone) : mOfs(fp)
AIXMLStream::AIXMLStream(const std::string& filename, bool standalone) : mOfs(filename)
{
char const* sp = standalone ? " standalone=\"yes\"" : "";
int rc = fprintf(fp, "<?xml version=\"1.0\" encoding=\"utf-8\"%s ?>\n", sp);
if (rc < 0 || ferror(fp))
mOfs << "<?xml version=\"1.0\" encoding=\"utf-8\"" << (standalone ? " standalone=\"yes\"" : LLStringUtil::null) << "?>\n";
if (!mOfs)
{
// I don't think that errno is set to anything else but EBADF here,
// so there is not really any informative message to add here.
@@ -342,7 +340,6 @@ AIXMLParser::AIXMLParser(std::string const& filename, char const* file_desc, std
AIArgs args;
if (!mXmlTree.parseFile(filename, TRUE))
{
AIFile dummy(filename, "rb"); // Check if the file can be opened at all (throws with a more descriptive error if not).
error = "AIXMLParser_Cannot_parse_FILEDESC_FILENAME";
}
else