Fossil SCM

Allow 64-bit integers to be used in JSON on win32/win64.

jan.nijtmans 2013-06-20 13:34 trunk merge
Commit 928b26ab6af2b14e7821091631229a9927f828da
--- src/cson_amalgamation.c
+++ src/cson_amalgamation.c
@@ -26,11 +26,15 @@
2626
#else
2727
# define JSON_PARSER_DLL_API
2828
#endif
2929
3030
/* Determine the integer type use to parse non-floating point numbers */
31
-#if __STDC_VERSION__ >= 199901L || HAVE_LONG_LONG == 1
31
+#ifdef _WIN32
32
+typedef __int64 JSON_int_t;
33
+#define JSON_PARSER_INTEGER_SSCANF_TOKEN "%I64d"
34
+#define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%I64d"
35
+#elif (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1)
3236
typedef long long JSON_int_t;
3337
#define JSON_PARSER_INTEGER_SSCANF_TOKEN "%lld"
3438
#define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%lld"
3539
#else
3640
typedef long JSON_int_t;
3741
--- src/cson_amalgamation.c
+++ src/cson_amalgamation.c
@@ -26,11 +26,15 @@
26 #else
27 # define JSON_PARSER_DLL_API
28 #endif
29
30 /* Determine the integer type use to parse non-floating point numbers */
31 #if __STDC_VERSION__ >= 199901L || HAVE_LONG_LONG == 1
 
 
 
 
32 typedef long long JSON_int_t;
33 #define JSON_PARSER_INTEGER_SSCANF_TOKEN "%lld"
34 #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%lld"
35 #else
36 typedef long JSON_int_t;
37
--- src/cson_amalgamation.c
+++ src/cson_amalgamation.c
@@ -26,11 +26,15 @@
26 #else
27 # define JSON_PARSER_DLL_API
28 #endif
29
30 /* Determine the integer type use to parse non-floating point numbers */
31 #ifdef _WIN32
32 typedef __int64 JSON_int_t;
33 #define JSON_PARSER_INTEGER_SSCANF_TOKEN "%I64d"
34 #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%I64d"
35 #elif (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1)
36 typedef long long JSON_int_t;
37 #define JSON_PARSER_INTEGER_SSCANF_TOKEN "%lld"
38 #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%lld"
39 #else
40 typedef long JSON_int_t;
41
--- src/cson_amalgamation.h
+++ src/cson_amalgamation.h
@@ -51,11 +51,15 @@
5151
/** @typedef some_long_int_type cson_int_t
5252
5353
Typedef for JSON-like integer types. This is (long long) where feasible,
5454
otherwise (long).
5555
*/
56
-#if (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1)
56
+#ifdef _WIN32
57
+typedef __int64 cson_int_t;
58
+#define CSON_INT_T_SFMT "I64d"
59
+#define CSON_INT_T_PFMT "I64d"
60
+#elif (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1)
5761
typedef long long cson_int_t;
5862
#define CSON_INT_T_SFMT "lld"
5963
#define CSON_INT_T_PFMT "lld"
6064
#else
6165
typedef long cson_int_t;
6266
--- src/cson_amalgamation.h
+++ src/cson_amalgamation.h
@@ -51,11 +51,15 @@
51 /** @typedef some_long_int_type cson_int_t
52
53 Typedef for JSON-like integer types. This is (long long) where feasible,
54 otherwise (long).
55 */
56 #if (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1)
 
 
 
 
57 typedef long long cson_int_t;
58 #define CSON_INT_T_SFMT "lld"
59 #define CSON_INT_T_PFMT "lld"
60 #else
61 typedef long cson_int_t;
62
--- src/cson_amalgamation.h
+++ src/cson_amalgamation.h
@@ -51,11 +51,15 @@
51 /** @typedef some_long_int_type cson_int_t
52
53 Typedef for JSON-like integer types. This is (long long) where feasible,
54 otherwise (long).
55 */
56 #ifdef _WIN32
57 typedef __int64 cson_int_t;
58 #define CSON_INT_T_SFMT "I64d"
59 #define CSON_INT_T_PFMT "I64d"
60 #elif (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1)
61 typedef long long cson_int_t;
62 #define CSON_INT_T_SFMT "lld"
63 #define CSON_INT_T_PFMT "lld"
64 #else
65 typedef long cson_int_t;
66

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button