diff --git a/tinyxml2.h b/tinyxml2.h index 66d7b7e..04f3075 100755 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -106,10 +106,10 @@ static const int TIXML2_PATCH_VERSION = 0; #define TINYXML2_MINOR_VERSION 2 #define TINYXML2_PATCH_VERSION 0 -// A fixed element depth limit is problematic. There needs to be a -// limit to avoid a stack overflow. However, that limit varies per -// system, and the capacity of the stack. On the other hand, it's a trivial -// attack that can result from ill, malicious, or even correctly formed XML, +// A fixed element depth limit is problematic. There needs to be a +// limit to avoid a stack overflow. However, that limit varies per +// system, and the capacity of the stack. On the other hand, it's a trivial +// attack that can result from ill, malicious, or even correctly formed XML, // so there needs to be a limit in place. static const int TINYXML2_MAX_ELEMENT_DEPTH = 100; @@ -349,7 +349,7 @@ public: ~MemPoolT() { Clear(); } - + void Clear() { // Delete the blocks. while( !_blockPtrs.Empty()) { @@ -395,7 +395,7 @@ public: ++_nUntracked; return result; } - + virtual void Free( void* mem ) { if ( !mem ) { return; @@ -572,7 +572,7 @@ public: static bool IsWhiteSpace( char p ) { return !IsUTF8Continuation(p) && isspace( static_cast(p) ); } - + inline static bool IsNameStartChar( unsigned char ch ) { if ( ch >= 128 ) { // This is a heuristic guess in attempt to not implement Unicode-aware isalpha() @@ -583,7 +583,7 @@ public: } return ch == ':' || ch == '_'; } - + inline static bool IsNameChar( unsigned char ch ) { return IsNameStartChar( ch ) || isdigit( ch ) @@ -600,7 +600,7 @@ public: TIXMLASSERT( nChar >= 0 ); return strncmp( p, q, nChar ) == 0; } - + inline static bool IsUTF8Continuation( char p ) { return ( p & 0x80 ) != 0; } @@ -882,11 +882,11 @@ public: Make a copy of this node and all its children. If the 'target' is null, then the nodes will - be allocated in the current document. If 'target' - is specified, the memory will be allocated is the + be allocated in the current document. If 'target' + is specified, the memory will be allocated is the specified XMLDocument. - NOTE: This is probably not the correct tool to + NOTE: This is probably not the correct tool to copy a document, since XMLDocuments can have multiple top level XMLNodes. You probably want to use XMLDocument::DeepCopy() @@ -925,8 +925,8 @@ public: */ virtual bool Accept( XMLVisitor* visitor ) const = 0; - /** - Set user data into the XMLNode. TinyXML-2 in + /** + Set user data into the XMLNode. TinyXML-2 in no way processes or interprets user data. It is initially 0. */ @@ -1384,14 +1384,14 @@ public: } - + /** Given an attribute name, QueryAttribute() returns XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion can't be performed, or XML_NO_ATTRIBUTE if the attribute doesn't exist. It is overloaded for the primitive types, and is a generally more convenient replacement of QueryIntAttribute() and related functions. - + If successful, the result of the conversion will be written to 'value'. If not successful, nothing will be written to 'value'. This allows you to provide default @@ -1530,7 +1530,7 @@ public: @verbatim Hullaballoo!This is text @endverbatim - + For this XML: @verbatim @@ -1544,15 +1544,15 @@ public: /// Convenience method for setting text inside an element. See SetText() for important limitations. void SetText( int value ); /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( unsigned value ); + void SetText( unsigned value ); /// Convenience method for setting text inside an element. See SetText() for important limitations. void SetText(int64_t value); /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( bool value ); + void SetText( bool value ); /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( double value ); + void SetText( double value ); /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( float value ); + void SetText( float value ); /** Convenience method to query the value of a child text node. This is probably best @@ -1626,11 +1626,7 @@ private: XMLElement( const XMLElement& ); // not supported void operator=( const XMLElement& ); // not supported - XMLAttribute* FindAttribute( const char* name ) { - return const_cast(const_cast(this)->FindAttribute( name )); - } XMLAttribute* FindOrCreateAttribute( const char* name ); - //void LinkAttribute( XMLAttribute* attrib ); char* ParseAttributes( char* p, int* curLineNumPtr ); static void DeleteAttribute( XMLAttribute* attribute ); XMLAttribute* CreateAttribute(); @@ -1660,7 +1656,7 @@ class TINYXML2_LIB XMLDocument : public XMLNode friend class XMLElement; // Gives access to SetError and Push/PopDepth, but over-access for everything else. // Wishing C++ had "internal" scope. - friend class XMLNode; + friend class XMLNode; friend class XMLText; friend class XMLComment; friend class XMLDeclaration; @@ -1700,8 +1696,8 @@ public: /** Load an XML file from disk. You are responsible - for providing and closing the FILE*. - + for providing and closing the FILE*. + NOTE: The file should be opened as binary ("rb") not text in order for TinyXML-2 to correctly do newline normalization. @@ -1831,7 +1827,7 @@ public: const char* ErrorName() const; static const char* ErrorIDToName(XMLError errorID); - /** Returns a "long form" error description. A hopefully helpful + /** Returns a "long form" error description. A hopefully helpful diagnostic with location, line number, and/or additional info. */ const char* ErrorStr() const; @@ -1844,7 +1840,7 @@ public: { return _errorLineNum; } - + /// Clear the document, resetting it to the initial state. void Clear(); @@ -1907,8 +1903,8 @@ private: // the stack. Track stack depth, and error out if needed. class DepthTracker { public: - DepthTracker(XMLDocument * document) { - this->_document = document; + DepthTracker(XMLDocument * document) { + this->_document = document; document->PushDepth(); } ~DepthTracker() {