From 9b435df3d42e3a2da2209f16963a5dd95703429a Mon Sep 17 00:00:00 2001 From: Shawn Harris Date: Mon, 24 Nov 2014 14:04:13 -0700 Subject: [PATCH] Warnings - use size_t where appropriate to prevent warning when compilation is targeting 64 bit --- src/dump.c | 5 +++-- src/error.c | 2 +- src/load.c | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/dump.c b/src/dump.c index 79cb2f2..a0932e0 100644 --- a/src/dump.c +++ b/src/dump.c @@ -224,8 +224,9 @@ static int do_dump(const json_t *json, size_t flags, int depth, case JSON_ARRAY: { - int i; - int n; + size_t n; + size_t i; + json_array_t *array; /* detect circular references */ diff --git a/src/error.c b/src/error.c index a544a59..2ba8d82 100644 --- a/src/error.c +++ b/src/error.c @@ -56,7 +56,7 @@ void jsonp_error_vset(json_error_t *error, int line, int column, error->line = line; error->column = column; - error->position = position; + error->position = (int)position; vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap); error->text[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; diff --git a/src/load.c b/src/load.c index 722f2d7..e96f8fe 100644 --- a/src/load.c +++ b/src/load.c @@ -169,7 +169,7 @@ static int stream_get(stream_t *stream, json_error_t *error) if(0x80 <= c && c <= 0xFF) { /* multi-byte UTF-8 sequence */ - int i, count; + size_t i, count; count = utf8_check_first(c); if(!count) @@ -265,7 +265,7 @@ static void lex_unget_unsave(lex_t *lex, int c) #endif stream_unget(&lex->stream, c); #ifndef NDEBUG - d = + d = #endif strbuffer_pop(&lex->saved_text); assert(c == d); @@ -900,7 +900,7 @@ static json_t *parse_json(lex_t *lex, size_t flags, json_error_t *error) if(error) { /* Save the position even though there was no error */ - error->position = lex->stream.position; + error->position = (int)lex->stream.position; } return result;