diff options
author | Riza Sulistyo <riza@teluu.com> | 2013-06-19 06:47:43 +0000 |
---|---|---|
committer | Riza Sulistyo <riza@teluu.com> | 2013-06-19 06:47:43 +0000 |
commit | d7aa4332dae06ae890053dd13239ddabee46b86c (patch) | |
tree | 34c599b317369bcc33827d5ee1200604a6599164 /pjnath/src/pjnath/stun_msg.c | |
parent | 7949b9e53b97281cfa4526ffe5cf7c7d887b7025 (diff) |
Re #1680: Add initial support for Win64
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4537 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath/src/pjnath/stun_msg.c')
-rw-r--r-- | pjnath/src/pjnath/stun_msg.c | 26 |
1 files changed, 14 insertions, 12 deletions
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; |