mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-19 18:00:33 +01:00
Who would have thought that some systems define intfoo_t, but not uintfoo_t? Cygwin is such a system.
svn:r378
This commit is contained in:
parent
7284c25b34
commit
58e2edfb24
@ -137,12 +137,12 @@ AC_CHECK_HEADERS(unistd.h string.h signal.h netdb.h ctype.h poll.h sys/poll.h sy
|
||||
|
||||
dnl These headers are not essential
|
||||
|
||||
AC_CHECK_HEADERS(stdint.h sys/types.h)
|
||||
AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h)
|
||||
|
||||
dnl In case we aren't given a working stdint.h, we'll need to grow our own.
|
||||
dnl Watch out.
|
||||
|
||||
AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t])
|
||||
AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t])
|
||||
|
||||
AC_CHECK_SIZEOF(char)
|
||||
AC_CHECK_SIZEOF(short)
|
||||
|
@ -5,61 +5,127 @@
|
||||
#ifndef __TORINT_H
|
||||
#define __TORINT_H
|
||||
|
||||
#include "orconfig.h"
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if (SIZEOF_CHAR == 1)
|
||||
#ifndef HAVE_INT8_T
|
||||
typedef signed char int8_t;
|
||||
#define HAVE_INT8_T
|
||||
#endif
|
||||
#ifndef HAVE_UINT8_T
|
||||
typedef unsigned char uint8_t;
|
||||
#define HAVE_UINT8_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (SIZEOF_SHORT == 2)
|
||||
#ifndef HAVE_INT16_T
|
||||
typedef signed short int16_t;
|
||||
#define HAVE_INT16_T
|
||||
#endif
|
||||
#ifndef HAVE_UINT16_T
|
||||
typedef unsigned short uint16_t;
|
||||
#define HAVE_UINT16_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (SIZEOF_INT == 2)
|
||||
#ifndef HAVE_INT16_T
|
||||
typedef signed int int16_t;
|
||||
#define HAVE_INT16_T
|
||||
#endif
|
||||
#ifndef HAVE_UINT16_T
|
||||
typedef unsigned int uint16_t;
|
||||
#define HAVE_UINT16_T
|
||||
#endif
|
||||
#elif (SIZEOF_INT == 4)
|
||||
#ifndef HAVE_INT32_T
|
||||
typedef signed int int32_t;
|
||||
#define HAVE_INT32_T
|
||||
#endif
|
||||
#ifndef HAVE_UINT32_T
|
||||
typedef unsigned int uint32_t;
|
||||
#define HAVE_UINT32_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (SIZEOF_LONG == 4)
|
||||
#ifndef HAVE_INT32_T
|
||||
typedef signed long int32_t;
|
||||
#define HAVE_INT32_T
|
||||
#endif
|
||||
#ifndef HAVE_UINT32_T
|
||||
typedef unsigned long uint32_t;
|
||||
#define HAVE_UINT32_T
|
||||
#endif
|
||||
#elif (SIZEOF_LONG == 8)
|
||||
#ifndef HAVE_INT64_T
|
||||
typedef signed long int64_t;
|
||||
#define HAVE_INT64_T
|
||||
#endif
|
||||
#ifndef HAVE_UINT32_T
|
||||
typedef unsigned long uint64_t;
|
||||
#define HAVE_UINT32_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (SIZEOF_LONG_LONG == 8)
|
||||
#ifndef HAVE_INT64_T
|
||||
typedef signed long long int64_t;
|
||||
#define HAVE_INT64_T
|
||||
#endif
|
||||
#ifndef HAVE_UINT64_T
|
||||
typedef unsigned long long uint64_t;
|
||||
#define HAVE_UINT64_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (SIZEOF___INT64 == 8)
|
||||
#ifndef HAVE_INT64_T
|
||||
typedef signed __int64 int64_t;
|
||||
#define HAVE_INT64_T
|
||||
#endif
|
||||
#ifndef HAVE_UINT64_T
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#define HAVE_UINT64_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_INT8_T
|
||||
#if (SIZEOF_CHAR == 1)
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
#else
|
||||
#error "sizeof(char) != 1"
|
||||
#error "Missing type int8_t"
|
||||
#endif
|
||||
#ifndef HAVE_UINT8_T
|
||||
#error "Missing type uint8_t"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_INT16_T
|
||||
#if (SIZEOF_SHORT == 2)
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
#elif (SIZEOF_INT == 2)
|
||||
typedef unsigned int uint16_t;
|
||||
typedef signed int int16_t;
|
||||
#else
|
||||
#error "sizeof(short) != 2 && sizeof(int) != 2"
|
||||
#error "Missing type int16_t"
|
||||
#endif
|
||||
#ifndef HAVE_UINT16_T
|
||||
#error "Missing type uint16_t"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_INT32_T
|
||||
#if (SIZEOF_INT == 4)
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed int int32_t;
|
||||
#elif (SIZEOF_LONG == 4)
|
||||
typedef unsigned long uint32_t;
|
||||
typedef signed long int32_t;
|
||||
#else
|
||||
#error "sizeof(int) != 4 && sizeof(long) != 4"
|
||||
#error "Missing type int32_t"
|
||||
#endif
|
||||
#ifndef HAVE_UINT32_T
|
||||
#error "Missing type uint32_t"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_INT64_T
|
||||
#if (SIZEOF_LONG == 8)
|
||||
typedef unsigned long uint64_t;
|
||||
typedef signed long int64_t;
|
||||
#elif (SIZEOF_LONG_LONG == 8)
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef signed long long int64_t;
|
||||
#elif (SIZEOF___INT64 == 8)
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef signed __int64 int64_t;
|
||||
#else
|
||||
#error "sizeof(long) != 8 && sizeof(long long) != 8 && sizeof(__int64) != 8"
|
||||
#error "Missing type int64_t"
|
||||
#endif
|
||||
#ifndef HAVE_UINT64_T
|
||||
#error "Missing type uint64_t"
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_STDINT_H */
|
||||
|
||||
|
||||
#endif /* __TORINT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user