From ceb49d3742e4c27fdd86f9a6b043bebf7f42deaa Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 21 Aug 2008 00:06:15 +0000 Subject: [PATCH] Get rid of ENABLE_64BIT symbol definition and usage. Improve HAVE_LONGLONG symbol description. --- ares/configure.ac | 3 ++- configure.ac | 3 ++- lib/config-os400.h | 2 +- lib/config-symbian.h | 2 +- lib/config-tpf.h | 2 +- lib/mprintf.c | 43 +++++++++++++++++++++++++------------------ lib/setup.h | 11 ----------- lib/version.c | 11 ++++++++++- src/config-win32.h | 2 +- 9 files changed, 43 insertions(+), 36 deletions(-) diff --git a/ares/configure.ac b/ares/configure.ac index a4361c31c..6a8cf7dce 100644 --- a/ares/configure.ac +++ b/ares/configure.ac @@ -582,7 +582,8 @@ AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(time_t) AC_CHECK_TYPE(long long, - [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])] + [AC_DEFINE(HAVE_LONGLONG, 1, + [Define to 1 if the compiler supports the 'long long' data type.])] longlong="yes" ) diff --git a/configure.ac b/configure.ac index 9ebb9ba6d..76ccb8829 100644 --- a/configure.ac +++ b/configure.ac @@ -2001,7 +2001,8 @@ AC_CHECK_SIZEOF(time_t) AC_CHECK_SIZEOF(off_t) AC_CHECK_TYPE(long long, - [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])] + [AC_DEFINE(HAVE_LONGLONG, 1, + [Define to 1 if the compiler supports the 'long long' data type.])] longlong="yes" ) diff --git a/lib/config-os400.h b/lib/config-os400.h index c52098731..abe9bb875 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -364,7 +364,7 @@ /* The size of a `long double', as computed by sizeof. */ #define SIZEOF_LONG_DOUBLE 8 -/* Define if 64 bit integers are supported. */ +/* Define if the compiler supports the 'long long' data type. */ #define HAVE_LONGLONG /* The size of a `long long', as computed by sizeof. */ diff --git a/lib/config-symbian.h b/lib/config-symbian.h index a39669c48..6c91cba36 100644 --- a/lib/config-symbian.h +++ b/lib/config-symbian.h @@ -312,7 +312,7 @@ /* Define to 1 if you have the `localtime_r' function. */ #define HAVE_LOCALTIME_R 1 -/* if your compiler supports long long */ +/* Define to 1 if the compiler supports the 'long long' data type. */ #define HAVE_LONGLONG 1 /* Define to 1 if you have the malloc.h header file. */ diff --git a/lib/config-tpf.h b/lib/config-tpf.h index f8d193e17..104fb8116 100644 --- a/lib/config-tpf.h +++ b/lib/config-tpf.h @@ -272,7 +272,7 @@ /* Define to 1 if you have the `localtime_r' function. */ #define HAVE_LOCALTIME_R 1 -/* if your compiler supports long long */ +/* Define to 1 if the compiler supports the 'long long' data type. */ #define HAVE_LONGLONG 1 /* Define to 1 if you need the malloc.h header file even with stdlib.h */ diff --git a/lib/mprintf.c b/lib/mprintf.c index 475bdded5..f139c8da1 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -58,10 +58,17 @@ #define SIZEOF_SIZE_T 4 #endif -#ifdef DPRINTF_DEBUG -#define HAVE_LONGLONG -#define LONG_LONG long long -#define ENABLE_64BIT +#ifdef HAVE_LONGLONG +# define LONG_LONG_TYPE long long +# define HAVE_LONG_LONG_TYPE +#else +# if defined(_MSC_VER) && (_MSC_VER >= 900) +# define LONG_LONG_TYPE __int64 +# define HAVE_LONG_LONG_TYPE +# else +# undef LONG_LONG_TYPE +# undef HAVE_LONG_LONG_TYPE +# endif #endif #include "memory.h" @@ -150,8 +157,8 @@ typedef struct { char *str; void *ptr; long num; -#ifdef ENABLE_64BIT - LONG_LONG lnum; +#ifdef HAVE_LONG_LONG_TYPE + LONG_LONG_TYPE lnum; #endif double dnum; } data; @@ -560,9 +567,9 @@ static long dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, break; case FORMAT_INT: -#ifdef ENABLE_64BIT +#ifdef HAVE_LONG_LONG_TYPE if(vto[i].flags & FLAGS_LONGLONG) - vto[i].data.lnum = va_arg(arglist, LONG_LONG); + vto[i].data.lnum = va_arg(arglist, LONG_LONG_TYPE); else #endif { @@ -645,8 +652,8 @@ static int dprintf_formatf( long base; /* Integral values to be written. */ -#ifdef ENABLE_64BIT - unsigned LONG_LONG num; +#ifdef HAVE_LONG_LONG_TYPE + unsigned LONG_LONG_TYPE num; #else unsigned long num; #endif @@ -708,7 +715,7 @@ static int dprintf_formatf( switch (p->type) { case FORMAT_INT: -#ifdef ENABLE_64BIT +#ifdef HAVE_LONG_LONG_TYPE if(p->flags & FLAGS_LONGLONG) num = p->data.lnum; else @@ -746,7 +753,7 @@ static int dprintf_formatf( /* Decimal integer. */ base = 10; -#ifdef ENABLE_64BIT +#ifdef HAVE_LONG_LONG_TYPE if(p->flags & FLAGS_LONGLONG) { /* long long */ is_neg = (char)(p->data.lnum < 0); @@ -978,9 +985,9 @@ static int dprintf_formatf( case FORMAT_INTPTR: /* Answer the count of characters written. */ -#ifdef ENABLE_64BIT +#ifdef HAVE_LONG_LONG_TYPE if(p->flags & FLAGS_LONGLONG) - *(LONG_LONG *) p->data.ptr = (LONG_LONG)done; + *(LONG_LONG_TYPE *) p->data.ptr = (LONG_LONG_TYPE)done; else #endif if(p->flags & FLAGS_LONG) @@ -1199,10 +1206,10 @@ int main() { char buffer[129]; char *ptr; -#ifdef ENABLE_64BIT - long long one=99; - long long two=100; - long long test = 0x1000000000LL; +#ifdef HAVE_LONG_LONG_TYPE + LONG_LONG_TYPE one=99; + LONG_LONG_TYPE two=100; + LONG_LONG_TYPE test = 0x1000000000LL; curl_mprintf("%lld %lld %lld\n", one, two, test); #endif diff --git a/lib/setup.h b/lib/setup.h index 9cf3d8f31..4354f7fa8 100644 --- a/lib/setup.h +++ b/lib/setup.h @@ -213,17 +213,6 @@ # endif #endif - -#ifdef HAVE_LONGLONG -#define LONG_LONG long long -#define ENABLE_64BIT -#else -#ifdef _MSC_VER -#define LONG_LONG __int64 -#define ENABLE_64BIT -#endif /* _MSC_VER */ -#endif /* HAVE_LONGLONG */ - #ifdef HAVE_EXTRA_STRICMP_H # include #endif diff --git a/lib/version.c b/lib/version.c index a2828ceae..5b9ccca3d 100644 --- a/lib/version.c +++ b/lib/version.c @@ -190,7 +190,16 @@ static curl_version_info_data version_info = { #ifdef HAVE_SPNEGO | CURL_VERSION_SPNEGO #endif -#if defined(ENABLE_64BIT) && (CURL_SIZEOF_CURL_OFF_T > 4) +/* + * FIXME before 7.19.0 release. + * + * libcurl is largefile enabled when (CURL_SIZEOF_CURL_OFF_T > 4) _AND_ + * libcurl has been built with sizeof(system off_t) > 4 or when large + * file support is available even with sizeof(system off_t) <= 4. + * + * Until this is adjusted, only the (CURL_SIZEOF_CURL_OFF_T > 4) check is done. + */ +#if (CURL_SIZEOF_CURL_OFF_T > 4) | CURL_VERSION_LARGEFILE #endif #if defined(CURL_DOES_CONVERSIONS) diff --git a/src/config-win32.h b/src/config-win32.h index 306f42ee2..84a16fdc8 100644 --- a/src/config-win32.h +++ b/src/config-win32.h @@ -200,7 +200,7 @@ #define HAVE_VARIADIC_MACROS_C99 1 #endif -/* Define if the compiler supports LONGLONG. */ +/* Define if the compiler supports the 'long long' data type. */ #if defined(__MINGW32__) || defined(__WATCOMC__) #define HAVE_LONGLONG 1 #endif