diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-08-02 12:08:36 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-08-02 12:08:36 -0700 |
commit | 403692f183b87603e28c13c36376532866010e78 (patch) | |
tree | 801c571bf8a356c5071cb8da949a54973b33d72b /portability.h | |
parent | ae616308f83458cfce286303ea34022810c7ec72 (diff) |
Move some additional stuff to portability.h.
That way, it's available for code in the libpcap project, but doesn't
pollute the namespace of programs on Windows that use WinPcap/Npcap.
Diffstat (limited to 'portability.h')
-rw-r--r-- | portability.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/portability.h b/portability.h index 6784af5a..ec1fd113 100644 --- a/portability.h +++ b/portability.h @@ -128,6 +128,56 @@ extern int pcap_snprintf(char *, size_t, FORMAT_STRING(const char *), ...); extern int pcap_vsnprintf(char *, size_t, const char *, va_list ap); #endif +#ifdef _WIN32 + /* + * These may be defined by <inttypes.h>. + * + * XXX - for MSVC, we always want the _MSC_EXTENSIONS versions. + * What about other compilers? If, as the MinGW Web site says MinGW + * does, the other compilers just use Microsoft's run-time library, + * then they should probably use the _MSC_EXTENSIONS even if the + * compiler doesn't define _MSC_EXTENSIONS. + * + * XXX - we currently aren't using any of these, but this allows + * their use in the future. + */ + #ifndef PRId64 + #ifdef _MSC_EXTENSIONS + #define PRId64 "I64d" + #else + #define PRId64 "lld" + #endif + #endif /* PRId64 */ + + #ifndef PRIo64 + #ifdef _MSC_EXTENSIONS + #define PRIo64 "I64o" + #else + #define PRIo64 "llo" + #endif + #endif /* PRIo64 */ + + #ifndef PRIx64 + #ifdef _MSC_EXTENSIONS + #define PRIx64 "I64x" + #else + #define PRIx64 "llx" + #endif + #endif + + #ifndef PRIu64 + #ifdef _MSC_EXTENSIONS + #define PRIu64 "I64u" + #else + #define PRIu64 "llu" + #endif + #endif + + #if !defined(__cplusplus) + #define inline __inline + #endif +#endif /* _WIN32 */ + #ifdef __cplusplus } #endif |