diff options
author | Nick Mathewson <nickm@torproject.org> | 2003-08-11 20:40:21 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2003-08-11 20:40:21 +0000 |
commit | 52675184552c7284d4b4eb9a55f098cc80319f85 (patch) | |
tree | 8157d4e25f7a1fd355426dcb48462ee2303393f1 /src | |
parent | 681c7539ef9a7ec3b0b2e6c1da551397820f7589 (diff) | |
download | tor-52675184552c7284d4b4eb9a55f098cc80319f85.tar tor-52675184552c7284d4b4eb9a55f098cc80319f85.tar.gz |
autoconf around missing stdint.h
svn:r376
Diffstat (limited to 'src')
-rw-r--r-- | src/common/aes.c | 1 | ||||
-rw-r--r-- | src/common/aes.h | 2 | ||||
-rw-r--r-- | src/common/torint.h | 55 | ||||
-rw-r--r-- | src/or/or.h | 4 |
4 files changed, 57 insertions, 5 deletions
diff --git a/src/common/aes.c b/src/common/aes.c index e965f1baa..aa834fdb1 100644 --- a/src/common/aes.c +++ b/src/common/aes.c @@ -10,7 +10,6 @@ #include <assert.h> #include <stdlib.h> #include <string.h> -#include <stdint.h> #include "../../orconfig.h" #include "./aes.h" #include "util.h" diff --git a/src/common/aes.h b/src/common/aes.h index 0b43619bc..918770889 100644 --- a/src/common/aes.h +++ b/src/common/aes.h @@ -7,7 +7,7 @@ #ifndef __AES_H #define __AES_H -#include <stdint.h> +#include "../common/torint.h" struct aes_cnt_cipher; typedef struct aes_cnt_cipher aes_cnt_cipher_t; diff --git a/src/common/torint.h b/src/common/torint.h new file mode 100644 index 000000000..65984b519 --- /dev/null +++ b/src/common/torint.h @@ -0,0 +1,55 @@ +/* Copyright 2003 Roger Dingledine */ +/* See LICENSE for licensing information */ +/* $Id$ */ + +#ifndef __TORINT_H +#define __TORINT_H + +#ifdef HAVE_STDINT_H +#include <stdint.h> +#else + +#if (SIZEOF_CHAR == 1) +typedef unsigned char uint8_t; +typedef signed char int8_t; +#else +#error "sizeof(char) != 1" +#endif + +#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" +#endif + +#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" +#endif + +#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" +#endif + +#endif /* HAVE_STDINT_H */ + + +#endif /* __TORINT_H */ diff --git a/src/or/or.h b/src/or/or.h index 37a971e8d..dba32795e 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -15,9 +15,7 @@ #include <signal.h> #include <netdb.h> #include <ctype.h> -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif +#include "../common/torint.h" #ifdef HAVE_SYS_POLL_H #include <sys/poll.h> #elif HAVE_POLL_H |