diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2013-02-09 16:35:24 -0600 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2013-02-09 16:35:24 -0600 |
commit | ca8b27d1836ff97935d2eb212f762f63b9258cbd (patch) | |
tree | 43a44a037bfa29c45738c8310640b6053f225e22 /json_tokener.c | |
parent | 92d289f5d366058284b69180c3c32ea10ef51610 (diff) |
Enable -Werror and fix a number of minor warnings that existed.
Diffstat (limited to 'json_tokener.c')
-rw-r--r-- | json_tokener.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/json_tokener.c b/json_tokener.c index 6c5924b..e0edca0 100644 --- a/json_tokener.c +++ b/json_tokener.c @@ -69,7 +69,8 @@ const char* json_tokener_errors[] = { const char *json_tokener_error_desc(enum json_tokener_error jerr) { - if (jerr < 0 || jerr > sizeof(json_tokener_errors)) + int jerr_int = (int)jerr; + if (jerr_int < 0 || jerr_int > (int)sizeof(json_tokener_errors)) return "Unknown error, invalid json_tokener_error value passed to json_tokener_error_desc()"; return json_tokener_errors[jerr]; } @@ -91,7 +92,7 @@ struct json_tokener* json_tokener_new_ex(int depth) tok = (struct json_tokener*)calloc(1, sizeof(struct json_tokener)); if (!tok) return NULL; - tok->stack = (struct json_tokener*)calloc(depth, sizeof(struct json_tokener_srec)); + tok->stack = (struct json_tokener_srec *)calloc(depth, sizeof(struct json_tokener_srec)); if (!tok->stack) { free(tok); return NULL; @@ -330,8 +331,8 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, case json_tokener_state_null: printbuf_memappend_fast(tok->pb, &c, 1); if(strncasecmp(json_null_str, tok->pb->buf, - json_min(tok->st_pos+1, strlen(json_null_str))) == 0) { - if(tok->st_pos == strlen(json_null_str)) { + json_min(tok->st_pos+1, (int)strlen(json_null_str))) == 0) { + if(tok->st_pos == (int)strlen(json_null_str)) { current = NULL; saved_state = json_tokener_state_finish; state = json_tokener_state_eatws; @@ -552,16 +553,16 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, case json_tokener_state_boolean: printbuf_memappend_fast(tok->pb, &c, 1); if(strncasecmp(json_true_str, tok->pb->buf, - json_min(tok->st_pos+1, strlen(json_true_str))) == 0) { - if(tok->st_pos == strlen(json_true_str)) { + json_min(tok->st_pos+1, (int)strlen(json_true_str))) == 0) { + if(tok->st_pos == (int)strlen(json_true_str)) { current = json_object_new_boolean(1); saved_state = json_tokener_state_finish; state = json_tokener_state_eatws; goto redo_char; } } else if(strncasecmp(json_false_str, tok->pb->buf, - json_min(tok->st_pos+1, strlen(json_false_str))) == 0) { - if(tok->st_pos == strlen(json_false_str)) { + json_min(tok->st_pos+1, (int)strlen(json_false_str))) == 0) { + if(tok->st_pos == (int)strlen(json_false_str)) { current = json_object_new_boolean(0); saved_state = json_tokener_state_finish; state = json_tokener_state_eatws; |