diff options
Diffstat (limited to 'yajl')
-rw-r--r-- | yajl/yajl_common.h | 50 | ||||
-rw-r--r-- | yajl/yajl_gen.c | 2 |
2 files changed, 35 insertions, 17 deletions
diff --git a/yajl/yajl_common.h b/yajl/yajl_common.h index 95a5ab7..3558c7d 100644 --- a/yajl/yajl_common.h +++ b/yajl/yajl_common.h @@ -53,6 +53,7 @@ extern "C" { #endif // Create a cross platform 64 bit int type "longlong" - GWG +#ifndef NUMLIB_H #if (__STDC_VERSION__ >= 199901L) /* C99 */ @@ -93,27 +94,44 @@ typedef __int64 longlong; /* LLP64 and LP64 models, but won't work with ILP64 which needs int32 */ #ifdef __GNUC__ - -typedef long long longlong; - -# define PF64PREC "ll" /* printf format precision specifier */ -# define CF64PREC "LL" /* Constant precision specifier */ - -# ifndef LLONG_MIN -# define LLONG_MIN (-LLONG_MAX-1) -# endif -# ifndef LLONG_MAX -# define LLONG_MAX __LONG_LONG_MAX__ -# endif -# ifndef ULLONG_MAX -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1) -# endif - +# ifdef __LP64__ /* long long could be 128 bit ? */ + typedef long longlong; +# define PF64PREC "l" /* printf format precision specifier */ +# define CF64PREC "L" /* Constant precision specifier */ +# ifndef LLONG_MAX +# define LLONG_MAX __LONG_MAX__ +# endif +# ifndef LLONG_MIN +# define LLONG_MIN (-LLONG_MAX-1) +# endif +# ifndef ULLONG_MAX +# define ULLONG_MAX (LLONG_MAX * 2UL + 1) +# endif +# else /* long could be 32 bits */ + typedef long long longlong; +# define PF64PREC "ll" /* printf format precision specifier */ +# define CF64PREC "LL" /* Constant precision specifier */ +# ifndef LLONG_MAX +# define LLONG_MAX __LONG_LONG_MAX__ +# endif +# ifndef LLONG_MIN +# define LLONG_MIN (-LLONG_MAX-1) +# endif +# ifndef ULLONG_MAX +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1) +# endif +# endif /* !__LP64__ */ #endif /* __GNUC__ */ #endif /* !_MSC_VER */ #endif /* !__STDC_VERSION__ */ +#else /* !NUMLIB_H */ + +typedef INR64 longlong ; + +#endif /* !NUMLIB_H */ + /** pointer to a malloc function, supporting client overriding memory * allocation routines */ typedef void * (*yajl_malloc_func)(void *ctx, size_t sz); diff --git a/yajl/yajl_gen.c b/yajl/yajl_gen.c index 17ce003..450b898 100644 --- a/yajl/yajl_gen.c +++ b/yajl/yajl_gen.c @@ -266,7 +266,7 @@ yajl_gen_integer(yajl_gen g, longlong number) { char i[32]; ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - sprintf(i, "%lld", number); + sprintf(i, "%" PF64PREC "d", number); g->print(g->ctx, i, (unsigned int)strlen(i)); APPENDED_ATOM; FINAL_NEWLINE; |