mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
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.
This commit is contained in:
parent
6bd2de0c42
commit
df94c7aedc
@ -46,6 +46,15 @@
|
|||||||
#define SIZEOF_LONG_DOUBLE 0
|
#define SIZEOF_LONG_DOUBLE 0
|
||||||
#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
|
||||||
|
#endif /* HAVE_LONGLONG */
|
||||||
|
|
||||||
/* The last #include file should be: */
|
/* The last #include file should be: */
|
||||||
#ifdef CURLDEBUG
|
#ifdef CURLDEBUG
|
||||||
@ -125,11 +134,11 @@ typedef struct {
|
|||||||
char *str;
|
char *str;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
long num;
|
long num;
|
||||||
#ifdef HAVE_LONGLONG
|
#ifdef ENABLE_64BIT
|
||||||
long long lnum;
|
LONG_LONG lnum;
|
||||||
#endif
|
#endif
|
||||||
double dnum;
|
double dnum;
|
||||||
#if SIZEOF_LONG_DOUBLE
|
#if 0 /*SIZEOF_LONG_DOUBLE */
|
||||||
long double ldnum;
|
long double ldnum;
|
||||||
#endif
|
#endif
|
||||||
} data;
|
} data;
|
||||||
@ -526,9 +535,9 @@ static int dprintf_Pass1(char *format, va_stack_t *vto, char **endpos, va_list a
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FORMAT_INT:
|
case FORMAT_INT:
|
||||||
#ifdef HAVE_LONGLONG
|
#ifdef ENABLE_64BIT
|
||||||
if(vto[i].flags & FLAGS_LONGLONG)
|
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
|
else
|
||||||
#endif
|
#endif
|
||||||
if(vto[i].flags & FLAGS_LONG)
|
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;
|
break;
|
||||||
|
|
||||||
case FORMAT_DOUBLE:
|
case FORMAT_DOUBLE:
|
||||||
#if SIZEOF_LONG_DOUBLE
|
#if 0 /*SIZEOF_LONG_DOUBLE */
|
||||||
if(vto[i].flags & FLAGS_LONG)
|
if(vto[i].flags & FLAGS_LONG)
|
||||||
vto[i].data.ldnum = va_arg(arglist, long double);
|
vto[i].data.ldnum = va_arg(arglist, long double);
|
||||||
else
|
else
|
||||||
@ -613,8 +622,8 @@ static int dprintf_formatf(
|
|||||||
long base;
|
long base;
|
||||||
|
|
||||||
/* Integral values to be written. */
|
/* Integral values to be written. */
|
||||||
#ifdef HAVE_LONGLONG
|
#ifdef ENABLE_64BIT
|
||||||
unsigned long long num;
|
unsigned LONG_LONG num;
|
||||||
#else
|
#else
|
||||||
unsigned long num;
|
unsigned long num;
|
||||||
#endif
|
#endif
|
||||||
@ -706,7 +715,7 @@ static int dprintf_formatf(
|
|||||||
/* Decimal integer. */
|
/* Decimal integer. */
|
||||||
base = 10;
|
base = 10;
|
||||||
|
|
||||||
#ifdef HAVE_LONGLONG
|
#ifdef ENABLE_64BIT
|
||||||
if(p->flags & FLAGS_LONGLONG) {
|
if(p->flags & FLAGS_LONGLONG) {
|
||||||
/* long long */
|
/* long long */
|
||||||
is_neg = p->data.lnum < 0;
|
is_neg = p->data.lnum < 0;
|
||||||
@ -937,9 +946,9 @@ static int dprintf_formatf(
|
|||||||
|
|
||||||
case FORMAT_INTPTR:
|
case FORMAT_INTPTR:
|
||||||
/* Answer the count of characters written. */
|
/* Answer the count of characters written. */
|
||||||
#ifdef HAVE_LONGLONG
|
#ifdef ENABLE_64BIT
|
||||||
if (p->flags & FLAGS_LONGLONG)
|
if (p->flags & FLAGS_LONGLONG)
|
||||||
*(long long *) p->data.ptr = (long long)done;
|
*(LONG_LONG *) p->data.ptr = (LONG_LONG)done;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (p->flags & FLAGS_LONG)
|
if (p->flags & FLAGS_LONG)
|
||||||
@ -1153,8 +1162,8 @@ int main()
|
|||||||
{
|
{
|
||||||
char buffer[129];
|
char buffer[129];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
#ifdef HAVE_LONGLONG
|
#ifdef ENABLE_64BIT
|
||||||
long long hullo;
|
LONG_LONG hullo;
|
||||||
dprintf("%3$12s %1$s %2$qd %4$d\n", "daniel", hullo, "stenberg", 65);
|
dprintf("%3$12s %1$s %2$qd %4$d\n", "daniel", hullo, "stenberg", 65);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user