Updated TinyXML
This commit is contained in:
parent
2ba3e6d443
commit
0445585e7d
|
@ -41,7 +41,7 @@ distribution.
|
|||
const char *format [,
|
||||
argument] ...
|
||||
);*/
|
||||
inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... )
|
||||
static inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... )
|
||||
{
|
||||
va_list va;
|
||||
va_start( va, format );
|
||||
|
@ -50,7 +50,7 @@ distribution.
|
|||
return result;
|
||||
}
|
||||
|
||||
inline int TIXML_VSNPRINTF( char* buffer, size_t size, const char* format, va_list va )
|
||||
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 );
|
||||
return result;
|
||||
|
@ -68,7 +68,7 @@ distribution.
|
|||
#define TIXML_VSCPRINTF _vscprintf // VS2003's C runtime has this, but VC6 C runtime or WinCE SDK doesn't have.
|
||||
#else
|
||||
// Microsoft Visual Studio 2003 and earlier or WinCE.
|
||||
inline int TIXML_VSCPRINTF( const char* format, va_list va )
|
||||
static inline int TIXML_VSCPRINTF( const char* format, va_list va )
|
||||
{
|
||||
int len = 512;
|
||||
for (;;) {
|
||||
|
@ -91,7 +91,7 @@ distribution.
|
|||
//#warning( "Using sn* functions." )
|
||||
#define TIXML_SNPRINTF snprintf
|
||||
#define TIXML_VSNPRINTF vsnprintf
|
||||
inline int TIXML_VSCPRINTF( const char* format, va_list va )
|
||||
static inline int TIXML_VSCPRINTF( const char* format, va_list va )
|
||||
{
|
||||
int len = vsnprintf( 0, 0, format, va );
|
||||
TIXMLASSERT( len >= 0 );
|
||||
|
@ -179,6 +179,7 @@ void StrPair::SetStr( const char* str, int flags )
|
|||
{
|
||||
Reset();
|
||||
size_t len = strlen( str );
|
||||
TIXMLASSERT( _start == 0 );
|
||||
_start = new char[ len+1 ];
|
||||
memcpy( _start, str, len+1 );
|
||||
_end = _start + len;
|
||||
|
@ -1944,6 +1945,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 );
|
||||
if ( read != size ) {
|
||||
|
@ -1993,6 +1995,7 @@ XMLError XMLDocument::Parse( const char* p, size_t len )
|
|||
if ( len == (size_t)(-1) ) {
|
||||
len = strlen( p );
|
||||
}
|
||||
TIXMLASSERT( _charBuffer == 0 );
|
||||
_charBuffer = new char[ len+1 ];
|
||||
memcpy( _charBuffer, p, len );
|
||||
_charBuffer[len] = 0;
|
||||
|
|
Loading…
Reference in New Issue