workaround for an out-of-date tinyxml2 version

This commit is contained in:
Erwin Coumans
2018-05-17 12:18:17 -07:00
parent 034dfba3ae
commit ff646fbef2
2 changed files with 22 additions and 3 deletions

View File

@@ -241,7 +241,11 @@ struct BulletMJCFImporterInternalData
return buf; return buf;
#else #else
char row[1024]; char row[1024];
#ifdef G3_TINYXML2
sprintf(row,"unknown line, upgrade tinyxml2 version!");
#else
sprintf(row,"%d",e->GetLineNum()); sprintf(row,"%d",e->GetLineNum());
#endif
std::string str = m_sourceFileName.c_str() + std::string(":") + std::string(row); std::string str = m_sourceFileName.c_str() + std::string(":") + std::string(row);
return str; return str;
#endif #endif
@@ -1491,8 +1495,12 @@ bool BulletMJCFImporter::parseMJCFString(const char* xmlText, MJCFErrorLogger* l
xml_doc.Parse(xmlText); xml_doc.Parse(xmlText);
if (xml_doc.Error()) if (xml_doc.Error())
{ {
#ifdef G3_TINYXML2
logger->reportError("xml reading error (upgrade tinyxml2 version!");
#else
logger->reportError(xml_doc.ErrorStr()); logger->reportError(xml_doc.ErrorStr());
xml_doc.ClearError(); xml_doc.ClearError();
#endif
return false; return false;
} }

View File

@@ -1,5 +1,4 @@
#include "UrdfParser.h" #include "UrdfParser.h"
#include "../../ThirdPartyLibs/tinyxml2/tinyxml2.h" #include "../../ThirdPartyLibs/tinyxml2/tinyxml2.h"
#include "urdfStringSplit.h" #include "urdfStringSplit.h"
#include "urdfLexicalCast.h" #include "urdfLexicalCast.h"
@@ -1504,8 +1503,12 @@ bool UrdfParser::loadUrdf(const char* urdfText, ErrorLogger* logger, bool forceF
xml_doc.Parse(urdfText); xml_doc.Parse(urdfText);
if (xml_doc.Error()) if (xml_doc.Error())
{ {
#ifdef G3_TINYXML2
logger->reportError("xml reading error");
#else
logger->reportError(xml_doc.ErrorStr()); logger->reportError(xml_doc.ErrorStr());
xml_doc.ClearError(); xml_doc.ClearError();
#endif
return false; return false;
} }
@@ -1664,8 +1667,12 @@ bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
xml_doc.Parse(sdfText); xml_doc.Parse(sdfText);
if (xml_doc.Error()) if (xml_doc.Error())
{ {
#ifdef G3_TINYXML2
logger->reportError("xml reading error");
#else
logger->reportError(xml_doc.ErrorStr()); logger->reportError(xml_doc.ErrorStr());
xml_doc.ClearError(); xml_doc.ClearError();
#endif
return false; return false;
} }
@@ -1847,7 +1854,11 @@ std::string UrdfParser::sourceFileLocation(XMLElement* e)
return buf; return buf;
#else #else
char row[1024]; char row[1024];
#ifdef G3_TINYXML2
sprintf(row,"unknown line");
#else
sprintf(row,"%d",e->GetLineNum()); sprintf(row,"%d",e->GetLineNum());
#endif
std::string str = m_urdf2Model.m_sourceFile.c_str() + std::string(":") + std::string(row); std::string str = m_urdf2Model.m_sourceFile.c_str() + std::string(":") + std::string(row);
return str; return str;
#endif #endif