Unify unsigned integer usage in the API
[jansson.git] / src / dump.c
index dc27fbd..3f34919 100644 (file)
@@ -44,7 +44,7 @@ static int dump_to_file(const char *buffer, int size, void *data)
 /* 256 spaces (the maximum indentation size) */
 static char whitespace[] = "                                                                                                                                                                                                                                                                ";
 
-static int dump_indent(unsigned long flags, int depth, int space, dump_func dump, void *data)
+static int dump_indent(size_t flags, int depth, int space, dump_func dump, void *data)
 {
     if(JSON_INDENT(flags) > 0)
     {
@@ -165,7 +165,7 @@ static int object_key_compare_serials(const void *key1, const void *key2)
            (*(const object_key_t **)key2)->serial;
 }
 
-static int do_dump(const json_t *json, unsigned long flags, int depth,
+static int do_dump(const json_t *json, size_t flags, int depth,
                    dump_func dump, void *data)
 {
     int ascii = flags & JSON_ENSURE_ASCII ? 1 : 0;
@@ -307,8 +307,7 @@ static int do_dump(const json_t *json, unsigned long flags, int depth,
             if(flags & JSON_SORT_KEYS || flags & JSON_PRESERVE_ORDER)
             {
                 const object_key_t **keys;
-                unsigned int size;
-                unsigned int i;
+                size_t size, i;
                 int (*cmp_func)(const void *, const void *);
 
                 size = json_object_size(json);
@@ -415,7 +414,7 @@ static int do_dump(const json_t *json, unsigned long flags, int depth,
 }
 
 
-char *json_dumps(const json_t *json, unsigned long flags)
+char *json_dumps(const json_t *json, size_t flags)
 {
     strbuffer_t strbuff;
     char *result;
@@ -437,7 +436,7 @@ char *json_dumps(const json_t *json, unsigned long flags)
     return result;
 }
 
-int json_dumpf(const json_t *json, FILE *output, unsigned long flags)
+int json_dumpf(const json_t *json, FILE *output, size_t flags)
 {
     if(!json_is_array(json) && !json_is_object(json))
         return -1;
@@ -445,7 +444,7 @@ int json_dumpf(const json_t *json, FILE *output, unsigned long flags)
     return do_dump(json, flags, 0, dump_to_file, (void *)output);
 }
 
-int json_dump_file(const json_t *json, const char *path, unsigned long flags)
+int json_dump_file(const json_t *json, const char *path, size_t flags)
 {
     int result;