diff --git a/stepmania/src/XmlFile.cpp b/stepmania/src/XmlFile.cpp
index 8d67a5c656..8a3a4c67a7 100644
--- a/stepmania/src/XmlFile.cpp
+++ b/stepmania/src/XmlFile.cpp
@@ -137,11 +137,8 @@ unsigned XNode::LoadAttributes( const RString &xml, PARSEINFO *pi, unsigned iOff
if( iEnd == xml.npos )
{
// error
- if( !pi->error_occur )
- {
- pi->error_occur = true;
+ if( pi->error_string.empty() )
pi->error_string = ssprintf( "<%s> attribute has error ", m_sName.c_str() );
- }
return string::npos;
}
@@ -184,11 +181,8 @@ unsigned XNode::LoadAttributes( const RString &xml, PARSEINFO *pi, unsigned iOff
if( iEnd == xml.npos )
{
// error
- if( !pi->error_occur )
- {
- pi->error_occur = true;
+ if( pi->error_string.empty() )
pi->error_string = ssprintf( "<%s> attribute text: couldn't find matching quote", sName.c_str() );
- }
return string::npos;
}
@@ -237,11 +231,8 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
unsigned iEnd = xml.find( "-->", iOffset );
if( iEnd == string::npos )
{
- if( !pi->error_occur )
- {
- pi->error_occur = true;
+ if( pi->error_string.empty() )
pi->error_string = "Unterminated comment";
- }
return string::npos;
}
@@ -277,11 +268,8 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
if( iOffset == xml.size() || xml[iOffset] != chXMLTagClose )
{
// error:
- if( !pi->error_occur )
- {
- pi->error_occur = true;
+ if( pi->error_string.empty() )
pi->error_string = "Element must be closed.";
- }
// ill-formed tag
return string::npos;
@@ -308,11 +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_occur )
- {
- pi->error_occur = true;
+ if( pi->error_string.empty() )
pi->error_string = ssprintf( "%s must be closed with %s>", m_sName.c_str(), m_sName.c_str() );
- }
// error cos not exist CloseTag
return string::npos;
}
@@ -355,11 +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_occur )
- {
- pi->error_occur = true;
+ if( pi->error_string.empty() )
pi->error_string = ssprintf( "it must be closed with %s>", m_sName.c_str() );
- }
// error
return string::npos;
}
@@ -376,11 +358,8 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
else
{
// not welformed open/close
- if( !pi->error_occur )
- {
- pi->error_occur = true;
+ if( pi->error_string.empty() )
pi->error_string = ssprintf( "'<%s> ... %s>' is not well-formed.", m_sName.c_str(), closename.c_str() );
- }
return string::npos;
}
}
@@ -393,11 +372,8 @@ unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
if( iEnd == string::npos )
{
// error cos not exist CloseTag
- if( !pi->error_occur )
- {
- pi->error_occur = true;
+ if( pi->error_string.empty() )
pi->error_string = 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 e95dccfd28..287ec8f3bc 100644
--- a/stepmania/src/XmlFile.h
+++ b/stepmania/src/XmlFile.h
@@ -38,10 +38,7 @@ typedef multimap XNodes;
// Parse info.
struct PARSEINFO
{
- bool error_occur; // [get] is occurance of error?
RString error_string; // [get] error string
-
- PARSEINFO() { error_occur = false; }
};
// display optional environment
diff --git a/stepmania/src/XmlFileUtil.cpp b/stepmania/src/XmlFileUtil.cpp
index 748b0a90f4..548c44f5e9 100644
--- a/stepmania/src/XmlFileUtil.cpp
+++ b/stepmania/src/XmlFileUtil.cpp
@@ -11,19 +11,12 @@ bool XmlFileUtil::LoadFromFileShowErrors( XNode &xml, RageFileBasic &f )
PARSEINFO pi;
RString s;
if( f.Read( s ) == -1 )
- {
- pi.error_occur = true;
pi.error_string = f.GetError();
-
- goto error;
- }
+ else
+ xml.Load( s, &pi );
+ if( pi.error_string.empty() )
+ return true;
- xml.Load( s, &pi );
- if( pi.error_occur )
- goto error;
- return true;
-
-error:
RString sWarning = ssprintf( "XML: LoadFromFile failed: %s", pi.error_string.c_str() );
LOG->Warn( sWarning );
Dialog::OK( sWarning, "XML_PARSE_ERROR" );