-AM_CFLAGS = -Wall -Wextra -Wwrite-strings -Wno-unused-parameter -std=c99 -D_GNU_SOURCE -D_REENTRANT
+AM_CFLAGS = -Wall -Werror -Wextra -Wwrite-strings -Wno-unused-parameter -std=c99 -D_GNU_SOURCE -D_REENTRANT
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];
}
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;
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;
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;
*/
if (orig_has_neg != recheck_has_neg ||
strncmp(buf_skip_space, buf_cmp_start, strlen(buf_cmp_start)) != 0 ||
- (strlen(buf_skip_space) != buf_cmp_len &&
+ ((int)strlen(buf_skip_space) != buf_cmp_len &&
isdigit((int)buf_skip_space[buf_cmp_len])
)
)
const char *json_type_to_name(enum json_type o_type)
{
- if (o_type < 0 || o_type >= NELEM(json_type_name))
+ int o_type_int = (int)o_type;
+ if (o_type_int < 0 || o_type_int >= (int)NELEM(json_type_name))
{
MC_ERROR("json_type_to_name: type %d is out of range [0,%d]\n", o_type, NELEM(json_type_name));
return NULL;
while( 1 ) {
if(t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED) break;
t->collisions++;
- if(++n == t->size) n = 0;
+ if ((int)++n == t->size) n = 0;
}
t->table[n].k = k;
if(t->table[n].k == LH_EMPTY) return NULL;
if(t->table[n].k != LH_FREED &&
t->equal_fn(t->table[n].k, k)) return &t->table[n];
- if(++n == t->size) n = 0;
+ if ((int)++n == t->size) n = 0;
count++;
}
return NULL;
for (arg_idx = 1; arg_idx < argc ; arg_idx++)
{
int jj;
- for (jj = 0; jj < NELEM(format_args); jj++)
+ for (jj = 0; jj < (int)NELEM(format_args); jj++)
{
if (strcasecmp(argv[arg_idx], format_args[jj].arg) == 0)
{
{ "[1,2,3,]", -1, -1, json_tokener_success, 0 },
{ "[1,2,,3,]", -1, 5, json_tokener_error_parse_unexpected, 0 },
- { NULL, json_tokener_success },
+ { NULL, -1, -1, json_tokener_success, 0 },
};
static void test_incremental_parse()
char with_nulls[] = { 'a', 'b', '\0', 'c' };
printbuf_reset(pb);
- printbuf_memappend_fast(pb, with_nulls, sizeof(with_nulls));
+ printbuf_memappend_fast(pb, with_nulls, (int)sizeof(with_nulls));
printf("With embedded \\0 character: %d, [%s]\n", printbuf_length(pb), pb->buf);
printbuf_free(pb);