From e676f9449d83cdf41af63a32168b6570f431f3fb Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 5 Sep 2005 23:22:15 +0000 Subject: [PATCH] remove unused escaping stuff (don't think this is even part of XML) --- stepmania/src/XmlFile.cpp | 119 +++----------------------------------- stepmania/src/XmlFile.h | 3 +- 2 files changed, 10 insertions(+), 112 deletions(-) diff --git a/stepmania/src/XmlFile.cpp b/stepmania/src/XmlFile.cpp index 1f99eb3e4e..3f8b9cf190 100644 --- a/stepmania/src/XmlFile.cpp +++ b/stepmania/src/XmlFile.cpp @@ -17,7 +17,6 @@ static const char chXMLTagOpen = '<'; static const char chXMLTagClose = '>'; static const char chXMLQuestion = '?'; // used in checking for meta tags: "" static const char chXMLTagPre = '/'; -static const char chXMLEscape = '\\'; // for value field escape static const char chXMLExclamation = '!'; static const char chXMLDash = '-'; @@ -65,97 +64,13 @@ static char* tcsskip( const char* psz ) return (char*)psz; } -// Desc : similar with strchr with escape process -// Param : escape - will be escape character -static const char* tcsechr( const char* pch, int ch, char escape ) -{ - bool bInEscape = false; - while( pch && *pch ) - { - if( *pch == escape && !bInEscape ) - bInEscape = true; - else - { - bInEscape = false; - if( *pch == ch ) - return pch; - } - pch++; - } - return pch; -} - -// Desc : similar with strlen with escape process -// Param : escape - will be escape character -static int tcselen( char escape, const char *start, const char *end ) -{ - int len = 0; - bool bInEscape = false; - while( start && *start && startassign( psz, len ); - } + ps->assign( psz, len ); } XNode::~XNode() @@ -258,20 +162,17 @@ const char* XNode::LoadAttributes( const char* xml, PARSEINFO *pi /*= &piDefault int quote = *xml; if( quote == '"' || quote == '\'' ) { - pEnd = tcsechr( ++xml, quote, chXMLEscape ); + pEnd = strchr( ++xml, quote ); } else { //attr= value> // none quote mode - //pEnd = tcsechr( xml, ' ', '\\' ); - pEnd = tcsepbrk( xml, (" >"), chXMLEscape ); + pEnd = strpbrk( xml, " >" ); } bool trim = pi->trim_value; - char escape = pi->escape_value; - //SetString( xml, pEnd, &attr->m_sValue, trim, chXMLEscape ); - SetString( xml, pEnd, &attr->m_sValue, trim, escape ); + SetString( xml, pEnd, &attr->m_sValue, trim ); xml = pEnd; // ATTRVALUE if( pi->entity_value ) @@ -388,7 +289,7 @@ const char* XNode::Load( const char* xml, PARSEINFO *pi /*= &piDefault*/ ) if( XIsEmptyString( m_sValue ) ) { // Text Value - const char* pEnd = tcsechr( ++xml, chXMLTagOpen, chXMLEscape ); + const char* pEnd = strchr( ++xml, chXMLTagOpen ); if( pEnd == NULL ) { if( !pi->error_occur ) @@ -403,8 +304,7 @@ const char* XNode::Load( const char* xml, PARSEINFO *pi /*= &piDefault*/ ) } bool trim = pi->trim_value; - char escape = pi->escape_value; - SetString( xml, pEnd, &m_sValue, trim, escape ); + SetString( xml, pEnd, &m_sValue, trim ); xml = pEnd; // TEXTVALUE reference @@ -482,7 +382,7 @@ const char* XNode::Load( const char* xml, PARSEINFO *pi /*= &piDefault*/ ) if( xml && XIsEmptyString( m_sValue ) && *xml !=chXMLTagOpen ) { // Text Value - const char* pEnd = tcsechr( xml, chXMLTagOpen, chXMLEscape ); + const char* pEnd = strchr( xml, chXMLTagOpen ); if( pEnd == NULL ) { // error cos not exist CloseTag @@ -497,8 +397,7 @@ const char* XNode::Load( const char* xml, PARSEINFO *pi /*= &piDefault*/ ) } bool trim = pi->trim_value; - char escape = pi->escape_value; - SetString( xml, pEnd, &m_sValue, trim, escape ); + SetString( xml, pEnd, &m_sValue, trim ); xml = pEnd; //TEXTVALUE diff --git a/stepmania/src/XmlFile.h b/stepmania/src/XmlFile.h index 48ac252c52..f5d8d448a3 100644 --- a/stepmania/src/XmlFile.h +++ b/stepmania/src/XmlFile.h @@ -72,7 +72,6 @@ struct PARSEINFO { bool trim_value; // [set] do trim when parse? bool entity_value; // [set] do convert from reference to entity? ( < -> < ) - char escape_value; // [set] escape value (default '\\') char* xml; // [get] xml source bool error_occur; // [get] is occurance of error? @@ -80,7 +79,7 @@ struct PARSEINFO PCODE error_code; // [get] error code CString error_string; // [get] error string - PARSEINFO() { trim_value = true; entity_value = true; xml = NULL; error_occur = false; error_pointer = NULL; error_code = PIE_PARSE_WELL_FORMED; escape_value = 0; } + PARSEINFO() { trim_value = true; entity_value = true; xml = NULL; error_occur = false; error_pointer = NULL; error_code = PIE_PARSE_WELL_FORMED; } }; // display optional environment