diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-02-25 14:15:38 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-02-25 14:15:38 +0000 |
commit | df94c7aedcc0b115fc38578d7b9de95cfcb5c5ef (patch) | |
tree | dcbb62852b7e0250da9a66e074cc2f07a593dcdb /lib | |
parent | 6bd2de0c422da83bcccd1afe8bab8ab9d641df60 (diff) |
Based on a patch by Greg Hewgill I modified how long long is used, as we
can use a 64bit type with MSVC that is a long long equivalent.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mprintf.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/lib/mprintf.c b/lib/mprintf.c index f30db759e..50a396963 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -46,6 +46,15 @@ #define SIZEOF_LONG_DOUBLE 0 #endif +#ifdef HAVE_LONGLONG +#define LONG_LONG long long +#define ENABLE_64BIT +#else +#ifdef _MSC_VER +#define LONG_LONG __int64 +#define ENABLE_64BIT +#endif +#endif /* HAVE_LONGLONG */ /* The last #include file should be: */ #ifdef CURLDEBUG @@ -125,11 +134,11 @@ typedef struct { char *str; void *ptr; long num; -#ifdef HAVE_LONGLONG - long long lnum; +#ifdef ENABLE_64BIT + LONG_LONG lnum; #endif double dnum; -#if SIZEOF_LONG_DOUBLE +#if 0 /*SIZEOF_LONG_DOUBLE */ long double ldnum; #endif } data; @@ -526,9 +535,9 @@ static int dprintf_Pass1(char *format, va_stack_t *vto, char **endpos, va_list a break; case FORMAT_INT: -#ifdef HAVE_LONGLONG +#ifdef ENABLE_64BIT if(vto[i].flags & FLAGS_LONGLONG) - vto[i].data.lnum = va_arg(arglist, long long); + vto[i].data.lnum = va_arg(arglist, LONG_LONG); else #endif if(vto[i].flags & FLAGS_LONG) @@ -538,7 +547,7 @@ static int dprintf_Pass1(char *format, va_stack_t *vto, char **endpos, va_list a break; case FORMAT_DOUBLE: -#if SIZEOF_LONG_DOUBLE +#if 0 /*SIZEOF_LONG_DOUBLE */ if(vto[i].flags & FLAGS_LONG) vto[i].data.ldnum = va_arg(arglist, long double); else @@ -613,8 +622,8 @@ static int dprintf_formatf( long base; /* Integral values to be written. */ -#ifdef HAVE_LONGLONG - unsigned long long num; +#ifdef ENABLE_64BIT + unsigned LONG_LONG num; #else unsigned long num; #endif @@ -706,7 +715,7 @@ static int dprintf_formatf( /* Decimal integer. */ base = 10; -#ifdef HAVE_LONGLONG +#ifdef ENABLE_64BIT if(p->flags & FLAGS_LONGLONG) { /* long long */ is_neg = p->data.lnum < 0; @@ -937,9 +946,9 @@ static int dprintf_formatf( case FORMAT_INTPTR: /* Answer the count of characters written. */ -#ifdef HAVE_LONGLONG +#ifdef ENABLE_64BIT if (p->flags & FLAGS_LONGLONG) - *(long long *) p->data.ptr = (long long)done; + *(LONG_LONG *) p->data.ptr = (LONG_LONG)done; else #endif if (p->flags & FLAGS_LONG) @@ -1153,8 +1162,8 @@ int main() { char buffer[129]; char *ptr; -#ifdef HAVE_LONGLONG - long long hullo; +#ifdef ENABLE_64BIT + LONG_LONG hullo; dprintf("%3$12s %1$s %2$qd %4$d\n", "daniel", hullo, "stenberg", 65); #endif |