mirror of https://github.com/AxioDL/tinyxml2.git
fix deprecation function mess
This commit is contained in:
parent
ec7777efd5
commit
5ce4d97945
19
tinyxml2.cpp
19
tinyxml2.cpp
|
@ -1190,7 +1190,10 @@ int XMLDocument::LoadFile( const char* filename )
|
||||||
DeleteChildren();
|
DeleteChildren();
|
||||||
InitDocument();
|
InitDocument();
|
||||||
|
|
||||||
|
#pragma warning ( push )
|
||||||
|
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
||||||
FILE* fp = fopen( filename, "rb" );
|
FILE* fp = fopen( filename, "rb" );
|
||||||
|
#pragma warning ( pop )
|
||||||
if ( !fp ) {
|
if ( !fp ) {
|
||||||
SetError( ERROR_FILE_NOT_FOUND, filename, 0 );
|
SetError( ERROR_FILE_NOT_FOUND, filename, 0 );
|
||||||
return errorID;
|
return errorID;
|
||||||
|
@ -1233,7 +1236,10 @@ int XMLDocument::LoadFile( FILE* fp )
|
||||||
|
|
||||||
void XMLDocument::SaveFile( const char* filename )
|
void XMLDocument::SaveFile( const char* filename )
|
||||||
{
|
{
|
||||||
|
#pragma warning ( push )
|
||||||
|
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
||||||
FILE* fp = fopen( filename, "w" );
|
FILE* fp = fopen( filename, "w" );
|
||||||
|
#pragma warning ( pop )
|
||||||
XMLPrinter stream( fp );
|
XMLPrinter stream( fp );
|
||||||
Print( &stream );
|
Print( &stream );
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
|
@ -1286,16 +1292,17 @@ void XMLDocument::SetError( int error, const char* str1, const char* str2 )
|
||||||
void XMLDocument::PrintError() const
|
void XMLDocument::PrintError() const
|
||||||
{
|
{
|
||||||
if ( errorID ) {
|
if ( errorID ) {
|
||||||
char buf1[20] = { 0 };
|
static const int LEN = 20;
|
||||||
char buf2[20] = { 0 };
|
char buf1[LEN] = { 0 };
|
||||||
|
char buf2[LEN] = { 0 };
|
||||||
|
|
||||||
if ( errorStr1 ) {
|
if ( errorStr1 ) {
|
||||||
strncpy( buf1, errorStr1, 20 );
|
TIXML_SNPRINTF( buf1, LEN, "%s", errorStr1 );
|
||||||
buf1[19] = 0;
|
buf1[LEN-1] = 0;
|
||||||
}
|
}
|
||||||
if ( errorStr2 ) {
|
if ( errorStr2 ) {
|
||||||
strncpy( buf2, errorStr2, 20 );
|
TIXML_SNPRINTF( buf2, LEN, "%s", errorStr2 );
|
||||||
buf2[19] = 0;
|
buf2[LEN-1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf( "XMLDocument error id=%d str1=%s str2=%s\n",
|
printf( "XMLDocument error id=%d str1=%s str2=%s\n",
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
|
10
xmltest.cpp
10
xmltest.cpp
|
@ -301,8 +301,12 @@ int main( int /*argc*/, const char* /*argv*/ )
|
||||||
char verifyBuf[256];
|
char verifyBuf[256];
|
||||||
int okay = 0;
|
int okay = 0;
|
||||||
|
|
||||||
|
|
||||||
|
#pragma warning ( push )
|
||||||
|
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
||||||
FILE* saved = fopen( "utf8testout.xml", "r" );
|
FILE* saved = fopen( "utf8testout.xml", "r" );
|
||||||
FILE* verify = fopen( "utf8testverify.xml", "r" );
|
FILE* verify = fopen( "utf8testverify.xml", "r" );
|
||||||
|
#pragma warning ( pop )
|
||||||
|
|
||||||
if ( saved && verify )
|
if ( saved && verify )
|
||||||
{
|
{
|
||||||
|
@ -415,14 +419,20 @@ int main( int /*argc*/, const char* /*argv*/ )
|
||||||
|
|
||||||
XMLTest( "Entity transformation: read. ", expected, context, true );
|
XMLTest( "Entity transformation: read. ", expected, context, true );
|
||||||
|
|
||||||
|
#pragma warning ( push )
|
||||||
|
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
||||||
FILE* textfile = fopen( "textfile.txt", "w" );
|
FILE* textfile = fopen( "textfile.txt", "w" );
|
||||||
|
#pragma warning ( pop )
|
||||||
if ( textfile )
|
if ( textfile )
|
||||||
{
|
{
|
||||||
XMLPrinter streamer( textfile );
|
XMLPrinter streamer( textfile );
|
||||||
psg->Accept( &streamer );
|
psg->Accept( &streamer );
|
||||||
fclose( textfile );
|
fclose( textfile );
|
||||||
}
|
}
|
||||||
|
#pragma warning ( push )
|
||||||
|
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
||||||
textfile = fopen( "textfile.txt", "r" );
|
textfile = fopen( "textfile.txt", "r" );
|
||||||
|
#pragma warning ( pop )
|
||||||
TIXMLASSERT( textfile );
|
TIXMLASSERT( textfile );
|
||||||
if ( textfile )
|
if ( textfile )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue