diff options
author | Mirek Rusin <mirek@me.com> | 2011-04-19 12:46:52 +0100 |
---|---|---|
committer | Mirek Rusin <mirek@me.com> | 2011-04-19 12:46:52 +0100 |
commit | 49116c941312b78ca6768b916fd0d247147f1f47 (patch) | |
tree | 57eac7400e476299277490f9253e059e4d00085b | |
parent | 0d9e3589bc8d59ce963937587f634c8c9cc61643 (diff) | |
download | yajl-49116c941312b78ca6768b916fd0d247147f1f47.tar.gz |
LLVM warnings
-rw-r--r-- | src/yajl_encode.c | 4 | ||||
-rw-r--r-- | src/yajl_gen.c | 17 | ||||
-rw-r--r-- | src/yajl_parser.c | 6 |
3 files changed, 14 insertions, 13 deletions
diff --git a/src/yajl_encode.c b/src/yajl_encode.c index ad5b1c5..5e921c0 100644 --- a/src/yajl_encode.c +++ b/src/yajl_encode.c @@ -83,7 +83,7 @@ yajl_string_encode2(const yajl_print_t print, } if (escaped != NULL) { print(ctx, (const char *) (str + beg), end - beg); - print(ctx, escaped, strlen(escaped)); + print(ctx, escaped, (unsigned int)strlen(escaped)); beg = ++end; } else { ++end; @@ -178,7 +178,7 @@ void yajl_string_decode(yajl_buf buf, const unsigned char * str, default: assert("this should never happen" == NULL); } - yajl_buf_append(buf, unescaped, strlen(unescaped)); + yajl_buf_append(buf, unescaped, (unsigned int)strlen(unescaped)); beg = ++end; } else { end++; diff --git a/src/yajl_gen.c b/src/yajl_gen.c index a7b8c5a..e534527 100644 --- a/src/yajl_gen.c +++ b/src/yajl_gen.c @@ -97,11 +97,11 @@ yajl_gen_alloc2(const yajl_print_t callback, memcpy((void *) &(g->alloc), (void *) afs, sizeof(yajl_alloc_funcs)); if (config) { - char *indent = config->indentString; + const char *indent = config->indentString; g->pretty = config->beautify; g->indentString = config->indentString; if (indent) { - for (indent; *indent; indent++) { + for (; *indent; indent++) { if (*indent != '\n' && *indent != '\v' && *indent != '\f' @@ -151,14 +151,15 @@ yajl_gen_free(yajl_gen g) if (g->state[g->depth] != yajl_gen_map_val) { \ unsigned int _i; \ for (_i=0;_i<g->depth;_i++) \ - g->print(g->ctx, g->indentString, \ - strlen(g->indentString)); \ + g->print(g->ctx, \ + g->indentString, \ + (unsigned int)strlen(g->indentString)); \ } \ } #define ENSURE_NOT_KEY \ if (g->state[g->depth] == yajl_gen_map_key || \ - g->state[g->depth] == yajl_gen_map_start) { \ + g->state[g->depth] == yajl_gen_map_start) { \ return yajl_gen_keys_must_be_strings; \ } \ @@ -206,7 +207,7 @@ yajl_gen_integer(yajl_gen g, long int number) char i[32]; ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; sprintf(i, "%ld", number); - g->print(g->ctx, i, strlen(i)); + g->print(g->ctx, i, (unsigned int)strlen(i)); APPENDED_ATOM; FINAL_NEWLINE; return yajl_gen_status_ok; @@ -226,7 +227,7 @@ yajl_gen_double(yajl_gen g, double number) if (isnan(number) || isinf(number)) return yajl_gen_invalid_number; INSERT_SEP; INSERT_WHITESPACE; sprintf(i, "%.20g", number); - g->print(g->ctx, i, strlen(i)); + g->print(g->ctx, i, (unsigned int)strlen(i)); APPENDED_ATOM; FINAL_NEWLINE; return yajl_gen_status_ok; @@ -271,7 +272,7 @@ yajl_gen_bool(yajl_gen g, int boolean) const char * val = boolean ? "true" : "false"; ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - g->print(g->ctx, val, strlen(val)); + g->print(g->ctx, val, (unsigned int)strlen(val)); APPENDED_ATOM; FINAL_NEWLINE; return yajl_gen_status_ok; diff --git a/src/yajl_parser.c b/src/yajl_parser.c index 7fae6c6..2bfc352 100644 --- a/src/yajl_parser.c +++ b/src/yajl_parser.c @@ -111,9 +111,9 @@ yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText, text[i] = 0; { char * newStr = (char *) - YA_MALLOC(&(hand->alloc), (strlen((char *) str) + - strlen((char *) text) + - strlen(arrow) + 1)); + YA_MALLOC(&(hand->alloc), (unsigned int)(strlen((char *) str) + + strlen((char *) text) + + strlen(arrow) + 1)); newStr[0] = 0; strcat((char *) newStr, (char *) str); strcat((char *) newStr, text); |