From e36b19cb22fb5b57e7c584defb33c3f5c258ea3c Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Mon, 24 Feb 2014 09:02:44 +0000 Subject: Re #1680: Fixed compile warnings on VS2005 for x64/win64 config. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4761 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib-util/src/pjlib-util-test/json_test.c | 4 ++-- pjlib-util/src/pjlib-util/json.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'pjlib-util/src') diff --git a/pjlib-util/src/pjlib-util-test/json_test.c b/pjlib-util/src/pjlib-util-test/json_test.c index cd9a8138..ddcba750 100644 --- a/pjlib-util/src/pjlib-util-test/json_test.c +++ b/pjlib-util/src/pjlib-util-test/json_test.c @@ -63,14 +63,14 @@ static int json_verify_1() pool = pj_pool_create(mem, "json", 1000, 1000, NULL); - size = strlen(json_doc1); + size = (unsigned)strlen(json_doc1); elem = pj_json_parse(pool, json_doc1, &size, &err); if (!elem) { PJ_LOG(1, (THIS_FILE, " Error: json_verify_1() parse error")); goto on_error; } - size = strlen(json_doc1) * 2; + size = (unsigned)strlen(json_doc1) * 2; out_buf = pj_pool_alloc(pool, size); if (pj_json_write(elem, out_buf, &size)) { diff --git a/pjlib-util/src/pjlib-util/json.c b/pjlib-util/src/pjlib-util/json.c index 7224d3ed..6d41bd50 100644 --- a/pjlib-util/src/pjlib-util/json.c +++ b/pjlib-util/src/pjlib-util/json.c @@ -195,7 +195,7 @@ static unsigned parse_quoted_string(struct parse_state *st, on_error: output->slen = op - output->ptr; - return ip - token.ptr; + return (unsigned)(ip - token.ptr); } static pj_json_elem* parse_elem_throw(struct parse_state *st, @@ -334,7 +334,7 @@ PJ_DEF(pj_json_elem*) pj_json_parse(pj_pool_t *pool, err_info->err_char = *st.scanner.curptr; } - *size = (buffer + *size) - st.scanner.curptr; + *size = (unsigned)((buffer + *size) - st.scanner.curptr); pj_scan_fini(&st.scanner); @@ -471,7 +471,7 @@ static pj_status_t write_string_escaped(const pj_str_t *value, } } - CHECK( st->writer( buf, op-buf, st->user_data) ); + CHECK( st->writer( buf, (unsigned)(op-buf), st->user_data) ); op = buf; } @@ -549,7 +549,8 @@ static pj_status_t elem_write(const pj_json_elem *elem, elem->type != PJ_JSON_VAL_ARRAY*/) { CHECK( st->writer( st->space, - PJ_JSON_NAME_MIN_LEN - elem->name.slen, + (unsigned)(PJ_JSON_NAME_MIN_LEN - + elem->name.slen), st->user_data) ); } } -- cgit v1.2.3