mirror of
https://github.com/AxioDL/tinyxml2.git
synced 2025-05-15 03:41:30 +00:00
changes for martell to clean up fopen
This commit is contained in:
commit
79869e77f9
39
tinyxml2.cpp
39
tinyxml2.cpp
@ -1542,16 +1542,15 @@ int XMLDocument::LoadFile( const char* filename )
|
|||||||
{
|
{
|
||||||
DeleteChildren();
|
DeleteChildren();
|
||||||
InitDocument();
|
InitDocument();
|
||||||
|
FILE* fp = 0;
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||||
#pragma warning ( push )
|
errno_t err = fopen_s(&fp, filename, "rb" );
|
||||||
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
if ( !fp || err) {
|
||||||
#endif
|
#else
|
||||||
FILE* fp = fopen( filename, "rb" );
|
fp = fopen( filename, "rb" );
|
||||||
#if defined(_MSC_VER)
|
if ( !fp) {
|
||||||
#pragma warning ( pop )
|
#endif
|
||||||
#endif
|
|
||||||
if ( !fp ) {
|
|
||||||
SetError( XML_ERROR_FILE_NOT_FOUND, filename, 0 );
|
SetError( XML_ERROR_FILE_NOT_FOUND, filename, 0 );
|
||||||
return errorID;
|
return errorID;
|
||||||
}
|
}
|
||||||
@ -1598,19 +1597,23 @@ int XMLDocument::LoadFile( FILE* fp )
|
|||||||
|
|
||||||
int XMLDocument::SaveFile( const char* filename, bool compact )
|
int XMLDocument::SaveFile( const char* filename, bool compact )
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
FILE* fp = 0;
|
||||||
#pragma warning ( push )
|
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||||
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
errno_t err = fopen_s(&fp, filename, "w" );
|
||||||
#endif
|
if ( !fp || err) {
|
||||||
FILE* fp = fopen( filename, "w" );
|
#else
|
||||||
#if defined(_MSC_VER)
|
fp = fopen( filename, "rb" );
|
||||||
#pragma warning ( pop )
|
if ( !fp) {
|
||||||
#endif
|
#endif
|
||||||
if ( !fp ) {
|
|
||||||
SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0 );
|
SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0 );
|
||||||
return errorID;
|
return errorID;
|
||||||
|
<<<<<<< HEAD
|
||||||
}
|
}
|
||||||
SaveFile(fp, compact);
|
SaveFile(fp, compact);
|
||||||
|
=======
|
||||||
|
}
|
||||||
|
SaveFile(fp);
|
||||||
|
>>>>>>> martell/master
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
return errorID;
|
return errorID;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user