Portability to Solaris and derivative platforms.
This commit is contained in:
parent
2eaf151ca0
commit
3cdfa86d65
3 changed files with 13 additions and 0 deletions
|
@ -26,7 +26,11 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
#if defined(sun) || defined(__sun)
|
||||||
|
#include <sys/byteorder.h>
|
||||||
|
#else
|
||||||
#include <byteswap.h>
|
#include <byteswap.h>
|
||||||
|
#endif
|
||||||
#include <utils.h>
|
#include <utils.h>
|
||||||
#include <pcompress.h>
|
#include <pcompress.h>
|
||||||
#include <allocator.h>
|
#include <allocator.h>
|
||||||
|
|
4
main.c
4
main.c
|
@ -35,7 +35,11 @@
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#if defined(sun) || defined(__sun)
|
||||||
|
#include <sys/byteorder.h>
|
||||||
|
#else
|
||||||
#include <byteswap.h>
|
#include <byteswap.h>
|
||||||
|
#endif
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <utils.h>
|
#include <utils.h>
|
||||||
#include <pcompress.h>
|
#include <pcompress.h>
|
||||||
|
|
5
utils.h
5
utils.h
|
@ -31,11 +31,14 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(sun) && !defined(__sun)
|
||||||
#define ulong_t u_long
|
#define ulong_t u_long
|
||||||
#define uchar_t u_char
|
#define uchar_t u_char
|
||||||
#define uint8_t u_char
|
#define uint8_t u_char
|
||||||
#define uint64_t u_int64_t
|
#define uint64_t u_int64_t
|
||||||
#define uint32_t u_int32_t
|
#define uint32_t u_int32_t
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ULONG_MAX == 4294967295UL
|
#if ULONG_MAX == 4294967295UL
|
||||||
# ifndef UINT64_C
|
# ifndef UINT64_C
|
||||||
# define UINT64_C(n) n ## ULL
|
# define UINT64_C(n) n ## ULL
|
||||||
|
@ -57,6 +60,7 @@ typedef unsigned long uintptr_t;
|
||||||
# define ntohll(x) (x)
|
# define ntohll(x) (x)
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
|
# if !defined(sun) && !defined (__sun)
|
||||||
# ifndef htonll
|
# ifndef htonll
|
||||||
# define htonll(x) __bswap_64(x)
|
# define htonll(x) __bswap_64(x)
|
||||||
# endif
|
# endif
|
||||||
|
@ -64,6 +68,7 @@ typedef unsigned long uintptr_t;
|
||||||
# define ntohll(x) __bswap_64(x)
|
# define ntohll(x) __bswap_64(x)
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// These allow helping the compiler in some often-executed branches, whose
|
// These allow helping the compiler in some often-executed branches, whose
|
||||||
|
|
Loading…
Reference in a new issue