From d7aa4332dae06ae890053dd13239ddabee46b86c Mon Sep 17 00:00:00 2001 From: Riza Sulistyo Date: Wed, 19 Jun 2013 06:47:43 +0000 Subject: Re #1680: Add initial support for Win64 git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4537 74dad513-b988-da41-8d7b-12977e46ad98 --- pjnath/build/pjnath.vcproj | 1412 ++++++++++++++++++--------- pjnath/build/pjnath_test.vcproj | 1728 ++++++++++++++++++++++------------ pjnath/build/pjstun_srv_test.vcproj | 250 ++++- pjnath/build/pjturn_client.vcproj | 178 +++- pjnath/src/pjnath-test/concur_test.c | 2 +- pjnath/src/pjnath-test/server.c | 2 +- pjnath/src/pjnath-test/sess_auth.c | 8 +- pjnath/src/pjnath-test/stun.c | 12 +- pjnath/src/pjnath-test/test.c | 4 +- pjnath/src/pjnath/ice_session.c | 2 +- pjnath/src/pjnath/ice_strans.c | 20 +- pjnath/src/pjnath/nat_detect.c | 3 +- pjnath/src/pjnath/stun_auth.c | 10 +- pjnath/src/pjnath/stun_msg.c | 26 +- pjnath/src/pjnath/stun_msg_dump.c | 12 +- pjnath/src/pjnath/stun_session.c | 24 +- pjnath/src/pjnath/stun_sock.c | 4 +- pjnath/src/pjnath/turn_session.c | 10 +- pjnath/src/pjnath/turn_sock.c | 4 +- 19 files changed, 2573 insertions(+), 1138 deletions(-) (limited to 'pjnath') diff --git a/pjnath/build/pjnath.vcproj b/pjnath/build/pjnath.vcproj index b794c473..bd346264 100644 --- a/pjnath/build/pjnath.vcproj +++ b/pjnath/build/pjnath.vcproj @@ -11,16 +11,19 @@ Name="Win32" /> + - - + + - - - - + + - - - - - + + - + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3053,6 +3266,15 @@ PreprocessorDefinitions="" /> + + + @@ -3062,6 +3284,15 @@ PreprocessorDefinitions="" /> + + + @@ -3071,6 +3302,15 @@ PreprocessorDefinitions="" /> + + + @@ -3080,6 +3320,15 @@ PreprocessorDefinitions="" /> + + + @@ -3089,6 +3338,15 @@ PreprocessorDefinitions="" /> + + + + + + @@ -3111,6 +3378,15 @@ PreprocessorDefinitions="" /> + + + @@ -3120,6 +3396,15 @@ PreprocessorDefinitions="" /> + + + @@ -3129,6 +3414,15 @@ PreprocessorDefinitions="" /> + + + @@ -3138,6 +3432,15 @@ PreprocessorDefinitions="" /> + + + @@ -3147,6 +3450,15 @@ PreprocessorDefinitions="" /> + + + + + + @@ -3169,6 +3490,15 @@ PreprocessorDefinitions="" /> + + + @@ -3178,6 +3508,15 @@ PreprocessorDefinitions="" /> + + + @@ -3187,6 +3526,15 @@ PreprocessorDefinitions="" /> + + + @@ -3196,6 +3544,15 @@ PreprocessorDefinitions="" /> + + + @@ -3205,6 +3562,15 @@ PreprocessorDefinitions="" /> + + + + + + @@ -3227,6 +3602,15 @@ PreprocessorDefinitions="" /> + + + @@ -3236,6 +3620,15 @@ PreprocessorDefinitions="" /> + + + @@ -3245,6 +3638,15 @@ PreprocessorDefinitions="" /> + + + @@ -3254,6 +3656,15 @@ PreprocessorDefinitions="" /> + + + @@ -3263,6 +3674,15 @@ PreprocessorDefinitions="" /> + + + + + + @@ -3289,6 +3718,15 @@ PreprocessorDefinitions="" /> + + + @@ -3298,6 +3736,15 @@ PreprocessorDefinitions="" /> + + + @@ -3307,6 +3754,15 @@ PreprocessorDefinitions="" /> + + + @@ -3316,6 +3772,15 @@ PreprocessorDefinitions="" /> + + + @@ -3325,6 +3790,15 @@ PreprocessorDefinitions="" /> + + + + + @@ -374,29 +362,24 @@ Name="VCBscMakeTool" /> - - - - - - - - - - - - - - - - - - - - - - + @@ -657,30 +564,25 @@ Name="VCBscMakeTool" /> - - + @@ -1013,29 +903,24 @@ Name="VCBscMakeTool" /> + + - - - @@ -1158,27 +1033,27 @@ Name="VCBscMakeTool" /> - - + @@ -1226,29 +1105,25 @@ Name="VCBscMakeTool" /> - - + @@ -1296,29 +1173,24 @@ Name="VCBscMakeTool" /> - - + @@ -1506,29 +1376,25 @@ Name="VCBscMakeTool" /> - - + @@ -1576,29 +1444,24 @@ Name="VCBscMakeTool" /> - - + @@ -1786,28 +1646,23 @@ Name="VCBscMakeTool" /> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + @@ -3152,7 +3521,7 @@ /> + + + @@ -3177,7 +3555,7 @@ /> + + + @@ -3202,7 +3589,7 @@ /> + + + @@ -3227,7 +3623,7 @@ /> + + + @@ -3252,7 +3657,7 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + @@ -3541,6 +4012,15 @@ PreprocessorDefinitions="" /> + + + @@ -3550,6 +4030,15 @@ PreprocessorDefinitions="" /> + + + @@ -3559,6 +4048,15 @@ PreprocessorDefinitions="" /> + + + @@ -3568,6 +4066,15 @@ PreprocessorDefinitions="" /> + + + @@ -3577,6 +4084,15 @@ PreprocessorDefinitions="" /> + + + + + + @@ -3603,6 +4128,15 @@ PreprocessorDefinitions="" /> + + + @@ -3612,6 +4146,15 @@ PreprocessorDefinitions="" /> + + + @@ -3621,6 +4164,15 @@ PreprocessorDefinitions="" /> + + + @@ -3630,6 +4182,15 @@ PreprocessorDefinitions="" /> + + + @@ -3639,6 +4200,15 @@ PreprocessorDefinitions="" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + server_sock, &rdset); - n = pj_sock_select(test_sess->server_sock+1, &rdset, + n = pj_sock_select((int)test_sess->server_sock+1, &rdset, NULL, NULL, &timeout); if (n==1 && PJ_FD_ISSET(test_sess->server_sock, &rdset)) { pj_uint8_t pkt[512]; diff --git a/pjnath/src/pjnath-test/server.c b/pjnath/src/pjnath-test/server.c index eef4fb1e..0b07180d 100644 --- a/pjnath/src/pjnath-test/server.c +++ b/pjnath/src/pjnath-test/server.c @@ -732,7 +732,7 @@ static pj_bool_t alloc_on_data_recvfrom(pj_activesock_t *asock, pj_sockaddr_cp(&pa->sockaddr, src_addr); da->data = (pj_uint8_t*)data; - da->length = size; + da->length = (unsigned)size; /* Encode Data indication */ status = pj_stun_msg_encode(alloc->data_ind, buffer, sizeof(buffer), 0, diff --git a/pjnath/src/pjnath-test/sess_auth.c b/pjnath/src/pjnath-test/sess_auth.c index 6db3f333..4093c1bb 100644 --- a/pjnath/src/pjnath-test/sess_auth.c +++ b/pjnath/src/pjnath-test/sess_auth.c @@ -173,8 +173,8 @@ static int server_thread(void *unused) PJ_FD_ZERO(&readset); PJ_FD_SET(server->sock, &readset); - if (pj_sock_select(server->sock+1, &readset, NULL, NULL, &delay)==1 && - PJ_FD_ISSET(server->sock, &readset)) + if (pj_sock_select((int)server->sock+1, &readset, NULL, NULL, &delay)==1 + && PJ_FD_ISSET(server->sock, &readset)) { char pkt[1000]; pj_ssize_t len; @@ -386,8 +386,8 @@ static int client_thread(void *unused) PJ_FD_ZERO(&readset); PJ_FD_SET(client->sock, &readset); - if (pj_sock_select(client->sock+1, &readset, NULL, NULL, &delay)==1 && - PJ_FD_ISSET(client->sock, &readset)) + if (pj_sock_select((int)client->sock+1, &readset, NULL, NULL, &delay)==1 + && PJ_FD_ISSET(client->sock, &readset)) { char pkt[1000]; pj_ssize_t len; diff --git a/pjnath/src/pjnath-test/stun.c b/pjnath/src/pjnath-test/stun.c index f0044c66..3070d173 100644 --- a/pjnath/src/pjnath-test/stun.c +++ b/pjnath/src/pjnath-test/stun.c @@ -668,7 +668,7 @@ static int fingerprint_test_vector() /* Print our raw message */ PJ_LOG(4,(THIS_FILE, "Message PDU:\n%s", - print_binary((pj_uint8_t*)buf, len))); + print_binary((pj_uint8_t*)buf, (unsigned)len))); /* Print our message */ pj_stun_msg_dump(msg, print, sizeof(print), NULL); @@ -681,7 +681,7 @@ static int fingerprint_test_vector() goto on_return; } - pos = cmp_buf(buf, (const pj_uint8_t*)v->pdu, len); + pos = cmp_buf(buf, (const pj_uint8_t*)v->pdu, (unsigned)len); if (pos != (unsigned)-1) { PJ_LOG(1,(THIS_FILE, " Message mismatch at byte %d", pos)); rc = -1060; @@ -701,7 +701,7 @@ static int fingerprint_test_vector() cred.data.static_cred.data = pj_str(v->password); cred.data.static_cred.nonce = pj_str(v->nonce); - status = pj_stun_authenticate_request(buf, len, msg, + status = pj_stun_authenticate_request(buf, (unsigned)len, msg, &cred, pool, NULL, NULL); if (status != PJ_SUCCESS) { char errmsg[PJ_ERR_MSG_SIZE]; @@ -715,7 +715,8 @@ static int fingerprint_test_vector() } else if (PJ_STUN_IS_RESPONSE(msg->hdr.type)) { pj_status_t status; - status = pj_stun_authenticate_response(buf, len, msg, &key); + status = pj_stun_authenticate_response(buf, (unsigned)len, + msg, &key); if (status != PJ_SUCCESS) { char errmsg[PJ_ERR_MSG_SIZE]; pj_strerror(status, errmsg, sizeof(errmsg)); @@ -942,7 +943,8 @@ static int handle_unknown_non_mandatory(void) cred.data.static_cred.data = PASSWORD; PJ_LOG(3,(THIS_FILE, " authenticating")); - rc += pj_stun_authenticate_request(packet, len, msg1, &cred, pool, NULL, NULL); + rc += pj_stun_authenticate_request(packet, (unsigned)len, msg1, &cred, pool, + NULL, NULL); PJ_LOG(3,(THIS_FILE, " clone")); msg2 = pj_stun_msg_clone(pool, msg1); diff --git a/pjnath/src/pjnath-test/test.c b/pjnath/src/pjnath-test/test.c index b100af3d..e8f93080 100644 --- a/pjnath/src/pjnath-test/test.c +++ b/pjnath/src/pjnath-test/test.c @@ -107,10 +107,10 @@ void capture_pjlib_state(pj_stun_config *cfg, struct pjlib_state *st) { pj_caching_pool *cp; - st->timer_cnt = pj_timer_heap_count(cfg->timer_heap); + st->timer_cnt = (unsigned)pj_timer_heap_count(cfg->timer_heap); cp = (pj_caching_pool*)cfg->pf; - st->pool_used_cnt = cp->used_count; + st->pool_used_cnt = (unsigned)cp->used_count; } int check_pjlib_state(pj_stun_config *cfg, diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c index 339ed070..6eca2853 100644 --- a/pjnath/src/pjnath/ice_session.c +++ b/pjnath/src/pjnath/ice_session.c @@ -101,7 +101,7 @@ static pj_uint8_t cand_type_prefs[4] = #define CHECK_NAME_LEN 128 #define LOG4(expr) PJ_LOG(4,expr) #define LOG5(expr) PJ_LOG(4,expr) -#define GET_LCAND_ID(cand) (cand - ice->lcand) +#define GET_LCAND_ID(cand) (unsigned)(cand - ice->lcand) #define GET_CHECK_ID(cl, chk) (chk - (cl)->checks) diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c index 95c6cf78..84dc2bb4 100644 --- a/pjnath/src/pjnath/ice_strans.c +++ b/pjnath/src/pjnath/ice_strans.c @@ -438,7 +438,7 @@ static pj_status_t create_comp(pj_ice_strans *ice_st, unsigned comp_id) cand->type, &cand->base_addr); /* Set default candidate to srflx */ - comp->default_cand = cand - comp->cand_list; + comp->default_cand = (unsigned)(cand - comp->cand_list); pj_log_pop_indent(); } @@ -1197,14 +1197,17 @@ PJ_DEF(pj_status_t) pj_ice_strans_sendto( pj_ice_strans *ice_st, comp->turn_log_off = PJ_TRUE; } - status = pj_turn_sock_sendto(comp->turn_sock, (const pj_uint8_t*)data, data_len, + status = pj_turn_sock_sendto(comp->turn_sock, + (const pj_uint8_t*)data, + (unsigned)data_len, dst_addr, dst_addr_len); return (status==PJ_SUCCESS||status==PJ_EPENDING) ? PJ_SUCCESS : status; } else { pkt_size = data_len; status = pj_stun_sock_sendto(comp->stun_sock, NULL, data, - data_len, 0, dst_addr, dst_addr_len); + (unsigned)data_len, 0, dst_addr, + dst_addr_len); return (status==PJ_SUCCESS||status==PJ_EPENDING) ? PJ_SUCCESS : status; } @@ -1339,14 +1342,15 @@ static pj_status_t ice_tx_pkt(pj_ice_sess *ice, if (transport_id == TP_TURN) { if (comp->turn_sock) { status = pj_turn_sock_sendto(comp->turn_sock, - (const pj_uint8_t*)pkt, size, + (const pj_uint8_t*)pkt, + (unsigned)size, dst_addr, dst_addr_len); } else { status = PJ_EINVALIDOP; } } else if (transport_id == TP_STUN) { status = pj_stun_sock_sendto(comp->stun_sock, NULL, - pkt, size, 0, + pkt, (unsigned)size, 0, dst_addr, dst_addr_len); } else { pj_assert(!"Invalid transport ID"); @@ -1520,7 +1524,7 @@ static pj_bool_t stun_on_status(pj_stun_sock *stun_sock, if (dup) { /* Duplicate found, remove the srflx candidate */ - unsigned idx = cand - comp->cand_list; + unsigned idx = (unsigned)(cand - comp->cand_list); /* Update default candidate index */ if (comp->default_cand > idx) { @@ -1563,7 +1567,7 @@ static pj_bool_t stun_on_status(pj_stun_sock *stun_sock, comp->comp_id)); if (cand) { - unsigned idx = cand - comp->cand_list; + unsigned idx = (unsigned)(cand - comp->cand_list); /* Update default candidate index */ if (comp->default_cand == idx) { @@ -1694,7 +1698,7 @@ static void turn_on_state(pj_turn_sock *turn_sock, pj_turn_state_t old_state, cand->status = PJ_SUCCESS; /* Set default candidate to relay */ - comp->default_cand = cand - comp->cand_list; + comp->default_cand = (unsigned)(cand - comp->cand_list); PJ_LOG(4,(comp->ice_st->obj_name, "Comp %d: TURN allocation complete, relay address is %s", diff --git a/pjnath/src/pjnath/nat_detect.c b/pjnath/src/pjnath/nat_detect.c index 3dfed92a..546f63d4 100644 --- a/pjnath/src/pjnath/nat_detect.c +++ b/pjnath/src/pjnath/nat_detect.c @@ -410,7 +410,8 @@ static void on_read_complete(pj_ioqueue_key_t *key, -bytes_read != PJ_STATUS_FROM_OS(OSERR_ECONNRESET)) { /* Permanent error */ - end_session(sess, -bytes_read, PJ_STUN_NAT_TYPE_ERR_UNKNOWN); + end_session(sess, (pj_status_t)-bytes_read, + PJ_STUN_NAT_TYPE_ERR_UNKNOWN); goto on_return; } diff --git a/pjnath/src/pjnath/stun_auth.c b/pjnath/src/pjnath/stun_auth.c index 3bafb5ce..06cb4992 100644 --- a/pjnath/src/pjnath/stun_auth.c +++ b/pjnath/src/pjnath/stun_auth.c @@ -98,7 +98,7 @@ static void calc_md5_key(pj_uint8_t digest[16], /* Add username */ s = *username; REMOVE_QUOTE(s); - pj_md5_update(&ctx, (pj_uint8_t*)s.ptr, s.slen); + pj_md5_update(&ctx, (pj_uint8_t*)s.ptr, (unsigned)s.slen); /* Add single colon */ pj_md5_update(&ctx, (pj_uint8_t*)":", 1); @@ -106,7 +106,7 @@ static void calc_md5_key(pj_uint8_t digest[16], /* Add realm */ s = *realm; REMOVE_QUOTE(s); - pj_md5_update(&ctx, (pj_uint8_t*)s.ptr, s.slen); + pj_md5_update(&ctx, (pj_uint8_t*)s.ptr, (unsigned)s.slen); #undef REMOVE_QUOTE @@ -114,7 +114,7 @@ static void calc_md5_key(pj_uint8_t digest[16], pj_md5_update(&ctx, (pj_uint8_t*)":", 1); /* Add password */ - pj_md5_update(&ctx, (pj_uint8_t*)passwd->ptr, passwd->slen); + pj_md5_update(&ctx, (pj_uint8_t*)passwd->ptr, (unsigned)passwd->slen); /* Done */ pj_md5_final(&ctx, digest); @@ -443,7 +443,7 @@ PJ_DEF(pj_status_t) pj_stun_authenticate_request(const pj_uint8_t *pkt, /* Now calculate HMAC of the message. */ pj_hmac_sha1_init(&ctx, (pj_uint8_t*)p_info->auth_key.ptr, - p_info->auth_key.slen); + (unsigned)p_info->auth_key.slen); #if PJ_STUN_OLD_STYLE_MI_FINGERPRINT /* Pre rfc3489bis-06 style of calculation */ @@ -587,7 +587,7 @@ PJ_DEF(pj_status_t) pj_stun_authenticate_response(const pj_uint8_t *pkt, } /* Now calculate HMAC of the message. */ - pj_hmac_sha1_init(&ctx, (pj_uint8_t*)key->ptr, key->slen); + pj_hmac_sha1_init(&ctx, (pj_uint8_t*)key->ptr, (unsigned)key->slen); #if PJ_STUN_OLD_STYLE_MI_FINGERPRINT /* Pre rfc3489bis-06 style of calculation */ diff --git a/pjnath/src/pjnath/stun_msg.c b/pjnath/src/pjnath/stun_msg.c index e6f99159..ffdf09f1 100644 --- a/pjnath/src/pjnath/stun_msg.c +++ b/pjnath/src/pjnath/stun_msg.c @@ -1111,7 +1111,7 @@ static pj_status_t encode_sockaddr_attr(const void *a, pj_uint8_t *buf, } /* Done */ - *printed = buf - start_buf; + *printed = (unsigned)(buf - start_buf); return PJ_SUCCESS; } @@ -1227,7 +1227,7 @@ static pj_status_t encode_string_attr(const void *a, pj_uint8_t *buf, PJ_UNUSED_ARG(msghdr); /* Calculated total attr_len (add padding if necessary) */ - *printed = (ca->value.slen + ATTR_HDR_LEN + 3) & (~3); + *printed = ((unsigned)ca->value.slen + ATTR_HDR_LEN + 3) & (~3); if (len < *printed) { *printed = 0; return PJ_ETOOSMALL; @@ -1795,7 +1795,7 @@ static pj_status_t encode_errcode_attr(const void *a, pj_uint8_t *buf, pj_memcpy(buf + ATTR_HDR_LEN + 4, ca->reason.ptr, ca->reason.slen); /* Done */ - *printed = (ATTR_HDR_LEN + 4 + ca->reason.slen + 3) & (~3); + *printed = (ATTR_HDR_LEN + 4 + (unsigned)ca->reason.slen + 3) & (~3); return PJ_SUCCESS; } @@ -2190,7 +2190,7 @@ PJ_DEF(pj_status_t) pj_stun_msg_add_attr(pj_stun_msg *msg, PJ_DEF(pj_status_t) pj_stun_msg_check(const pj_uint8_t *pdu, pj_size_t pdu_len, unsigned options) { - pj_size_t msg_len; + pj_uint32_t msg_len; PJ_ASSERT_RETURN(pdu, PJ_EINVAL); @@ -2626,15 +2626,15 @@ PJ_DEF(pj_status_t) pj_stun_msg_encode(pj_stun_msg *msg, adesc = find_attr_desc(attr_hdr->type); if (adesc) { - status = adesc->encode_attr(attr_hdr, buf, buf_size, &msg->hdr, - &printed); + status = adesc->encode_attr(attr_hdr, buf, (unsigned)buf_size, + &msg->hdr, &printed); } else { /* This may be a generic attribute */ const pj_stun_binary_attr *bin_attr = (const pj_stun_binary_attr*) attr_hdr; PJ_ASSERT_RETURN(bin_attr->magic == PJ_STUN_MAGIC, PJ_EBUG); - status = encode_binary_attr(bin_attr, buf, buf_size, &msg->hdr, - &printed); + status = encode_binary_attr(bin_attr, buf, (unsigned)buf_size, + &msg->hdr, &printed); } if (status != PJ_SUCCESS) @@ -2725,8 +2725,10 @@ PJ_DEF(pj_status_t) pj_stun_msg_encode(pj_stun_msg *msg, /* Calculate HMAC-SHA1 digest, add zero padding to input * if necessary to make the input 64 bytes aligned. */ - pj_hmac_sha1_init(&ctx, (const pj_uint8_t*)key->ptr, key->slen); - pj_hmac_sha1_update(&ctx, (const pj_uint8_t*)start, buf-start); + pj_hmac_sha1_init(&ctx, (const pj_uint8_t*)key->ptr, + (unsigned)key->slen); + pj_hmac_sha1_update(&ctx, (const pj_uint8_t*)start, + (unsigned)(buf-start)); #if PJ_STUN_OLD_STYLE_MI_FINGERPRINT // These are obsoleted in rfc3489bis-08 if ((buf-start) & 0x3F) { @@ -2738,7 +2740,7 @@ PJ_DEF(pj_status_t) pj_stun_msg_encode(pj_stun_msg *msg, pj_hmac_sha1_final(&ctx, amsgint->hmac); /* Put this attribute in the message */ - status = encode_msgint_attr(amsgint, buf, buf_size, + status = encode_msgint_attr(amsgint, buf, (unsigned)buf_size, &msg->hdr, &printed); if (status != PJ_SUCCESS) return status; @@ -2760,7 +2762,7 @@ PJ_DEF(pj_status_t) pj_stun_msg_encode(pj_stun_msg *msg, afingerprint->value ^= STUN_XOR_FINGERPRINT; /* Put this attribute in the message */ - status = encode_uint_attr(afingerprint, buf, buf_size, + status = encode_uint_attr(afingerprint, buf, (unsigned)buf_size, &msg->hdr, &printed); if (status != PJ_SUCCESS) return status; diff --git a/pjnath/src/pjnath/stun_msg_dump.c b/pjnath/src/pjnath/stun_msg_dump.c index ea62f734..6428d97e 100644 --- a/pjnath/src/pjnath/stun_msg_dump.c +++ b/pjnath/src/pjnath/stun_msg_dump.c @@ -199,7 +199,7 @@ static int print_attr(char *buffer, unsigned length, const pj_stun_msgint_attr *attr; attr = (const pj_stun_msgint_attr*) ahdr; - len = print_binary(p, end-p, attr->hmac, 20); + len = print_binary(p, (unsigned)(end-p), attr->hmac, 20); APPLY(); } break; @@ -209,7 +209,7 @@ static int print_attr(char *buffer, unsigned length, const pj_stun_binary_attr *attr; attr = (const pj_stun_binary_attr*) ahdr; - len = print_binary(p, end-p, attr->data, attr->length); + len = print_binary(p, (unsigned)(end-p), attr->data, attr->length); APPLY(); } break; @@ -226,7 +226,7 @@ static int print_attr(char *buffer, unsigned length, for (i=0; i<8; ++i) data[i] = ((const pj_uint8_t*)&attr->value)[7-i]; - len = print_binary(p, end-p, data, 8); + len = print_binary(p, (unsigned)(end-p), data, 8); APPLY(); } break; @@ -238,7 +238,7 @@ static int print_attr(char *buffer, unsigned length, break; } - return (p-buffer); + return (int)(p-buffer); on_return: return len; @@ -280,14 +280,14 @@ PJ_DEF(char*) pj_stun_msg_dump(const pj_stun_msg *msg, APPLY(); for (i=0; iattr_count; ++i) { - len = print_attr(p, end-p, msg->attr[i]); + len = print_attr(p, (unsigned)(end-p), msg->attr[i]); APPLY(); } on_return: *p = '\0'; if (printed_len) - *printed_len = (p-buffer); + *printed_len = (unsigned)(p-buffer); return buffer; #undef APPLY diff --git a/pjnath/src/pjnath/stun_session.c b/pjnath/src/pjnath/stun_session.c index 173c729d..23c3c99b 100644 --- a/pjnath/src/pjnath/stun_session.c +++ b/pjnath/src/pjnath/stun_session.c @@ -953,7 +953,7 @@ PJ_DEF(pj_status_t) pj_stun_session_send_msg( pj_stun_session *sess, } /* Dump packet */ - dump_tx_msg(sess, tdata->msg, tdata->pkt_size, server); + dump_tx_msg(sess, tdata->msg, (unsigned)tdata->pkt_size, server); /* If this is a STUN request message, then send the request with * a new STUN client transaction. @@ -973,7 +973,8 @@ PJ_DEF(pj_status_t) pj_stun_session_send_msg( pj_stun_session *sess, /* Send the request! */ status = pj_stun_client_tsx_send_msg(tdata->client_tsx, retransmit, - tdata->pkt, tdata->pkt_size); + tdata->pkt, + (unsigned)tdata->pkt_size); if (status != PJ_SUCCESS && status != PJ_EPENDING) { pj_stun_msg_destroy_tdata(sess, tdata); LOG_ERR_(sess, "Error sending STUN request", status); @@ -1165,10 +1166,10 @@ static pj_status_t send_response(pj_stun_session *sess, void *token, } /* Print log */ - dump_tx_msg(sess, response, out_len, addr); + dump_tx_msg(sess, response, (unsigned)out_len, addr); /* Send packet */ - status = sess->cb.on_send_msg(sess, token, out_pkt, out_len, + status = sess->cb.on_send_msg(sess, token, out_pkt, (unsigned)out_len, addr, addr_len); return status; @@ -1442,7 +1443,7 @@ PJ_DEF(pj_status_t) pj_stun_session_on_rx_pkt(pj_stun_session *sess, goto on_return; } - dump_rx_msg(sess, msg, pkt_size, src_addr); + dump_rx_msg(sess, msg, (unsigned)pkt_size, src_addr); /* For requests, check if we have cached response */ status = check_cached_response(sess, sess->rx_pool, msg, @@ -1456,20 +1457,23 @@ PJ_DEF(pj_status_t) pj_stun_session_on_rx_pkt(pj_stun_session *sess, PJ_STUN_IS_ERROR_RESPONSE(msg->hdr.type)) { status = on_incoming_response(sess, options, - (const pj_uint8_t*) packet, pkt_size, - msg, src_addr, src_addr_len); + (const pj_uint8_t*) packet, + (unsigned)pkt_size, msg, + src_addr, src_addr_len); } else if (PJ_STUN_IS_REQUEST(msg->hdr.type)) { status = on_incoming_request(sess, options, token, sess->rx_pool, - (const pj_uint8_t*) packet, pkt_size, + (const pj_uint8_t*) packet, + (unsigned)pkt_size, msg, src_addr, src_addr_len); } else if (PJ_STUN_IS_INDICATION(msg->hdr.type)) { status = on_incoming_indication(sess, token, sess->rx_pool, - (const pj_uint8_t*) packet, pkt_size, - msg, src_addr, src_addr_len); + (const pj_uint8_t*) packet, + (unsigned)pkt_size, msg, src_addr, + src_addr_len); } else { pj_assert(!"Unexpected!"); diff --git a/pjnath/src/pjnath/stun_sock.c b/pjnath/src/pjnath/stun_sock.c index bc395411..b0bad9e3 100644 --- a/pjnath/src/pjnath/stun_sock.c +++ b/pjnath/src/pjnath/stun_sock.c @@ -119,7 +119,7 @@ static void start_ka_timer(pj_stun_sock *stun_sock); /* Keep-alive timer callback */ static void ka_timer_cb(pj_timer_heap_t *th, pj_timer_entry *te); -#define INTERNAL_MSG_TOKEN (void*)1 +#define INTERNAL_MSG_TOKEN (void*)(pj_ssize_t)1 /* @@ -909,7 +909,7 @@ process_app_data: if (stun_sock->cb.on_rx_data) { pj_bool_t ret; - ret = (*stun_sock->cb.on_rx_data)(stun_sock, data, size, + ret = (*stun_sock->cb.on_rx_data)(stun_sock, data, (unsigned)size, src_addr, addr_len); status = pj_grp_lock_release(stun_sock->grp_lock); return status!=PJ_EGONE ? PJ_TRUE : PJ_FALSE; diff --git a/pjnath/src/pjnath/turn_session.c b/pjnath/src/pjnath/turn_session.c index 536634c4..5cecd2e3 100644 --- a/pjnath/src/pjnath/turn_session.c +++ b/pjnath/src/pjnath/turn_session.c @@ -807,7 +807,7 @@ PJ_DEF(pj_status_t) pj_turn_session_set_perm( pj_turn_session *sess, /* Create request token to map the request to the perm structures * which the request belongs. */ - req_token = (void*)(long)pj_rand(); + req_token = (void*)(pj_ssize_t)pj_rand(); /* Process the addresses */ for (i=0; icb.on_send_pkt(sess, sess->tx_pkt, send_ind_len, + status = sess->cb.on_send_pkt(sess, sess->tx_pkt, + (unsigned)send_ind_len, sess->srv_addr, pj_sockaddr_get_len(sess->srv_addr)); } @@ -1207,7 +1208,8 @@ static pj_status_t stun_on_send_msg(pj_stun_session *stun, PJ_UNUSED_ARG(token); sess = (pj_turn_session*) pj_stun_session_get_user_data(stun); - return (*sess->cb.on_send_pkt)(sess, (const pj_uint8_t*)pkt, pkt_size, + return (*sess->cb.on_send_pkt)(sess, (const pj_uint8_t*)pkt, + (unsigned)pkt_size, dst_addr, addr_len); } @@ -1887,7 +1889,7 @@ static unsigned refresh_permissions(pj_turn_session *sess, /* Create request token to map the request to the perm * structures which the request belongs. */ - req_token = (void*)(long)pj_rand(); + req_token = (void*)(pj_ssize_t)pj_rand(); } status = pj_stun_msg_add_sockaddr_attr( diff --git a/pjnath/src/pjnath/turn_sock.c b/pjnath/src/pjnath/turn_sock.c index 6392428f..7dde5a5e 100644 --- a/pjnath/src/pjnath/turn_sock.c +++ b/pjnath/src/pjnath/turn_sock.c @@ -540,7 +540,7 @@ static unsigned has_packet(pj_turn_sock *turn_sock, const void *buf, pj_size_t b pj_bool_t is_stun; if (turn_sock->conn_type == PJ_TURN_TP_UDP) - return bufsize; + return (unsigned)bufsize; /* Quickly check if this is STUN message, by checking the first two bits and * size field which must be multiple of 4 bytes @@ -550,7 +550,7 @@ static unsigned has_packet(pj_turn_sock *turn_sock, const void *buf, pj_size_t b if (is_stun) { pj_size_t msg_len = GETVAL16H((const pj_uint8_t*)buf, 2); - return (msg_len+20 <= bufsize) ? msg_len+20 : 0; + return (unsigned)((msg_len+20 <= bufsize) ? msg_len+20 : 0); } else { /* This must be ChannelData. */ pj_turn_channel_data cd; -- cgit v1.2.3