Shut up visual studio
diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index 8069d04..7ef6d44 100644
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -1509,16 +1509,15 @@
{
DeleteChildren();
InitDocument();
+ FILE* fp = 0;
-#if defined(_MSC_VER)
-#pragma warning ( push )
-#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
-#endif
- FILE* fp = fopen( filename, "rb" );
-#if defined(_MSC_VER)
-#pragma warning ( pop )
-#endif
- if ( !fp ) {
+ #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
+ errno_t err = fopen_s(&fp, filename, "rb" );
+ if ( !fp || err) {
+ #else
+ fp = fopen( filename, "rb" );
+ if ( !fp) {
+ #endif
SetError( XML_ERROR_FILE_NOT_FOUND, filename, 0 );
return errorID;
}
@@ -1565,18 +1564,17 @@
int XMLDocument::SaveFile( const char* filename )
{
-#if defined(_MSC_VER)
-#pragma warning ( push )
-#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
-#endif
- FILE* fp = fopen( filename, "w" );
-#if defined(_MSC_VER)
-#pragma warning ( pop )
-#endif
- if ( !fp ) {
+ FILE* fp = 0;
+ #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
+ errno_t err = fopen_s(&fp, filename, "w" );
+ if ( !fp || err) {
+ #else
+ fp = fopen( filename, "rb" );
+ if ( !fp) {
+ #endif
SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0 );
return errorID;
- }
+ }
SaveFile(fp);
fclose( fp );
return errorID;