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