------------------------------------------------------------ revno: 13806 revision-id: squid3@treenet.co.nz-20150423120338-l0rjsjyh59snuwf2 parent: squid3@treenet.co.nz-20150423115557-5rydmh3d5h4ilibi committer: Amos Jeffries branch nick: 3.5 timestamp: Thu 2015-04-23 05:03:38 -0700 message: Portability: Add hacks to define C++11 explicit N-bit type limits Add cstdint and stdint.h to libcompat headers and ensure that type limits used by Squid are always available. Mostly this involves shuffling existing hacks into the compat headers but the UINT32_* limits are new. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20150423120338-l0rjsjyh59snuwf2 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: 8579036afa80de92de19c34ac8e4046389f6459f # timestamp: 2015-04-23 12:12:45 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20150423115557-\ # 5rydmh3d5h4ilibi # # Begin patch === modified file 'compat/types.h' --- compat/types.h 2015-01-13 09:13:49 +0000 +++ compat/types.h 2015-04-23 12:03:38 +0000 @@ -50,6 +50,47 @@ /******************************************************/ /* + * Ensure that standard type limits are defined for use + */ +#if __cplusplus >= 201103L +#include +#elif HAVE_STDINT_H +#include +#endif + +/* explicit bit sizes */ +#if !defined(UINT32_MIN) +#define UINT32_MIN 0x00000000L +#endif +#if !defined(UINT32_MAX) +#define UINT32_MAX 0xFFFFFFFFL +#endif + +#if !defined(INT_MAX) +#define INT_MAX 0x7FFFFFFFL // hack but a safe bet (32-bit signed integer) +#endif + +#if !defined(INT64_MIN) +/* Native 64 bit system without strtoll() */ +#if defined(LONG_MIN) && (SIZEOF_LONG == 8) +#define INT64_MIN LONG_MIN +#else +/* 32 bit system */ +#define INT64_MIN (-9223372036854775807LL-1LL) +#endif +#endif + +#if !defined(INT64_MAX) +/* Native 64 bit system without strtoll() */ +#if defined(LONG_MAX) && (SIZEOF_LONG == 8) +#define INT64_MAX LONG_MAX +#else +/* 32 bit system */ +#define INT64_MAX 9223372036854775807LL +#endif +#endif + +/* * ISO C99 Standard printf() macros for 64 bit integers * On some 64 bit platform, HP Tru64 is one, for printf must be used * "%lx" instead of "%llx" === modified file 'helpers/ntlm_auth/fake/ntlm_fake_auth.cc' --- helpers/ntlm_auth/fake/ntlm_fake_auth.cc 2015-01-13 09:13:49 +0000 +++ helpers/ntlm_auth/fake/ntlm_fake_auth.cc 2015-04-23 12:03:38 +0000 @@ -50,12 +50,6 @@ #if HAVE_GETOPT_H #include #endif -#if HAVE_STDINT_H -#include -#endif -#if HAVE_INTTYPES_H -#include -#endif /* A couple of harmless helper macros */ #define SEND(X) {debug("sending '%s' to squid\n",X); printf(X "\n");} === modified file 'src/String.cci' --- src/String.cci 2015-01-13 09:13:49 +0000 +++ src/String.cci 2015-04-23 12:03:38 +0000 @@ -10,14 +10,6 @@ #include -#if HAVE_STDINT_H -#include -#else /* HAVE_STDINT_H */ -#ifndef INT_MAX -#define INT_MAX 1<<31 //hack but a safe bet -#endif /* INT_MAX */ -#endif /* HAVE_STDINT_H */ - String::String() : size_(0), len_(0), buf_(NULL) { #if DEBUGSTRINGS === modified file 'src/parser/Tokenizer.cc' --- src/parser/Tokenizer.cc 2015-01-24 04:55:12 +0000 +++ src/parser/Tokenizer.cc 2015-04-23 12:03:38 +0000 @@ -13,28 +13,6 @@ #if HAVE_CTYPE_H #include #endif -#if HAVE_STDINT_H -#include -#endif -#ifndef INT64_MIN -/* Native 64 bit system without strtoll() */ -#if defined(LONG_MIN) && (SIZEOF_LONG == 8) -#define INT64_MIN LONG_MIN -#else -/* 32 bit system */ -#define INT64_MIN (-9223372036854775807LL-1LL) -#endif -#endif - -#ifndef INT64_MAX -/* Native 64 bit system without strtoll() */ -#if defined(LONG_MAX) && (SIZEOF_LONG == 8) -#define INT64_MAX LONG_MAX -#else -/* 32 bit system */ -#define INT64_MAX 9223372036854775807LL -#endif -#endif /// convenience method: consumes up to n bytes, counts, and returns them SBuf