Skip to content

Commit

Permalink
tinxml2 rev. 8b83b23876
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellukashov committed Oct 22, 2017
1 parent 461ba84 commit beb406b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 20 deletions.
21 changes: 19 additions & 2 deletions libs/tinyxml2/tinyxml2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ),
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<ENTITY_RANGE; ++i ) {
_entityFlag[i] = false;
Expand Down
35 changes: 17 additions & 18 deletions libs/tinyxml2/tinyxml2.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,11 @@ template <class T, int INITIAL_SIZE>
class DynArray
{
public:
DynArray() {
_mem = _pool;
_allocated = INITIAL_SIZE;
_size = 0;
DynArray() :
_mem( _pool ),
_allocated( INITIAL_SIZE ),
_size( 0 )
{
}

~DynArray() {
Expand Down Expand Up @@ -333,7 +334,7 @@ template< int ITEM_SIZE >
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();
}
Expand Down Expand Up @@ -1211,7 +1212,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
Expand Down Expand Up @@ -1947,16 +1948,13 @@ class TINYXML2_LIB XMLHandle
{
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 ) {
Expand Down Expand Up @@ -2030,14 +2028,11 @@ class TINYXML2_LIB XMLHandle
class TINYXML2_LIB XMLConstHandle
{
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 ) {
Expand Down Expand Up @@ -2252,6 +2247,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& );
};


Expand Down

0 comments on commit beb406b

Please sign in to comment.