summaryrefslogtreecommitdiff
path: root/json_object.h
diff options
context:
space:
mode:
authorehaszla <ehaszla@327403b1-1117-474d-bef2-5cb71233fd97>2010-12-07 18:15:35 +0000
committerehaszla <ehaszla@327403b1-1117-474d-bef2-5cb71233fd97>2010-12-07 18:15:35 +0000
commit252669cee672b101cc43b2baae86db4a8bcb80eb (patch)
treef9735cbbf9703534b59e8c78b1881eb21cf583f4 /json_object.h
parentf1ae67dbf0d5d921d2786cc63878dcc21e2a32ea (diff)
Simplify things by storing integer values only as int64_t's internally, and
omit the range check during parsing since we already have the checks when accessing the value. There is no longer a json_type_int64, only json_type_int. Fix some problems with parsing 0 and -0 values, and add a couple of tests. Fix some minor compile issues on HPUX environments. git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@60 327403b1-1117-474d-bef2-5cb71233fd97
Diffstat (limited to 'json_object.h')
-rw-r--r--json_object.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/json_object.h b/json_object.h
index cea4c81..9a44c6e 100644
--- a/json_object.h
+++ b/json_object.h
@@ -47,7 +47,6 @@ typedef enum json_type {
json_type_object,
json_type_array,
json_type_string,
- json_type_int64
} json_type;
/* reference counting functions */
@@ -75,7 +74,6 @@ extern void json_object_put(struct json_object *obj);
json_type_object,
json_type_array,
json_type_string,
- json_type_int64,
*/
extern int json_object_is_type(struct json_object *obj, enum json_type type);
@@ -89,7 +87,6 @@ extern int json_object_is_type(struct json_object *obj, enum json_type type);
json_type_object,
json_type_array,
json_type_string,
- json_type_int64,
*/
extern enum json_type json_object_get_type(struct json_object *obj);
@@ -252,15 +249,17 @@ extern boolean json_object_get_boolean(struct json_object *obj);
/* int type methods */
/** Create a new empty json_object of type json_type_int
+ * Note that values are stored as 64-bit values internally.
+ * To ensure the full range is maintained, use json_object_new_int64 instead.
* @param i the integer
* @returns a json_object of type json_type_int
*/
extern struct json_object* json_object_new_int(int32_t i);
-/** Create a new empty json_object of type json_type_int64
+/** Create a new empty json_object of type json_type_int
* @param i the integer
- * @returns a json_object of type json_type_int64
+ * @returns a json_object of type json_type_int
*/
extern struct json_object* json_object_new_int64(int64_t i);
@@ -271,6 +270,10 @@ extern struct json_object* json_object_new_int64(int64_t i);
* double objects will return their integer conversion. Strings will be
* parsed as an integer. If no conversion exists then 0 is returned.
*
+ * Note that integers are stored internally as 64-bit values.
+ * If the value of too big or too small to fit into 32-bit, INT32_MAX or
+ * INT32_MIN are returned, respectively.
+ *
* @param obj the json_object instance
* @returns an int
*/