From 8658ab4cfdd346f7858715abe9ad294ef74a3e70 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 31 Aug 2015 14:39:23 -0700 Subject: The official #define for 32-bit and 64-bit Windows is _WIN32. It's _WIN32, with a leading underscore, not WIN32. See, for example: https://sourceforge.net/p/predef/wiki/OperatingSystems/ and https://msdn.microsoft.com/en-us/library/b0084kay.aspx *Some* environments may also define WIN32, but we shouldn't depend on that. --- Win32/Include/arpa/nameser.h | 2 +- Win32/Include/net/netdb.h | 2 +- Win32/Src/gai_strerror.c | 4 ++-- Win32/Src/getaddrinfo.c | 2 +- Win32/Src/getopt.c | 2 +- Win32/Src/inet_pton.c | 2 +- bpf/net/bpf_filter.c | 8 ++++---- bpf_image.c | 6 +++--- etherent.c | 6 +++--- gencode.c | 20 ++++++++++---------- grammar.y | 10 +++++----- inet.c | 16 ++++++++-------- nametoaddr.c | 12 ++++++------ optimize.c | 8 ++++---- pcap-common.c | 6 +++--- pcap-int.h | 16 ++++++++-------- pcap-win32.c | 4 ++-- pcap.c | 30 +++++++++++++++--------------- pcap/pcap.h | 18 +++++++++--------- savefile.c | 24 ++++++++++++------------ scanner.l | 12 ++++++------ sf-pcap-ng.c | 6 +++--- sf-pcap.c | 16 ++++++++-------- tests/filtertest.c | 4 ++-- 24 files changed, 118 insertions(+), 118 deletions(-) diff --git a/Win32/Include/arpa/nameser.h b/Win32/Include/arpa/nameser.h index b20dc1e3..c70a655e 100644 --- a/Win32/Include/arpa/nameser.h +++ b/Win32/Include/arpa/nameser.h @@ -61,7 +61,7 @@ #ifndef _NAMESER_H_ #define _NAMESER_H_ -#ifndef WIN32 +#ifndef _WIN32 #include #if (!defined(BSD)) || (BSD < 199306) # include diff --git a/Win32/Include/net/netdb.h b/Win32/Include/net/netdb.h index f7685d25..49fcd509 100644 --- a/Win32/Include/net/netdb.h +++ b/Win32/Include/net/netdb.h @@ -81,7 +81,7 @@ struct rpcent { int r_number; /* rpc program number */ }; -#ifndef WIN32 +#ifndef _WIN32 #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) #define __NETDB_MAXALIASES 35 diff --git a/Win32/Src/gai_strerror.c b/Win32/Src/gai_strerror.c index a36c35d8..d1e70f84 100644 --- a/Win32/Src/gai_strerror.c +++ b/Win32/Src/gai_strerror.c @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/lib/libc/net/gai_strerror.c,v 1.1 2005/0 */ -#ifdef WIN32 +#ifdef _WIN32 #include @@ -80,4 +80,4 @@ WSAAPI gai_strerrorA(int ecode) return "Unknown error"; } -#endif /* gai_strerror */ \ No newline at end of file +#endif /* gai_strerror */ diff --git a/Win32/Src/getaddrinfo.c b/Win32/Src/getaddrinfo.c index d3ebda08..c894d3f7 100644 --- a/Win32/Src/getaddrinfo.c +++ b/Win32/Src/getaddrinfo.c @@ -85,7 +85,7 @@ #ifdef NEED_ADDRINFO_H #include "addrinfo.h" -#ifdef WIN32 +#ifdef _WIN32 #include "ip6_misc.h" #endif #endif diff --git a/Win32/Src/getopt.c b/Win32/Src/getopt.c index 03c2086e..f5e62daa 100644 --- a/Win32/Src/getopt.c +++ b/Win32/Src/getopt.c @@ -59,7 +59,7 @@ getopt(nargc, nargv, ostr) char * const *nargv; const char *ostr; { -#ifdef WIN32 +#ifdef _WIN32 char *__progname="windump"; #else extern char *__progname; diff --git a/Win32/Src/inet_pton.c b/Win32/Src/inet_pton.c index 7fe3813a..462b9baf 100644 --- a/Win32/Src/inet_pton.c +++ b/Win32/Src/inet_pton.c @@ -38,7 +38,7 @@ #include -#ifdef WIN32 +#ifdef _WIN32 #ifndef EAFNOSUPPORT #define EAFNOSUPPORT 97 /* not present in errno.h provided with VC */ #endif diff --git a/bpf/net/bpf_filter.c b/bpf/net/bpf_filter.c index 6cf6f12e..9abbd540 100644 --- a/bpf/net/bpf_filter.c +++ b/bpf/net/bpf_filter.c @@ -42,11 +42,11 @@ #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include @@ -73,7 +73,7 @@ # define MLEN(m) ((m)->m_len) #endif /* defined(__hpux) || SOLARIS */ -#endif /* WIN32 */ +#endif /* _WIN32 */ #include @@ -99,7 +99,7 @@ #endif #ifndef LBL_ALIGN -#ifndef WIN32 +#ifndef _WIN32 #include #endif diff --git a/bpf_image.c b/bpf_image.c index 3e9a23f5..a7beb1f4 100644 --- a/bpf_image.c +++ b/bpf_image.c @@ -23,9 +23,9 @@ #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include #elif HAVE_STDINT_H @@ -35,7 +35,7 @@ #include #endif #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include diff --git a/etherent.c b/etherent.c index 707fd9d1..5cfd1b4c 100644 --- a/etherent.c +++ b/etherent.c @@ -23,9 +23,9 @@ #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include #elif HAVE_STDINT_H @@ -35,7 +35,7 @@ #include #endif #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include diff --git a/gencode.c b/gencode.c index 62007428..85c1a5c6 100644 --- a/gencode.c +++ b/gencode.c @@ -24,9 +24,9 @@ #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include #elif HAVE_STDINT_H @@ -37,7 +37,7 @@ #endif #include #include -#endif /* WIN32 */ +#endif /* _WIN32 */ /* * XXX - why was this included even on UNIX? @@ -46,7 +46,7 @@ #include "ip6_misc.h" #endif -#ifndef WIN32 +#ifndef _WIN32 #ifdef __NetBSD__ #include @@ -55,7 +55,7 @@ #include #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include @@ -95,9 +95,9 @@ #define offsetof(s, e) ((size_t)&((s *)0)->e) #endif #ifdef INET6 -#ifndef WIN32 +#ifndef _WIN32 #include /* for "struct addrinfo" */ -#endif /* WIN32 */ +#endif /* _WIN32 */ #endif /*INET6*/ #include @@ -136,7 +136,7 @@ static jmp_buf top_ctx; static pcap_t *bpf_pcap; /* Hack for handling VLAN and MPLS stacks. */ -#ifdef WIN32 +#ifdef _WIN32 static u_int label_stack_depth = (u_int)-1, vlan_stack_depth = (u_int)-1; #else static u_int label_stack_depth = -1U, vlan_stack_depth = -1U; @@ -440,7 +440,7 @@ pcap_compile(pcap_t *p, struct bpf_program *program, * UN*X, if the platform supports pthreads? If that requires * a separate -lpthread, we might not want to do that. */ -#ifdef WIN32 +#ifdef _WIN32 extern int wsockinit (void); static int done = 0; @@ -515,7 +515,7 @@ pcap_compile(pcap_t *p, struct bpf_program *program, quit: -#ifdef WIN32 +#ifdef _WIN32 LeaveCriticalSection(&g_PcapCompileCriticalSection); #endif diff --git a/grammar.y b/grammar.y index 995a514e..700508b4 100644 --- a/grammar.y +++ b/grammar.y @@ -25,16 +25,16 @@ #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #include #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include -#ifndef WIN32 +#ifndef _WIN32 #if __STDC__ struct mbuf; struct rtentry; @@ -42,7 +42,7 @@ struct rtentry; #include #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include diff --git a/inet.c b/inet.c index e7d2104e..7cd87ad1 100644 --- a/inet.c +++ b/inet.c @@ -36,9 +36,9 @@ #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #include #ifndef MSDOS @@ -54,7 +54,7 @@ struct mbuf; /* Squelch compiler warnings on some platforms for */ struct rtentry; /* declarations in */ #include #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include @@ -62,9 +62,9 @@ struct rtentry; /* declarations in */ #include #include #include -#if !defined(WIN32) && !defined(__BORLANDC__) +#if !defined(_WIN32) && !defined(__BORLANDC__) #include -#endif /* !WIN32 && !__BORLANDC__ */ +#endif /* !_WIN32 && !__BORLANDC__ */ #ifdef HAVE_LIMITS_H #include #else @@ -828,7 +828,7 @@ pcap_freealldevs(pcap_if_t *alldevs) } } -#if !defined(WIN32) && !defined(MSDOS) +#if !defined(_WIN32) && !defined(MSDOS) /* * Return the name of a network interface attached to the system, or NULL @@ -970,7 +970,7 @@ pcap_lookupnet(device, netp, maskp, errbuf) return (0); } -#elif defined(WIN32) +#elif defined(_WIN32) /* * Return the name of a network interface attached to the system, or NULL @@ -1098,4 +1098,4 @@ pcap_lookupnet(device, netp, maskp, errbuf) return (0); } -#endif /* !WIN32 && !MSDOS */ +#endif /* !_WIN32 && !MSDOS */ diff --git a/nametoaddr.c b/nametoaddr.c index e6483a35..eb123615 100644 --- a/nametoaddr.c +++ b/nametoaddr.c @@ -31,10 +31,10 @@ #include #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #include #include /* concession to AIX */ @@ -42,9 +42,9 @@ #include #include -#endif /* WIN32 */ +#endif /* _WIN32 */ -#ifndef WIN32 +#ifndef _WIN32 #ifdef HAVE_ETHER_HOSTTON /* * XXX - do we need any of this if doesn't declare @@ -62,7 +62,7 @@ struct rtentry; /* declarations in */ #endif /* HAVE_ETHER_HOSTTON */ #include #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include @@ -140,7 +140,7 @@ pcap_nametoaddrinfo(const char *name) bpf_u_int32 pcap_nametonetaddr(const char *name) { -#ifndef WIN32 +#ifndef _WIN32 struct netent *np; if ((np = getnetbyname(name)) != NULL) diff --git a/optimize.c b/optimize.c index ada20197..dba8edfd 100644 --- a/optimize.c +++ b/optimize.c @@ -25,9 +25,9 @@ #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include #elif HAVE_STDINT_H @@ -37,7 +37,7 @@ #include #endif #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include @@ -63,7 +63,7 @@ extern int _w32_ffs (int mask); #define ffs _w32_ffs #endif -#if defined(WIN32) && defined (_MSC_VER) +#if defined(_WIN32) && defined (_MSC_VER) int ffs(int mask); #endif diff --git a/pcap-common.c b/pcap-common.c index 4db49688..b4a25028 100644 --- a/pcap-common.c +++ b/pcap-common.c @@ -25,9 +25,9 @@ #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include #elif HAVE_STDINT_H @@ -37,7 +37,7 @@ #include #endif #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include "pcap-int.h" #include "pcap/usb.h" diff --git a/pcap-int.h b/pcap-int.h index 2f71e115..9bdd6049 100644 --- a/pcap-int.h +++ b/pcap-int.h @@ -40,10 +40,10 @@ extern "C" { #endif -#ifdef WIN32 +#ifdef _WIN32 #include extern CRITICAL_SECTION g_PcapCompileCriticalSection; -#endif /* WIN32 */ +#endif /* _WIN32 */ #ifdef MSDOS #include @@ -126,7 +126,7 @@ typedef int (*set_datalink_op_t)(pcap_t *, int); typedef int (*getnonblock_op_t)(pcap_t *, char *); typedef int (*setnonblock_op_t)(pcap_t *, int, char *); typedef int (*stats_op_t)(pcap_t *, struct pcap_stat *); -#ifdef WIN32 +#ifdef _WIN32 typedef int (*setbuff_op_t)(pcap_t *, int); typedef int (*setmode_op_t)(pcap_t *, int); typedef int (*setmintocopy_op_t)(pcap_t *, int); @@ -149,14 +149,14 @@ struct pcap { */ int (*next_packet_op)(pcap_t *, struct pcap_pkthdr *, u_char **); -#ifdef WIN32 +#ifdef _WIN32 ADAPTER *adapter; LPPACKET Packet; int nonblock; #else int fd; int selectable_fd; -#endif /* WIN32 */ +#endif /* _WIN32 */ /* * Read buffer. @@ -240,7 +240,7 @@ struct pcap { */ pcap_handler oneshot_callback; -#ifdef WIN32 +#ifdef _WIN32 /* * These are, at least currently, specific to the Win32 NPF * driver. @@ -376,7 +376,7 @@ extern int vsnprintf (char *, size_t, const char *, va_list ap); /* * Routines that most pcap implementations can use for non-blocking mode. */ -#if !defined(WIN32) && !defined(MSDOS) +#if !defined(_WIN32) && !defined(MSDOS) int pcap_getnonblock_fd(pcap_t *, char *); int pcap_setnonblock_fd(pcap_t *p, int, char *); #endif @@ -448,7 +448,7 @@ void sf_cleanup(pcap_t *p); */ void pcap_oneshot(u_char *, const struct pcap_pkthdr *, const u_char *); -#ifdef WIN32 +#ifdef _WIN32 char *pcap_win32strerror(void); #endif diff --git a/pcap-win32.c b/pcap-win32.c index f449f796..a4e3a08a 100644 --- a/pcap-win32.c +++ b/pcap-win32.c @@ -61,7 +61,7 @@ static int pcap_setnonblock_win32(pcap_t *, int, char *); #define WIN32_DEFAULT_USER_BUFFER_SIZE 256000 /*dimension of the buffer in the kernel driver NPF */ -#define WIN32_DEFAULT_KERNEL_BUFFER_SIZE 1000000 +#define _WIN32_DEFAULT_KERNEL_BUFFER_SIZE 1000000 /* Equivalent to ntohs(), but a lot faster under Windows */ #define SWAPS(_X) ((_X & 0xff) << 8) | (_X >> 8) @@ -655,7 +655,7 @@ pcap_activate_win32(pcap_t *p) * WIN32_DEFAULT_USER_BUFFER_SIZE. */ if (p->opt.buffer_size == 0) - p->opt.buffer_size = WIN32_DEFAULT_KERNEL_BUFFER_SIZE; + p->opt.buffer_size = _WIN32_DEFAULT_KERNEL_BUFFER_SIZE; if(PacketSetBuff(p->adapter,p->opt.buffer_size)==FALSE) { diff --git a/pcap.c b/pcap.c index 4e9c94a7..7769569d 100644 --- a/pcap.c +++ b/pcap.c @@ -35,9 +35,9 @@ #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include #elif HAVE_STDINT_H @@ -47,7 +47,7 @@ #include #endif #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include @@ -115,7 +115,7 @@ pcap_not_initialized(pcap_t *pcap _U_) return (PCAP_ERROR_NOT_ACTIVATED); } -#ifdef WIN32 +#ifdef _WIN32 Adapter * pcap_no_adapter(pcap_t *pcap _U_) { @@ -463,7 +463,7 @@ initialize_ops(pcap_t *p) p->getnonblock_op = (getnonblock_op_t)pcap_not_initialized; p->setnonblock_op = (setnonblock_op_t)pcap_not_initialized; p->stats_op = (stats_op_t)pcap_not_initialized; -#ifdef WIN32 +#ifdef _WIN32 p->setbuff_op = (setbuff_op_t)pcap_not_initialized; p->setmode_op = (setmode_op_t)pcap_not_initialized; p->setmintocopy_op = (setmintocopy_op_t)pcap_not_initialized; @@ -509,7 +509,7 @@ pcap_alloc_pcap_t(char *ebuf, size_t size) */ p = (pcap_t *)chunk; -#ifndef WIN32 +#ifndef _WIN32 p->fd = -1; /* not opened yet */ p->selectable_fd = -1; #endif @@ -1365,7 +1365,7 @@ pcap_file(pcap_t *p) int pcap_fileno(pcap_t *p) { -#ifndef WIN32 +#ifndef _WIN32 return (p->fd); #else if (p->adapter != NULL) @@ -1375,7 +1375,7 @@ pcap_fileno(pcap_t *p) #endif } -#if !defined(WIN32) && !defined(MSDOS) +#if !defined(_WIN32) && !defined(MSDOS) int pcap_get_selectable_fd(pcap_t *p) { @@ -1419,7 +1419,7 @@ pcap_getnonblock(pcap_t *p, char *errbuf) * We don't look at "p->nonblock", in case somebody tweaked the FD * directly. */ -#if !defined(WIN32) && !defined(MSDOS) +#if !defined(_WIN32) && !defined(MSDOS) int pcap_getnonblock_fd(pcap_t *p, char *errbuf) { @@ -1455,7 +1455,7 @@ pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf) return (ret); } -#if !defined(WIN32) && !defined(MSDOS) +#if !defined(_WIN32) && !defined(MSDOS) /* * Set non-blocking mode, under the assumption that it's just the * standard POSIX non-blocking flag. (This can be called by the @@ -1486,7 +1486,7 @@ pcap_setnonblock_fd(pcap_t *p, int nonblock, char *errbuf) } #endif -#ifdef WIN32 +#ifdef _WIN32 /* * Generate a string for the last Win32-specific error (i.e. an error generated when * calling a Win32 API). @@ -1635,7 +1635,7 @@ pcap_stats_dead(pcap_t *p, struct pcap_stat *ps _U_) return (-1); } -#ifdef WIN32 +#ifdef _WIN32 int pcap_setbuff(pcap_t *p, int dim) { @@ -1797,7 +1797,7 @@ pcap_cleanup_live_common(pcap_t *p) p->tstamp_precision_count = 0; } pcap_freecode(&p->fcode); -#if !defined(WIN32) && !defined(MSDOS) +#if !defined(_WIN32) && !defined(MSDOS) if (p->fd >= 0) { close(p->fd); p->fd = -1; @@ -1834,7 +1834,7 @@ pcap_open_dead_with_tstamp_precision(int linktype, int snaplen, u_int precision) p->linktype = linktype; p->opt.tstamp_precision = precision; p->stats_op = pcap_stats_dead; -#ifdef WIN32 +#ifdef _WIN32 p->setbuff_op = pcap_setbuff_dead; p->setmode_op = pcap_setmode_dead; p->setmintocopy_op = pcap_setmintocopy_dead; @@ -1926,7 +1926,7 @@ pcap_offline_filter(const struct bpf_program *fp, const struct pcap_pkthdr *h, static const char pcap_version_string[] = "libpcap version 1.x.y"; #endif -#ifdef WIN32 +#ifdef _WIN32 /* * XXX - it'd be nice if we could somehow generate the WinPcap and libpcap * version numbers when building WinPcap. (It'd be nice to do so for diff --git a/pcap/pcap.h b/pcap/pcap.h index c9fab4c1..045e4872 100644 --- a/pcap/pcap.h +++ b/pcap/pcap.h @@ -35,7 +35,7 @@ #ifndef lib_pcap_pcap_h #define lib_pcap_pcap_h -#if defined(WIN32) +#if defined(_WIN32) #include #elif defined(MSDOS) #include @@ -43,7 +43,7 @@ #else /* UN*X */ #include #include -#endif /* WIN32/MSDOS/UN*X */ +#endif /* _WIN32/MSDOS/UN*X */ #ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H #include @@ -170,9 +170,9 @@ struct pcap_stat { u_int ps_recv; /* number of packets received */ u_int ps_drop; /* number of packets dropped */ u_int ps_ifdrop; /* drops by interface -- only supported on some platforms */ -#ifdef WIN32 +#ifdef _WIN32 u_int bs_capt; /* number of packets that reach the application */ -#endif /* WIN32 */ +#endif /* _WIN32 */ }; #ifdef MSDOS @@ -351,7 +351,7 @@ pcap_t *pcap_open_dead(int, int); pcap_t *pcap_open_dead_with_tstamp_precision(int, int, u_int); pcap_t *pcap_open_offline_with_tstamp_precision(const char *, u_int, char *); pcap_t *pcap_open_offline(const char *, char *); -#if defined(WIN32) +#if defined(_WIN32) pcap_t *pcap_hopen_offline_with_tstamp_precision(intptr_t, u_int, char *); pcap_t *pcap_hopen_offline(intptr_t, char *); #if !defined(LIBPCAP_EXPORTS) @@ -363,10 +363,10 @@ pcap_t *pcap_hopen_offline(intptr_t, char *); static pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *); static pcap_t *pcap_fopen_offline(FILE *, char *); #endif -#else /*WIN32*/ +#else /*_WIN32*/ pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *); pcap_t *pcap_fopen_offline(FILE *, char *); -#endif /*WIN32*/ +#endif /*_WIN32*/ void pcap_close(pcap_t *); int pcap_loop(pcap_t *, int, pcap_handler, u_char *); @@ -438,7 +438,7 @@ int bpf_validate(const struct bpf_insn *f, int len); char *bpf_image(const struct bpf_insn *, int); void bpf_dump(const struct bpf_program *, int); -#if defined(WIN32) +#if defined(_WIN32) /* * Win32 definitions @@ -476,7 +476,7 @@ u_long pcap_mac_packets (void); int pcap_get_selectable_fd(pcap_t *); -#endif /* WIN32/MSDOS/UN*X */ +#endif /* _WIN32/MSDOS/UN*X */ #ifdef __cplusplus } diff --git a/savefile.c b/savefile.c index 783ec45b..e241b6ba 100644 --- a/savefile.c +++ b/savefile.c @@ -32,9 +32,9 @@ #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include #elif HAVE_STDINT_H @@ -44,7 +44,7 @@ #include #endif #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include @@ -65,7 +65,7 @@ /* * Setting O_BINARY on DOS/Windows is a bit tricky */ -#if defined(WIN32) +#if defined(_WIN32) #define SET_BINMODE(f) _setmode(_fileno(f), _O_BINARY) #elif defined(MSDOS) #if defined(__HIGHC__) @@ -109,7 +109,7 @@ sf_stats(pcap_t *p, struct pcap_stat *ps) return (-1); } -#ifdef WIN32 +#ifdef _WIN32 static int sf_setbuff(pcap_t *p, int dim) { @@ -175,7 +175,7 @@ pcap_open_offline_with_tstamp_precision(const char *fname, u_int precision, if (fname[0] == '-' && fname[1] == '\0') { fp = stdin; -#if defined(WIN32) || defined(MSDOS) +#if defined(_WIN32) || defined(MSDOS) /* * We're reading from the standard input, so put it in binary * mode, as savefiles are binary files. @@ -184,7 +184,7 @@ pcap_open_offline_with_tstamp_precision(const char *fname, u_int precision, #endif } else { -#if !defined(WIN32) && !defined(MSDOS) +#if !defined(_WIN32) && !defined(MSDOS) fp = fopen(fname, "r"); #else fp = fopen(fname, "rb"); @@ -210,7 +210,7 @@ pcap_open_offline(const char *fname, char *errbuf) PCAP_TSTAMP_PRECISION_MICRO, errbuf)); } -#ifdef WIN32 +#ifdef _WIN32 pcap_t* pcap_hopen_offline_with_tstamp_precision(intptr_t osfd, u_int precision, char *errbuf) { @@ -249,7 +249,7 @@ static pcap_t *(*check_headers[])(bpf_u_int32, FILE *, u_int, char *, int *) = { #define N_FILE_TYPES (sizeof check_headers / sizeof check_headers[0]) -#ifdef WIN32 +#ifdef _WIN32 static #endif pcap_t * @@ -313,7 +313,7 @@ found: /* Padding only needed for live capture fcode */ p->fddipad = 0; -#if !defined(WIN32) && !defined(MSDOS) +#if !defined(_WIN32) && !defined(MSDOS) /* * You can do "select()" and "poll()" on plain files on most * platforms, and should be able to do so on pipes. @@ -332,7 +332,7 @@ found: p->getnonblock_op = sf_getnonblock; p->setnonblock_op = sf_setnonblock; p->stats_op = sf_stats; -#ifdef WIN32 +#ifdef _WIN32 p->setbuff_op = sf_setbuff; p->setmode_op = sf_setmode; p->setmintocopy_op = sf_setmintocopy; @@ -354,7 +354,7 @@ found: return (p); } -#ifdef WIN32 +#ifdef _WIN32 static #endif pcap_t * diff --git a/scanner.l b/scanner.l index 72a83f7f..90c76b83 100644 --- a/scanner.l +++ b/scanner.l @@ -20,9 +20,9 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include #elif HAVE_STDINT_H @@ -32,7 +32,7 @@ #include #endif #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include @@ -41,16 +41,16 @@ #include "gencode.h" #ifdef INET6 -#ifdef WIN32 +#ifdef _WIN32 #include #ifdef __MINGW32__ #include "ip6_misc.h" #endif -#else /* WIN32 */ +#else /* _WIN32 */ #include /* for "struct sockaddr" in "struct addrinfo" */ #include /* for "struct addrinfo" */ -#endif /* WIN32 */ +#endif /* _WIN32 */ /* Workaround for AIX 4.3 */ #if !defined(AI_NUMERICHOST) diff --git a/sf-pcap-ng.c b/sf-pcap-ng.c index e2cac049..1eaa67d9 100644 --- a/sf-pcap-ng.c +++ b/sf-pcap-ng.c @@ -30,9 +30,9 @@ static const char rcsid[] _U_ = #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include #elif HAVE_STDINT_H @@ -42,7 +42,7 @@ static const char rcsid[] _U_ = #include #endif #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include diff --git a/sf-pcap.c b/sf-pcap.c index eaeddfa8..f060967a 100644 --- a/sf-pcap.c +++ b/sf-pcap.c @@ -37,9 +37,9 @@ static const char rcsid[] _U_ = #include "config.h" #endif -#ifdef WIN32 +#ifdef _WIN32 #include -#else /* WIN32 */ +#else /* _WIN32 */ #if HAVE_INTTYPES_H #include #elif HAVE_STDINT_H @@ -49,7 +49,7 @@ static const char rcsid[] _U_ = #include #endif #include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include #include @@ -70,7 +70,7 @@ static const char rcsid[] _U_ = /* * Setting O_BINARY on DOS/Windows is a bit tricky */ -#if defined(WIN32) +#if defined(_WIN32) #define SET_BINMODE(f) _setmode(_fileno(f), _O_BINARY) #elif defined(MSDOS) #if defined(__HIGHC__) @@ -608,7 +608,7 @@ static pcap_dumper_t * pcap_setup_dump(pcap_t *p, int linktype, FILE *f, const char *fname) { -#if defined(WIN32) || defined(MSDOS) +#if defined(_WIN32) || defined(MSDOS) /* * If we're writing to the standard output, put it in binary * mode, as savefiles are binary files. @@ -663,7 +663,7 @@ pcap_dump_open(pcap_t *p, const char *fname) f = stdout; fname = "standard output"; } else { -#if !defined(WIN32) && !defined(MSDOS) +#if !defined(_WIN32) && !defined(MSDOS) f = fopen(fname, "w"); #else f = fopen(fname, "wb"); @@ -715,7 +715,7 @@ pcap_dump_open_append(pcap_t *p, const char *fname) if (fname[0] == '-' && fname[1] == '\0') return (pcap_setup_dump(p, linktype, stdout, "standard output")); -#if !defined(WIN32) && !defined(MSDOS) +#if !defined(_WIN32) && !defined(MSDOS) f = fopen(fname, "r+"); #else f = fopen(fname, "rb+"); @@ -744,7 +744,7 @@ pcap_dump_open_append(pcap_t *p, const char *fname) } } -#if defined(WIN32) || defined(MSDOS) +#if defined(_WIN32) || defined(MSDOS) /* * We turn off buffering. * XXX - why? And why not on the standard output? diff --git a/tests/filtertest.c b/tests/filtertest.c index e45db21e..a7e57389 100644 --- a/tests/filtertest.c +++ b/tests/filtertest.c @@ -194,9 +194,9 @@ main(int argc, char **argv) pcap_t *pd; struct bpf_program fcode; -#ifdef WIN32 +#ifdef _WIN32 if(wsockinit() != 0) return 1; -#endif /* WIN32 */ +#endif /* _WIN32 */ #ifndef BDEBUG dflag = 1; -- cgit v1.2.1