fix whitespace conflict

This commit is contained in:
Lee Thomason 2014-12-26 12:22:30 -08:00
commit 9af6ccb3da
2 changed files with 13 additions and 10 deletions

View File

@ -162,7 +162,7 @@ void StrPair::CollapseWhitespace()
// Trim leading space.
_start = XMLUtil::SkipWhiteSpace( _start );
if ( _start && *_start ) {
if ( *_start ) {
char* p = _start; // the read pointer
char* q = _start; // the write pointer
@ -277,6 +277,8 @@ const char* StrPair::GetStr()
const char* XMLUtil::ReadBOM( const char* p, bool* bom )
{
TIXMLASSERT( p );
TIXMLASSERT( bom );
*bom = false;
const unsigned char* pu = reinterpret_cast<const unsigned char*>(p);
// Check for BOM:
@ -286,6 +288,7 @@ const char* XMLUtil::ReadBOM( const char* p, bool* bom )
*bom = true;
p += 3;
}
TIXMLASSERT( p );
return p;
}
@ -505,7 +508,7 @@ char* XMLDocument::Identify( char* p, XMLNode** node )
{
char* const start = p;
p = XMLUtil::SkipWhiteSpace( p );
if( !p || !*p ) {
if( !*p ) {
return p;
}
@ -641,6 +644,7 @@ void XMLNode::DeleteChildren()
void XMLNode::Unlink( XMLNode* child )
{
TIXMLASSERT( child );
TIXMLASSERT( child->_document == _document );
if ( child == _firstChild ) {
_firstChild = _firstChild->_next;
@ -661,6 +665,7 @@ void XMLNode::Unlink( XMLNode* child )
void XMLNode::DeleteChild( XMLNode* node )
{
TIXMLASSERT( node );
TIXMLASSERT( node->_document == _document );
TIXMLASSERT( node->_parent == this );
DeleteNode( node );
@ -1132,7 +1137,7 @@ char* XMLAttribute::ParseDeep( char* p, bool processEntities )
// Skip white space before =
p = XMLUtil::SkipWhiteSpace( p );
if ( !p || *p != '=' ) {
if ( *p != '=' ) {
return 0;
}
@ -1468,7 +1473,7 @@ char* XMLElement::ParseAttributes( char* p )
// Read the attributes.
while( p ) {
p = XMLUtil::SkipWhiteSpace( p );
if ( !p || !(*p) ) {
if ( !(*p) ) {
_document->SetError( XML_ERROR_PARSING_ELEMENT, start, Name() );
return 0;
}
@ -1535,9 +1540,6 @@ char* XMLElement::ParseDeep( char* p, StrPair* strPair )
{
// Read the element name.
p = XMLUtil::SkipWhiteSpace( p );
if ( !p ) {
return 0;
}
// The closing element is the </element> form. It is
// parsed just like a regular element then deleted from
@ -1828,7 +1830,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
const char* p = _charBuffer;
p = XMLUtil::SkipWhiteSpace( p );
p = XMLUtil::ReadBOM( p, &_writeBOM );
if ( !p || !*p ) {
if ( !*p ) {
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
return _errorID;
}
@ -1877,7 +1879,7 @@ XMLError XMLDocument::Parse( const char* p, size_t len )
const char* start = p;
p = XMLUtil::SkipWhiteSpace( p );
p = XMLUtil::ReadBOM( p, &_writeBOM );
if ( !p || !*p ) {
if ( !*p ) {
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
return _errorID;
}

View File

@ -533,10 +533,11 @@ class XMLUtil
{
public:
static const char* SkipWhiteSpace( const char* p ) {
TIXMLASSERT(p);
TIXMLASSERT( p );
while( IsWhiteSpace(*p) ) {
++p;
}
TIXMLASSERT( p );
return p;
}
static char* SkipWhiteSpace( char* p ) {