diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt index 53d33d1..3daf09c 100644 --- a/zzip/CMakeLists.txt +++ b/zzip/CMakeLists.txt @@ -176,7 +176,8 @@ set(libzzip_HDRS zzip.h format.h types.h - conf.h + conf.h + cstdint.h _msvc.h file.h info.h diff --git a/zzip/cstdint.h b/zzip/cstdint.h new file mode 100644 index 0000000..f5c7d8a --- /dev/null +++ b/zzip/cstdint.h @@ -0,0 +1,63 @@ +#ifndef _ZZIP_CSTDINT_H +#define _ZZIP_CSTDINT_H 1 +/* this file ensures that we have some kind of typedef declarations for + unsigned C9X typedefs. The ISO C 9X: 7.18 Integer types file is stdint.h + */ + +#include + +/* enforce use of ifdef'd C9X entries in system headers */ +#define __USE_ANSI 1 +#define __USE_ISOC9X 1 + +#ifdef ZZIP_HAVE_STDINT_H +/* ISO C 9X: 7.18 Integer types */ +#include +#elif defined ZZIP_HAVE_SYS_INT_TYPES_H /*solaris*/ +#include +#elif defined ZZIP_HAVE_INTTYPES_H /*freebsd*/ +#include +#else +typedef unsigned char uint8_t; +typedef signed char int8_t; + +#if ZZIP_SIZEOF_INT && ZZIP_SIZEOF_INT == 2 +typedef unsigned int uint16_t; +typedef signed int int16_t; +#elif ZZIP_SIZEOF_SHORT && ZZIP_SIZEOF_SHORT == 2 +typedef unsigned short uint16_t; +typedef signed short int16_t; +#else +#error unable to typedef int16_t from either int or short +typedef unsigned short uint16_t; +typedef signed short int16_t; +#endif + +#if defined ZZIP_SIZEOF_INT && ZZIP_SIZEOF_INT == 4 +typedef unsigned int uint32_t; +typedef signed int int32_t; +#elif defined ZZIP_SIZEOF_LONG && ZZIP_SIZEOF_LONG == 4 +typedef unsigned long uint32_t; +typedef signed long int32_t; +#else +#error unable to typedef int32_t from either int or long +typedef unsigned long uint32_t; +typedef signed long int32_t; +#endif + +/* either (long long) on Unix or (__int64) on Windows */ +typedef unsigned _zzip___int64 uint64_t; +typedef _zzip___int64 int64_t; + +#if defined ZZIP_SIZEOF_INT_P +#if ZZIP_SIZEOF_INT_P == ZZIP_SIZEOF_LONG + 0 +typedef long intptr_t; +#elif ZZIP_SIZEOF_INT_P == ZZIP_SIZEOF_INT + 0 +typedef int intptr_t; +#else +typedef int64_t intptr_t; +#endif +#endif + +#endif /* ZZIP_HAVE_... */ +#endif /*_ZZIP_STDINT_H*/ diff --git a/zzip/fetch.h b/zzip/fetch.h index 1e1b03f..8ab5a2e 100644 --- a/zzip/fetch.h +++ b/zzip/fetch.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include /* linux knows "byteswap.h" giving us an optimized variant */ diff --git a/zzip/lib.h b/zzip/lib.h index a82fbd6..3cf4fdc 100644 --- a/zzip/lib.h +++ b/zzip/lib.h @@ -15,7 +15,7 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/zzip/stdint.h b/zzip/stdint.h index 0ebac61..88e0346 100644 --- a/zzip/stdint.h +++ b/zzip/stdint.h @@ -1,63 +1,8 @@ -#ifndef _ZZIP__STDINT_H /* zzip-stdint.h */ +#ifndef _ZZIP__STDINT_H #define _ZZIP__STDINT_H 1 -/* this file ensures that we have some kind of typedef declarations for - unsigned C9X typedefs. The ISO C 9X: 7.18 Integer types file is stdint.h - */ -#include +/* obsolete header - use zzip/cstdint.h instead */ -/* enforce use of ifdef'd C9X entries in system headers */ -#define __USE_ANSI 1 -#define __USE_ISOC9X 1 +#include -#ifdef ZZIP_HAVE_STDINT_H -/* ISO C 9X: 7.18 Integer types */ -#include -#elif defined ZZIP_HAVE_SYS_INT_TYPES_H /*solaris*/ -#include -#elif defined ZZIP_HAVE_INTTYPES_H /*freebsd*/ -#include -#else -typedef unsigned char uint8_t; -typedef signed char int8_t; - -#if ZZIP_SIZEOF_INT && ZZIP_SIZEOF_INT == 2 -typedef unsigned int uint16_t; -typedef signed int int16_t; -#elif ZZIP_SIZEOF_SHORT && ZZIP_SIZEOF_SHORT == 2 -typedef unsigned short uint16_t; -typedef signed short int16_t; -#else -#error unable to typedef int16_t from either int or short -typedef unsigned short uint16_t; -typedef signed short int16_t; -#endif - -#if defined ZZIP_SIZEOF_INT && ZZIP_SIZEOF_INT == 4 -typedef unsigned int uint32_t; -typedef signed int int32_t; -#elif defined ZZIP_SIZEOF_LONG && ZZIP_SIZEOF_LONG == 4 -typedef unsigned long uint32_t; -typedef signed long int32_t; -#else -#error unable to typedef int32_t from either int or long -typedef unsigned long uint32_t; -typedef signed long int32_t; -#endif - -/* either (long long) on Unix or (__int64) on Windows */ -typedef unsigned _zzip___int64 uint64_t; -typedef _zzip___int64 int64_t; - -#if defined ZZIP_SIZEOF_INT_P -#if ZZIP_SIZEOF_INT_P == ZZIP_SIZEOF_LONG + 0 -typedef long intptr_t; -#elif ZZIP_SIZEOF_INT_P == ZZIP_SIZEOF_INT + 0 -typedef int intptr_t; -#else -typedef int64_t intptr_t; -#endif -#endif - -#endif /* ZZIP_HAVE_... */ #endif /*_ZZIP_STDINT_H*/