Skip to content

Commit

Permalink
Merge branch 'tinyxml2-upstream' into tinyxml2-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellukashov committed Oct 22, 2017
2 parents 590588a + beb406b commit a77843e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 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
37 changes: 18 additions & 19 deletions libs/tinyxml2/tinyxml2.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,11 @@ class DynArray
{
CUSTOM_MEM_ALLOCATION_IMPL
public:
DynArray() {
_mem = _pool;
_allocated = INITIAL_SIZE;
_size = 0;
DynArray() :
_mem( _pool ),
_allocated( INITIAL_SIZE ),
_size( 0 )
{
}

~DynArray() {
Expand Down Expand Up @@ -336,7 +337,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 @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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& );
};


Expand Down

0 comments on commit a77843e

Please sign in to comment.