From fc591913ac600c57a900a81c0b7e67a9b6e38bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20R=C3=B6hrle?= Date: Fri, 31 Aug 2018 09:01:36 +0200 Subject: [PATCH] removed various warnings --- src/dump.c | 10 +++++----- src/hashtable_seed.c | 2 +- src/load.c | 4 ++-- src/value.c | 4 ---- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/dump.c b/src/dump.c index 4a64aa4..5a76630 100644 --- a/src/dump.c +++ b/src/dump.c @@ -101,7 +101,7 @@ static int dump_indent(size_t flags, int depth, int space, json_dump_callback_t static int dump_string(const char *str, size_t len, json_dump_callback_t dump, void *data, size_t flags) { const char *pos, *end, *lim; - int32_t codepoint; + int32_t codepoint = 0; if(dump("\"", 1, data)) return -1; @@ -351,7 +351,7 @@ static int do_dump(const json_t *json, size_t flags, int depth, } assert(i == size); - qsort(keys, size, sizeof(const char *), compare_keys); + qsort((void*)keys, size, sizeof(const char *), compare_keys); for(i = 0; i < size; i++) { @@ -366,7 +366,7 @@ static int do_dump(const json_t *json, size_t flags, int depth, if(dump(separator, separator_length, data) || do_dump(value, flags, depth + 1, parents, dump, data)) { - jsonp_free(keys); + jsonp_free((void*)keys); return -1; } @@ -375,7 +375,7 @@ static int do_dump(const json_t *json, size_t flags, int depth, if(dump(",", 1, data) || dump_indent(flags, depth + 1, 1, dump, data)) { - jsonp_free(keys); + jsonp_free((void*)keys); return -1; } } @@ -383,7 +383,7 @@ static int do_dump(const json_t *json, size_t flags, int depth, { if(dump_indent(flags, depth, 0, dump, data)) { - jsonp_free(keys); + jsonp_free((void*)keys); return -1; } } diff --git a/src/hashtable_seed.c b/src/hashtable_seed.c index 8aed540..540358a 100644 --- a/src/hashtable_seed.c +++ b/src/hashtable_seed.c @@ -164,7 +164,7 @@ static int seed_from_timestamp_and_pid(uint32_t *seed) { } static uint32_t generate_seed() { - uint32_t seed; + uint32_t seed = 0; int done = 0; #if !defined(_WIN32) && defined(USE_URANDOM) diff --git a/src/load.c b/src/load.c index 25efe2e..27d473e 100644 --- a/src/load.c +++ b/src/load.c @@ -174,7 +174,7 @@ static int stream_get(stream_t *stream, json_error_t *error) return STREAM_STATE_EOF; } - stream->buffer[0] = c; + stream->buffer[0] = (char) c; stream->buffer_pos = 0; if(0x80 <= c && c <= 0xFF) @@ -189,7 +189,7 @@ static int stream_get(stream_t *stream, json_error_t *error) assert(count >= 2); for(i = 1; i < count; i++) - stream->buffer[i] = stream->get(stream->data); + stream->buffer[i] = (char) stream->get(stream->data); if(!utf8_check_full(stream->buffer, count, NULL)) goto out; diff --git a/src/value.c b/src/value.c index 861dce8..3f964a0 100644 --- a/src/value.c +++ b/src/value.c @@ -1044,8 +1044,6 @@ json_t *json_copy(json_t *json) default: return NULL; } - - return NULL; } json_t *json_deep_copy(const json_t *json) @@ -1073,6 +1071,4 @@ json_t *json_deep_copy(const json_t *json) default: return NULL; } - - return NULL; }