diff --git a/stepmania/src/XmlFile.cpp b/stepmania/src/XmlFile.cpp
index 8a3a4c67a7..a7342721bd 100644
--- a/stepmania/src/XmlFile.cpp
+++ b/stepmania/src/XmlFile.cpp
@@ -119,7 +119,7 @@ void XNode::Clear()
// Param : pszAttrs - xml of attributes
// pi = parser information
// Return : advanced string pointer. (error return npos)
-unsigned XNode::LoadAttributes( const RString &xml, PARSEINFO *pi, unsigned iOffset )
+unsigned XNode::LoadAttributes( const RString &xml, RString &sErrorOut, unsigned iOffset )
{
while( iOffset < xml.size() )
{
@@ -137,8 +137,8 @@ unsigned XNode::LoadAttributes( const RString &xml, PARSEINFO *pi, unsigned iOff
if( iEnd == xml.npos )
{
// error
- if( pi->error_string.empty() )
- pi->error_string = ssprintf( "<%s> attribute has error ", m_sName.c_str() );
+ if( sErrorOut.empty() )
+ sErrorOut = ssprintf( "<%s> attribute has error ", m_sName.c_str() );
return string::npos;
}
@@ -181,8 +181,8 @@ unsigned XNode::LoadAttributes( const RString &xml, PARSEINFO *pi, unsigned iOff
if( iEnd == xml.npos )
{
// error
- if( pi->error_string.empty() )
- pi->error_string = ssprintf( "<%s> attribute text: couldn't find matching quote", sName.c_str() );
+ if( sErrorOut.empty() )
+ sErrorOut = ssprintf( "<%s> attribute text: couldn't find matching quote", sName.c_str() );
return string::npos;
}
@@ -209,7 +209,7 @@ unsigned XNode::LoadAttributes( const RString &xml, PARSEINFO *pi, unsigned iOff
// Param : pszXml - plain xml text
// pi = parser information
// Return : advanced string pointer (error return npos)
-unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
+unsigned XNode::Load( const RString &xml, RString &sErrorOut, unsigned iOffset )
{
Clear();
@@ -231,8 +231,8 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
unsigned iEnd = xml.find( "-->", iOffset );
if( iEnd == string::npos )
{
- if( pi->error_string.empty() )
- pi->error_string = "Unterminated comment";
+ if( sErrorOut.empty() )
+ sErrorOut = "Unterminated comment";
return string::npos;
}
@@ -240,7 +240,7 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
// Skip -->.
iOffset = iEnd + 3;
- return Load( xml, pi, iOffset );
+ return Load( xml, sErrorOut, iOffset );
}
// XML Node Tag Name Open
@@ -250,7 +250,7 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
iOffset = iTagEnd;
// Generate XML Attributte List
- iOffset = LoadAttributes( xml, pi, iOffset );
+ iOffset = LoadAttributes( xml, sErrorOut, iOffset );
if( iOffset == string::npos )
return string::npos;
@@ -268,8 +268,8 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
if( iOffset == xml.size() || xml[iOffset] != chXMLTagClose )
{
// error:
- if( pi->error_string.empty() )
- pi->error_string = "Element must be closed.";
+ if( sErrorOut.empty() )
+ sErrorOut = "Element must be closed.";
// ill-formed tag
return string::npos;
@@ -282,7 +282,7 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
// just loaded is a meta tag, then Load ourself again using the rest
// of the file until we reach a non-meta tag.
if( !m_sName.empty() && (m_sName[0] == chXMLQuestion || m_sName[0] == chXMLExclamation) )
- iOffset = Load( xml, pi, iOffset );
+ iOffset = Load( xml, sErrorOut, iOffset );
return iOffset;
}
@@ -296,8 +296,8 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
unsigned iEnd = xml.find( chXMLTagOpen, iOffset );
if( iEnd == string::npos )
{
- if( pi->error_string.empty() )
- pi->error_string = ssprintf( "%s must be closed with %s>", m_sName.c_str(), m_sName.c_str() );
+ if( sErrorOut.empty() )
+ sErrorOut = ssprintf( "%s must be closed with %s>", m_sName.c_str(), m_sName.c_str() );
// error cos not exist CloseTag
return string::npos;
}
@@ -314,7 +314,7 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
{
XNode *node = new XNode;
- iOffset = node->Load( xml, pi, iOffset );
+ iOffset = node->Load( xml, sErrorOut, iOffset );
if( !node->m_sName.empty() )
{
DEBUG_ASSERT( node->m_sName.size() );
@@ -340,8 +340,8 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
unsigned iEnd = xml.find_first_of( " >", iOffset );
if( iEnd == string::npos )
{
- if( pi->error_string.empty() )
- pi->error_string = ssprintf( "it must be closed with %s>", m_sName.c_str() );
+ if( sErrorOut.empty() )
+ sErrorOut = ssprintf( "it must be closed with %s>", m_sName.c_str() );
// error
return string::npos;
}
@@ -358,8 +358,8 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
else
{
// not welformed open/close
- if( pi->error_string.empty() )
- pi->error_string = ssprintf( "'<%s> ... %s>' is not well-formed.", m_sName.c_str(), closename.c_str() );
+ if( sErrorOut.empty() )
+ sErrorOut = ssprintf( "'<%s> ... %s>' is not well-formed.", m_sName.c_str(), closename.c_str() );
return string::npos;
}
}
@@ -372,8 +372,8 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
if( iEnd == string::npos )
{
// error cos not exist CloseTag
- if( pi->error_string.empty() )
- pi->error_string = ssprintf( "it must be closed with %s>", m_sName.c_str() );
+ if( sErrorOut.empty() )
+ sErrorOut = ssprintf( "it must be closed with %s>", m_sName.c_str() );
return string::npos;
}
diff --git a/stepmania/src/XmlFile.h b/stepmania/src/XmlFile.h
index 287ec8f3bc..b1744624d6 100644
--- a/stepmania/src/XmlFile.h
+++ b/stepmania/src/XmlFile.h
@@ -35,12 +35,6 @@ typedef multimap XNodes;
Var##Iter != (pNode)->m_childs.end(); \
++Var##Iter )
-// Parse info.
-struct PARSEINFO
-{
- RString error_string; // [get] error string
-};
-
// display optional environment
struct DISP_OPT
{
@@ -82,8 +76,8 @@ public:
void SetValue( const DateTime &v );
// Load/Save XML
- unsigned Load( const RString &sXml, PARSEINFO *pi, unsigned iOffset = 0 );
- unsigned LoadAttributes( const RString &sAttrs, PARSEINFO *pi, unsigned iOffset );
+ unsigned Load( const RString &sXml, RString &sErrorOut, unsigned iOffset = 0 );
+ unsigned LoadAttributes( const RString &sAttrs, RString &sErrorOut, unsigned iOffset );
bool GetXML( RageFileBasic &f, DISP_OPT &opt ) const;
bool GetAttrXML( RageFileBasic &f, DISP_OPT &opt, const RString &sName, const RString &sValue ) const;
RString GetXML() const;
diff --git a/stepmania/src/XmlFileUtil.cpp b/stepmania/src/XmlFileUtil.cpp
index 548c44f5e9..a29ede8ccd 100644
--- a/stepmania/src/XmlFileUtil.cpp
+++ b/stepmania/src/XmlFileUtil.cpp
@@ -8,16 +8,16 @@
bool XmlFileUtil::LoadFromFileShowErrors( XNode &xml, RageFileBasic &f )
{
- PARSEINFO pi;
+ RString sError;
RString s;
if( f.Read( s ) == -1 )
- pi.error_string = f.GetError();
+ sError = f.GetError();
else
- xml.Load( s, &pi );
- if( pi.error_string.empty() )
+ xml.Load( s, sError );
+ if( sError.empty() )
return true;
- RString sWarning = ssprintf( "XML: LoadFromFile failed: %s", pi.error_string.c_str() );
+ RString sWarning = ssprintf( "XML: LoadFromFile failed: %s", sError.c_str() );
LOG->Warn( sWarning );
Dialog::OK( sWarning, "XML_PARSE_ERROR" );
return false;