diff options
author | Anton Adamansky <adamansky@gmail.com> | 2015-04-15 14:59:24 +0600 |
---|---|---|
committer | Anton Adamansky <adamansky@gmail.com> | 2015-04-15 14:59:24 +0600 |
commit | bc5d7a156c8710f1cc3b6109604b45f38a24d246 (patch) | |
tree | 271fa5b8412d6d1c8a59a1c67dd46d191e15d5ba /src | |
parent | 1ecd99b6f307a28a1ba55eeaf6c065c64ce297a7 (diff) | |
download | ejdb-bc5d7a156c8710f1cc3b6109604b45f38a24d246.tar.gz ejdb-bc5d7a156c8710f1cc3b6109604b45f38a24d246.tar.bz2 ejdb-bc5d7a156c8710f1cc3b6109604b45f38a24d246.zip |
#127
Diffstat (limited to 'src')
-rw-r--r-- | src/bson/bson.c | 4 | ||||
-rw-r--r-- | src/bson/nxjson.c | 4 | ||||
-rw-r--r-- | src/bson/nxjson.h | 4 | ||||
-rw-r--r-- | src/ejdb/ejdb.c | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/src/bson/bson.c b/src/bson/bson.c index 9fdf48a..771596f 100644 --- a/src/bson/bson.c +++ b/src/bson/bson.c @@ -269,7 +269,7 @@ void bson_print_raw(const char *data, int depth) { fprintf(f, "%s", bson_iterator_bool(&i) ? "true" : "false"); break; case BSON_DATE: - fprintf(f, "%ld", (long int) bson_iterator_date(&i)); + fprintf(f, "%" PRId64, bson_iterator_date(&i)); break; case BSON_BINDATA: fprintf(f, "BSON_BINDATA"); @@ -2509,7 +2509,7 @@ static int _bson2json(_BSON2JSONCTX *ctx, bson_iterator *it, bool array) { switch (bt) { case BSON_LONG: case BSON_INT: - tcxstrprintf(out, "%lld", (int64_t) bson_iterator_long_ext(it)); + tcxstrprintf(out, "%" PRId64, (int64_t) bson_iterator_long_ext(it)); break; case BSON_DOUBLE: { diff --git a/src/bson/nxjson.c b/src/bson/nxjson.c index 7579f8a..d4621b3 100644 --- a/src/bson/nxjson.c +++ b/src/bson/nxjson.c @@ -281,7 +281,7 @@ static char* parse_value(nx_json* parent, const char* key, char* p, nx_json_unic { js=create_json(NX_JSON_INTEGER, key, parent); char* pe; - js->int_value=strtol(p, &pe, 0); + js->int_value=strtoll(p, &pe, 0); if (pe==p) { NX_JSON_REPORT_ERROR("invalid number", p); return 0; // error @@ -295,7 +295,7 @@ static char* parse_value(nx_json* parent, const char* key, char* p, nx_json_unic } } else { - js->dbl_value=js->int_value; + js->dbl_value=(double)js->int_value; } return pe; } diff --git a/src/bson/nxjson.h b/src/bson/nxjson.h index 6b99726..4d134a8 100644 --- a/src/bson/nxjson.h +++ b/src/bson/nxjson.h @@ -20,6 +20,8 @@ #ifndef NXJSON_H #define NXJSON_H +#include <stdint.h> + #ifdef __cplusplus extern "C" { #endif @@ -39,7 +41,7 @@ typedef struct nx_json { nx_json_type type; // type of json node, see above const char* key; // key of the property; for object's children only const char* text_value; // text value of STRING node - long int_value; // the value of INTEGER or BOOL node + int64_t int_value; // the value of INTEGER or BOOL node double dbl_value; // the value of DOUBLE node int length; // number of children of OBJECT or ARRAY struct nx_json* child; // points to first child diff --git a/src/ejdb/ejdb.c b/src/ejdb/ejdb.c index e8ebeba..5eabbfc 100644 --- a/src/ejdb/ejdb.c +++ b/src/ejdb/ejdb.c @@ -4666,7 +4666,7 @@ static TCLIST* _fetch_bson_str_array(EJDB *jb, bson_iterator *it, bson_type *typ case BSON_BOOL: case BSON_DATE: *type = ftype; - tclistprintf(res, "%ld", bson_iterator_long(it)); + tclistprintf(res, "%" PRId64, bson_iterator_long(it)); break; case BSON_DOUBLE: *type = ftype; |