Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tinyxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString )
char buf[ 32 ];

#if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
#if defined(TIXML_SNPRINTF_S)
TIXML_SNPRINTF( buf, sizeof(buf), _TRUNCATE, "&#x%02X;", (unsigned) ( c & 0xff ) );
#else
TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
buf[sizeof(buf) - 1] = '\0';
#endif
#else
sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
#endif
Expand Down
1 change: 1 addition & 0 deletions tinyxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ distribution.
#ifdef TIXML_SAFE
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
// Microsoft visual studio, version 2005 and higher.
#define TIXML_SNPRINTF_S
#define TIXML_SNPRINTF _snprintf_s
#define TIXML_SSCANF sscanf_s
#elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
Expand Down