Portability to Solaris and derivative platforms.

This commit is contained in:
Moinak Ghosh 2012-05-31 18:01:34 +05:30
parent 2eaf151ca0
commit 3cdfa86d65
3 changed files with 13 additions and 0 deletions

View file

@ -26,7 +26,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#if defined(sun) || defined(__sun)
#include <sys/byteorder.h>
#else
#include <byteswap.h>
#endif
#include <utils.h>
#include <pcompress.h>
#include <allocator.h>

4
main.c
View file

@ -35,7 +35,11 @@
#include <strings.h>
#include <limits.h>
#include <unistd.h>
#if defined(sun) || defined(__sun)
#include <sys/byteorder.h>
#else
#include <byteswap.h>
#endif
#include <libgen.h>
#include <utils.h>
#include <pcompress.h>

View file

@ -31,11 +31,14 @@
extern "C" {
#endif
#if !defined(sun) && !defined(__sun)
#define ulong_t u_long
#define uchar_t u_char
#define uint8_t u_char
#define uint64_t u_int64_t
#define uint32_t u_int32_t
#endif
#if ULONG_MAX == 4294967295UL
# ifndef UINT64_C
# define UINT64_C(n) n ## ULL
@ -57,12 +60,14 @@ typedef unsigned long uintptr_t;
# define ntohll(x) (x)
# endif
#else
# if !defined(sun) && !defined (__sun)
# ifndef htonll
# define htonll(x) __bswap_64(x)
# endif
# ifndef ntohll
# define ntohll(x) __bswap_64(x)
# endif
# endif
#endif