Skip to content

Commit

Permalink
Merge branch 'master' of github.com:leethomason/tinyxml2
Browse files Browse the repository at this point in the history
  • Loading branch information
leethomason committed Mar 18, 2019
2 parents db39dbc + eb2b8c4 commit 61a4c7d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Expand Up @@ -121,8 +121,14 @@ configure_package_config_file(
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}"
)
write_basic_package_version_file(
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
VERSION ${GENERIC_LIB_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME})

install(EXPORT ${CMAKE_PROJECT_NAME}Targets NAMESPACE tinyxml2::
Expand Down
4 changes: 0 additions & 4 deletions dox
Expand Up @@ -38,11 +38,7 @@ PROJECT_NAME = "TinyXML-2"
# could be handy for archiving the generated documentation or if some version
# control system is used.

<<<<<<< HEAD
PROJECT_NUMBER = 7.0.1
=======
PROJECT_NUMBER = 7.0.1
>>>>>>> master

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
24 changes: 12 additions & 12 deletions tinyxml2.cpp
Expand Up @@ -45,14 +45,14 @@ distribution.
{
va_list va;
va_start( va, format );
int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va );
const int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va );
va_end( va );
return result;
}

static inline int TIXML_VSNPRINTF( char* buffer, size_t size, const char* format, va_list va )
{
int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va );
const int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va );
return result;
}

Expand Down Expand Up @@ -197,7 +197,7 @@ char* StrPair::ParseText( char* p, const char* endTag, int strFlags, int* curLin
TIXMLASSERT(curLineNumPtr);

char* start = p;
char endChar = *endTag;
const char endChar = *endTag;
size_t length = strlen( endTag );

// Inner loop of text parsing.
Expand Down Expand Up @@ -310,7 +310,7 @@ const char* StrPair::GetStr()
const int buflen = 10;
char buf[buflen] = { 0 };
int len = 0;
char* adjusted = const_cast<char*>( XMLUtil::GetCharacterRef( p, buf, &len ) );
const char* adjusted = const_cast<char*>( XMLUtil::GetCharacterRef( p, buf, &len ) );
if ( adjusted == 0 ) {
*q = *p;
++p;
Expand Down Expand Up @@ -1017,7 +1017,7 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
break;
}

int initialLineNum = node->_parseLineNum;
const int initialLineNum = node->_parseLineNum;

StrPair endTag;
p = node->ParseDeep( p, &endTag, curLineNumPtr );
Expand All @@ -1029,7 +1029,7 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
break;
}

XMLDeclaration* decl = node->ToDeclaration();
const XMLDeclaration* const decl = node->ToDeclaration();
if ( decl ) {
// Declarations are only allowed at document level
//
Expand All @@ -1038,7 +1038,7 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
//
// Optimized due to a security test case. If the first node is
// a declaration, and the last node is a declaration, then only
// declarations have so far been addded.
// declarations have so far been added.
bool wellLocated = false;

if (ToDocument()) {
Expand Down Expand Up @@ -1373,7 +1373,7 @@ char* XMLAttribute::ParseDeep( char* p, bool processEntities, int* curLineNumPtr
return 0;
}

char endTag[2] = { *p, 0 };
const char endTag[2] = { *p, 0 };
++p; // move past opening quote

p = _value.ParseText( p, endTag, processEntities ? StrPair::ATTRIBUTE_VALUE : StrPair::ATTRIBUTE_VALUE_LEAVE_ENTITIES, curLineNumPtr );
Expand Down Expand Up @@ -1830,7 +1830,7 @@ char* XMLElement::ParseAttributes( char* p, int* curLineNumPtr )
TIXMLASSERT( attrib );
attrib->_parseLineNum = _document->_parseCurLineNum;

int attrLineNum = attrib->_parseLineNum;
const int attrLineNum = attrib->_parseLineNum;

p = attrib->ParseDeep( p, _document->ProcessEntities(), curLineNumPtr );
if ( !p || Attribute( attrib->Name() ) ) {
Expand Down Expand Up @@ -2136,7 +2136,7 @@ static FILE* callfopen( const char* filepath, const char* mode )
TIXMLASSERT( mode );
#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
FILE* fp = 0;
errno_t err = fopen_s( &fp, filepath, mode );
const errno_t err = fopen_s( &fp, filepath, mode );
if ( err ) {
return 0;
}
Expand Down Expand Up @@ -2239,7 +2239,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
const size_t size = filelength;
TIXMLASSERT( _charBuffer == 0 );
_charBuffer = new char[size+1];
size_t read = fread( _charBuffer, 1, size, fp );
const size_t read = fread( _charBuffer, 1, size, fp );
if ( read != size ) {
SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
return _errorID;
Expand Down Expand Up @@ -2332,7 +2332,7 @@ void XMLDocument::SetError( XMLError error, int lineNum, const char* format, ...
_errorLineNum = lineNum;
_errorStr.Reset();

size_t BUFFER_SIZE = 1000;
const size_t BUFFER_SIZE = 1000;
char* buffer = new char[BUFFER_SIZE];

TIXMLASSERT(sizeof(error) <= sizeof(int));
Expand Down
2 changes: 1 addition & 1 deletion tinyxml2.h
Expand Up @@ -303,7 +303,7 @@ class DynArray
TIXMLASSERT( cap > 0 );
if ( cap > _allocated ) {
TIXMLASSERT( cap <= INT_MAX / 2 );
int newAllocated = cap * 2;
const int newAllocated = cap * 2;
T* newMem = new T[newAllocated];
TIXMLASSERT( newAllocated >= _size );
memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs
Expand Down

0 comments on commit 61a4c7d

Please sign in to comment.