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 +++++---- pjlib/src/pj/errno.c | 4 ++-- pjlib/src/pj/log.c | 3 ++- pjsip/src/pjsua2/json.cpp | 2 +- pjsip/src/pjsua2/siptypes.cpp | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) 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) ); } } diff --git a/pjlib/src/pj/errno.c b/pjlib/src/pj/errno.c index ff54bd4b..dd39e23c 100644 --- a/pjlib/src/pj/errno.c +++ b/pjlib/src/pj/errno.c @@ -109,7 +109,7 @@ static int pjlib_error(pj_status_t code, char *buf, pj_size_t size) len = pj_ansi_snprintf( buf, size, "Unknown pjlib error %d", code); if (len < 1 || len >= (int)size) - len = size - 1; + len = (int)(size - 1); return len; } @@ -205,7 +205,7 @@ PJ_DEF(pj_str_t) pj_strerror( pj_status_t statcode, } if (len < 1 || len >= (int)bufsize) { - len = bufsize - 1; + len = (int)(bufsize - 1); buf[len] = '\0'; } diff --git a/pjlib/src/pj/log.c b/pjlib/src/pj/log.c index 6f0a5ef4..293ad463 100644 --- a/pjlib/src/pj/log.c +++ b/pjlib/src/pj/log.c @@ -284,7 +284,8 @@ static void resume_logging(int *saved_level) #if PJ_HAS_THREADS if (thread_suspended_tls_id != -1) { - pj_thread_local_set(thread_suspended_tls_id, (void*)PJ_FALSE); + pj_thread_local_set(thread_suspended_tls_id, + (void*)(pj_size_t)PJ_FALSE); } else #endif diff --git a/pjsip/src/pjsua2/json.cpp b/pjsip/src/pjsua2/json.cpp index afa25989..7c16e2d8 100644 --- a/pjsip/src/pjsua2/json.cpp +++ b/pjsip/src/pjsua2/json.cpp @@ -180,7 +180,7 @@ void JsonDocument::loadString(const string &input) throw(Error) PJSUA2_RAISE_ERROR3(PJ_EINVALIDOP, "JsonDocument.loadString()", "Document already initialized"); - unsigned size = input.size(); + unsigned size = (unsigned)input.size(); char *buffer = (char*)pj_pool_alloc(pool, size+1); unsigned parse_size = (unsigned)size; pj_json_err_info err_info; diff --git a/pjsip/src/pjsua2/siptypes.cpp b/pjsip/src/pjsua2/siptypes.cpp index f1d8bf2b..aca1f78b 100644 --- a/pjsip/src/pjsua2/siptypes.cpp +++ b/pjsip/src/pjsua2/siptypes.cpp @@ -163,7 +163,7 @@ pjsip_tls_setting TlsConfig::toPj() const ts.privkey_file = str2Pj(this->privKeyFile); ts.password = str2Pj(this->password); ts.method = this->method; - ts.ciphers_num = this->ciphers.size(); + ts.ciphers_num = (unsigned)this->ciphers.size(); // The following will only work if sizeof(enum)==sizeof(int) pj_assert(sizeof(ts.ciphers[0]) == sizeof(int)); ts.ciphers = ts.ciphers_num? @@ -424,7 +424,7 @@ pjsip_multipart_part& SipMultipartPart::toPj() const pjMsgBody.print_body = &pjsip_print_text_body; pjMsgBody.clone_data = &pjsip_clone_text_data; pjMsgBody.data = (void*)body.c_str(); - pjMsgBody.len = body.size(); + pjMsgBody.len = (unsigned)body.size(); pjMpp.body = &pjMsgBody; return pjMpp; -- cgit v1.2.3