mirror of https://github.com/AxioDL/tinyxml2.git
commit
84bd9624c6
18
tinyxml2.cpp
18
tinyxml2.cpp
|
@ -1668,7 +1668,7 @@ XMLError XMLDocument::LoadFile( const char* filename )
|
|||
Clear();
|
||||
FILE* fp = 0;
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
|
||||
errno_t err = fopen_s(&fp, filename, "rb" );
|
||||
if ( !fp || err) {
|
||||
#else
|
||||
|
@ -1729,7 +1729,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
|
|||
XMLError XMLDocument::SaveFile( const char* filename, bool compact )
|
||||
{
|
||||
FILE* fp = 0;
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
|
||||
errno_t err = fopen_s(&fp, filename, "w" );
|
||||
if ( !fp || err) {
|
||||
#else
|
||||
|
@ -1856,7 +1856,17 @@ void XMLPrinter::Print( const char* format, ... )
|
|||
}
|
||||
else {
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||
#if defined(WINCE)
|
||||
int len = 512;
|
||||
do {
|
||||
len = len*2;
|
||||
char* str = new char[len]();
|
||||
len = _vsnprintf(str, len, format, va);
|
||||
delete[] str;
|
||||
}while (len < 0);
|
||||
#else
|
||||
int len = _vscprintf( format, va );
|
||||
#endif
|
||||
#else
|
||||
int len = vsnprintf( 0, 0, format, va );
|
||||
#endif
|
||||
|
@ -1865,7 +1875,11 @@ void XMLPrinter::Print( const char* format, ... )
|
|||
va_start( va, format );
|
||||
char* p = _buffer.PushArr( len ) - 1; // back up over the null terminator.
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||
#if defined(WINCE)
|
||||
_vsnprintf( p, len+1, format, va );
|
||||
#else
|
||||
vsnprintf_s( p, len+1, _TRUNCATE, format, va );
|
||||
#endif
|
||||
#else
|
||||
vsnprintf( p, len+1, format, va );
|
||||
#endif
|
||||
|
|
|
@ -91,7 +91,7 @@ distribution.
|
|||
#endif
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
|
||||
// Microsoft visual studio, version 2005 and higher.
|
||||
/*int _snprintf_s(
|
||||
char *buffer,
|
||||
|
@ -109,6 +109,9 @@ inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... )
|
|||
return result;
|
||||
}
|
||||
#define TIXML_SSCANF sscanf_s
|
||||
#elif defined WINCE
|
||||
#define TIXML_SNPRINTF _snprintf
|
||||
#define TIXML_SSCANF sscanf
|
||||
#else
|
||||
// GCC version 3 and higher
|
||||
//#warning( "Using sn* functions." )
|
||||
|
|
Loading…
Reference in New Issue