]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Use size_t for json object array ops 210/head
authorDaniel M. Weeks <dan@danweeks.net>
Fri, 22 Aug 2014 16:16:45 +0000 (12:16 -0400)
committerDaniel M. Weeks <dan@danweeks.net>
Tue, 24 Nov 2015 19:00:32 +0000 (14:00 -0500)
json_object.c
json_object.h

index 9ac22a30f08f4dd58cc315c7f396ff7c9f3d6e82..8e7e8a1b3bc2646809184411fd4273cc90b53859 100644 (file)
@@ -868,7 +868,7 @@ static int json_object_array_to_json_string(struct json_object* jso,
                                             int flags)
 {
        int had_children = 0;
-       int ii;
+       size_t ii;
        sprintbuf(pb, "[");
        if (flags & JSON_C_TO_STRING_PRETTY)
                sprintbuf(pb, "\n");
@@ -959,7 +959,7 @@ struct json_object* json_object_array_bsearch(
        return *result;
 }
 
-int json_object_array_length(struct json_object *jso)
+size_t json_object_array_length(struct json_object *jso)
 {
        return array_list_length(jso->o.c_array);
 }
@@ -969,14 +969,14 @@ int json_object_array_add(struct json_object *jso,struct json_object *val)
        return array_list_add(jso->o.c_array, val);
 }
 
-int json_object_array_put_idx(struct json_object *jso, int idx,
+int json_object_array_put_idx(struct json_object *jso, size_t idx,
                              struct json_object *val)
 {
        return array_list_put_idx(jso->o.c_array, idx, val);
 }
 
 struct json_object* json_object_array_get_idx(struct json_object *jso,
-                                             int idx)
+                                             size_t idx)
 {
        return (struct json_object*)array_list_get_idx(jso->o.c_array, idx);
 }
index 67137d87125b16587a40956744d89af3be1faf54..f8106781fa13524a8e85bc161eef207a3c527208 100644 (file)
@@ -449,7 +449,7 @@ extern struct array_list* json_object_get_array(struct json_object *obj);
  * @param obj the json_object instance
  * @returns an int
  */
-extern int json_object_array_length(struct json_object *obj);
+extern size_t json_object_array_length(struct json_object *obj);
 
 /** Sorts the elements of jso of type json_type_array
 *
@@ -507,7 +507,7 @@ extern int json_object_array_add(struct json_object *obj,
  * @param idx the index to insert the element at
  * @param val the json_object to be added
  */
-extern int json_object_array_put_idx(struct json_object *obj, int idx,
+extern int json_object_array_put_idx(struct json_object *obj, size_t idx,
                                     struct json_object *val);
 
 /** Get the element at specificed index of the array (a json_object of type json_type_array)
@@ -516,7 +516,7 @@ extern int json_object_array_put_idx(struct json_object *obj, int idx,
  * @returns the json_object at the specified index (or NULL)
  */
 extern struct json_object* json_object_array_get_idx(struct json_object *obj,
-                                                    int idx);
+                                                    size_t idx);
 
 /* json_bool type methods */