Browse Source

Improve warning handling for MSVC

Stanislav Denisov 5 years ago
parent
commit
fe59115f3b
1 changed files with 10 additions and 5 deletions
  1. 10 5
      Source/Native/enet.h

+ 10 - 5
Source/Native/enet.h

@@ -60,11 +60,6 @@
 */
 
 #ifdef _WIN32
-	#if defined(_MSC_VER) && defined(ENET_IMPLEMENTATION)
-		#pragma warning(disable: 4244) /* 64-bit to 32-bit integer conversion */
-		#pragma warning(disable: 4267) /* size_t to integer conversion */
-	#endif
-
 	#ifndef ENET_NO_PRAGMA_LINK
 		#pragma comment(lib, "ws2_32.lib")
 		#pragma comment(lib, "winmm.lib")
@@ -827,6 +822,12 @@ extern "C" {
 		#include "mingw/inet_pton.c"
 	#endif
 
+	#ifdef _MSC_VER
+		#pragma warning(push)
+		#pragma warning(disable: 4244) /* 64-bit to 32-bit integer conversion */
+		#pragma warning(disable: 4267) /* size_t to integer conversion */
+	#endif
+
 /*
 =======================================================================
 
@@ -5145,6 +5146,10 @@ extern "C" {
 		peer->data = (enet_uint32*)data;
 	}
 
+	#ifdef _MSC_VER
+		#pragma warning(pop)
+	#endif
+
 #endif // ENET_IMPLEMENTATION
 
 #endif // ENET_H