diff --git a/libs/tinyxml2/tinyxml2.cpp b/libs/tinyxml2/tinyxml2.cpp index ed312abb0a..6a3b61d1ca 100644 --- a/libs/tinyxml2/tinyxml2.cpp +++ b/libs/tinyxml2/tinyxml2.cpp @@ -741,6 +741,7 @@ bool XMLDocument::Accept( XMLVisitor* visitor ) const XMLNode::XMLNode( XMLDocument* doc ) : _document( doc ), _parent( 0 ), + _value(), _parseLineNum( 0 ), _firstChild( 0 ), _lastChild( 0 ), _prev( 0 ), _next( 0 ), @@ -911,6 +912,13 @@ XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ) TIXMLASSERT( false ); return 0; } + if ( afterThis == addThis ) { + // Current state: BeforeThis -> AddThis -> OneAfterAddThis + // Now AddThis must disappear from it's location and then + // reappear between BeforeThis and OneAfterAddThis. + // So just leave it where it is. + return addThis; + } if ( afterThis->_next == 0 ) { // The last node or the only node. @@ -1993,9 +2001,16 @@ XMLDocument::XMLDocument( bool processEntities, Whitespace whitespaceMode ) : _processEntities( processEntities ), _errorID(XML_SUCCESS), _whitespaceMode( whitespaceMode ), + _errorStr1(), + _errorStr2(), _errorLineNum( 0 ), _charBuffer( 0 ), - _parseCurLineNum( 0 ) + _parseCurLineNum( 0 ), + _unlinked(), + _elementPool(), + _attributePool(), + _textPool(), + _commentPool() { // avoid VC++ C4355 warning about 'this' in initializer list (C4355 is off by default in VS2012+) _document = this; @@ -2367,12 +2382,14 @@ void XMLDocument::Parse() XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : _elementJustOpened( false ), + _stack(), _firstElement( true ), _fp( file ), _depth( depth ), _textDepth( -1 ), _processEntities( true ), - _compactMode( compact ) + _compactMode( compact ), + _buffer() { for( int i=0; i class MemPoolT : public MemPool { public: - MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {} + MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {} ~MemPoolT() { Clear(); } @@ -1218,7 +1219,7 @@ class TINYXML2_LIB XMLAttribute private: enum { BUF_SIZE = 200 }; - XMLAttribute() : _parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {} + XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {} virtual ~XMLAttribute() {} XMLAttribute( const XMLAttribute& ); // not supported @@ -1701,7 +1702,7 @@ class TINYXML2_LIB XMLDocument : public XMLNode Returns XML_SUCCESS (0) on success, or an errorID. */ - XMLError SaveFile( std::FILE* fp, bool compact = false ); + XMLError SaveFile( FILE* fp, bool compact = false ); bool ProcessEntities() const { return _processEntities; @@ -1955,16 +1956,13 @@ class TINYXML2_LIB XMLHandle CUSTOM_MEM_ALLOCATION_IMPL public: /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - XMLHandle( XMLNode* node ) { - _node = node; + XMLHandle( XMLNode* node ) : _node( node ) { } /// Create a handle from a node. - XMLHandle( XMLNode& node ) { - _node = &node; + XMLHandle( XMLNode& node ) : _node( &node ) { } /// Copy constructor - XMLHandle( const XMLHandle& ref ) { - _node = ref._node; + XMLHandle( const XMLHandle& ref ) : _node( ref._node ) { } /// Assignment XMLHandle& operator=( const XMLHandle& ref ) { @@ -2039,14 +2037,11 @@ class TINYXML2_LIB XMLConstHandle { CUSTOM_MEM_ALLOCATION_IMPL public: - XMLConstHandle( const XMLNode* node ) { - _node = node; + XMLConstHandle( const XMLNode* node ) : _node( node ) { } - XMLConstHandle( const XMLNode& node ) { - _node = &node; + XMLConstHandle( const XMLNode& node ) : _node( &node ) { } - XMLConstHandle( const XMLConstHandle& ref ) { - _node = ref._node; + XMLConstHandle( const XMLConstHandle& ref ) : _node( ref._node ) { } XMLConstHandle& operator=( const XMLConstHandle& ref ) { @@ -2262,6 +2257,10 @@ class TINYXML2_LIB XMLPrinter : public XMLVisitor bool _restrictedEntityFlag[ENTITY_RANGE]; DynArray< char, 20 > _buffer; + + // Prohibit cloning, intentionally not implemented + XMLPrinter( const XMLPrinter& ); + XMLPrinter& operator=( const XMLPrinter& ); };