]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump-stdinc.h
The official #define for 32-bit and 64-bit Windows is _WIN32.
[tcpdump] / tcpdump-stdinc.h
index afcf803e8e0bee5e12b0639eae5a7827ecb5866c..54abaf5f06e369167fdbbe478bf4ef01d8aa9302 100644 (file)
@@ -39,7 +39,9 @@
 #ifndef tcpdump_stdinc_h
 #define tcpdump_stdinc_h
 
-#ifdef WIN32
+#include <errno.h>
+
+#ifdef _WIN32
 
 #include <stdint.h>
 #include <stdio.h>
@@ -49,7 +51,6 @@
 #include <ctype.h>
 #include <time.h>
 #include <io.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <net/netdb.h>  /* in wpcap's Win32/include */
@@ -175,7 +176,7 @@ typedef char* caddr_t;
 #define vsnprintf _vsnprintf
 #define RETSIGTYPE void
 
-#else /* WIN32 */
+#else /* _WIN32 */
 
 #include <ctype.h>
 #include <unistd.h>
@@ -197,7 +198,7 @@ typedef char* caddr_t;
 
 #include <arpa/inet.h>
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #ifndef HAVE___ATTRIBUTE__
 #define __attribute__(x)
@@ -234,14 +235,13 @@ typedef char* caddr_t;
  * Note: this also requires that padding be put into the structure,
  * at least for compilers where it's implemented as __attribute__((packed)).
  */
-#if defined(__GNUC__)
+#if !(defined(_MSC_VER) && defined(UNALIGNED))
+/* MSVC may have its own macro defined with the same name and purpose. */
 #undef UNALIGNED
 #define UNALIGNED      __attribute__((packed))
-#else
- /* MSVC may have its own macro defined with the same name and purpose. */
 #endif
 
-#if defined(WIN32) || defined(MSDOS)
+#if defined(_WIN32) || defined(MSDOS)
   #define FOPEN_READ_TXT   "rt"
   #define FOPEN_READ_BIN   "rb"
   #define FOPEN_WRITE_TXT  "wt"