From 208776ec0c5c77623637a28b88391067df24e682 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Fri, 11 May 2007 15:14:34 +0000 Subject: HUGE changeset to make the rest of the libraries compile with C++ mode git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1266 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/build/Makefile | 2 +- pjsip/src/pjsip-simple/presence.c | 8 ++--- pjsip/src/pjsip-ua/sip_inv.c | 61 +++++++++++++++++--------------- pjsip/src/pjsip-ua/sip_reg.c | 38 ++++++++++++-------- pjsip/src/pjsip-ua/sip_replaces.c | 8 ++--- pjsip/src/pjsip-ua/sip_xfer.c | 26 +++++++------- pjsip/src/pjsip/sip_endpoint.c | 7 ++-- pjsip/src/pjsip/sip_msg.c | 7 ++-- pjsip/src/pjsip/sip_transport.c | 10 +++--- pjsip/src/pjsip/sip_transport_tls_ossl.c | 25 +++++++------ pjsip/src/pjsua-lib/pjsua_acc.c | 31 +++++++++------- pjsip/src/pjsua-lib/pjsua_call.c | 44 ++++++++++++----------- pjsip/src/pjsua-lib/pjsua_core.c | 29 +++++++++------ pjsip/src/pjsua-lib/pjsua_im.c | 33 +++++++++-------- pjsip/src/pjsua-lib/pjsua_media.c | 17 +++++---- pjsip/src/pjsua-lib/pjsua_pres.c | 24 +++++++------ pjsip/src/test-pjsip/dns_test.c | 2 +- pjsip/src/test-pjsip/msg_test.c | 22 ++++++------ pjsip/src/test-pjsip/transport_test.c | 2 +- pjsip/src/test-pjsip/tsx_bench.c | 12 +++---- pjsip/src/test-pjsip/tsx_uac_test.c | 18 +++++----- pjsip/src/test-pjsip/tsx_uas_test.c | 14 ++++---- pjsip/src/test-pjsip/txdata_test.c | 14 ++++---- pjsip/src/test-pjsip/uri_test.c | 8 ++--- 24 files changed, 251 insertions(+), 211 deletions(-) (limited to 'pjsip') diff --git a/pjsip/build/Makefile b/pjsip/build/Makefile index e9fc2d32..a9b242c0 100644 --- a/pjsip/build/Makefile +++ b/pjsip/build/Makefile @@ -89,7 +89,7 @@ export TEST_OBJS += dlg_core_test.o dns_test.o msg_err_test.o \ tsx_basic_test.o tsx_bench.o tsx_uac_test.o \ tsx_uas_test.o txdata_test.o uri_test.o export TEST_CFLAGS += $(_CFLAGS) -export TEST_LDFLAGS += $(PJ_LDFLAGS) $(PJ_LDLIBS) +export TEST_LDFLAGS += $(PJ_LDFLAGS) $(PJ_LDLIBS) $(LDFLAGS) export TEST_EXE := ../bin/pjsip-test-$(TARGET_NAME)$(HOST_EXE) diff --git a/pjsip/src/pjsip-simple/presence.c b/pjsip/src/pjsip-simple/presence.c index 9f04c64a..dc65637f 100644 --- a/pjsip/src/pjsip-simple/presence.c +++ b/pjsip/src/pjsip-simple/presence.c @@ -57,12 +57,12 @@ static struct pjsip_module mod_presence = /* * Presence message body type. */ -typedef enum content_type +typedef enum content_type_e { CONTENT_TYPE_NONE, CONTENT_TYPE_PIDF, CONTENT_TYPE_XPIDF, -} content_type; +} content_type_e; /* * This structure describe a presentity, for both subscriber and notifier. @@ -71,7 +71,7 @@ struct pjsip_pres { pjsip_evsub *sub; /**< Event subscribtion record. */ pjsip_dialog *dlg; /**< The dialog. */ - content_type content_type; /**< Content-Type. */ + content_type_e content_type; /**< Content-Type. */ pjsip_pres_status status; /**< Presence status. */ pjsip_pres_status tmp_status; /**< Temp, before NOTIFY is answred.*/ pjsip_evsub_user user_cb; /**< The user callback. */ @@ -226,7 +226,7 @@ PJ_DEF(pj_status_t) pjsip_pres_create_uas( pjsip_dialog *dlg, pjsip_event_hdr *event; pjsip_expires_hdr *expires_hdr; unsigned expires; - content_type content_type = CONTENT_TYPE_NONE; + content_type_e content_type = CONTENT_TYPE_NONE; pjsip_evsub *sub; pjsip_pres *pres; pj_status_t status; diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index e08e10d2..44d073b4 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -229,7 +229,7 @@ static pj_bool_t mod_inv_on_rx_request(pjsip_rx_data *rdata) if (dlg == NULL) return PJ_FALSE; - inv = dlg->mod_data[mod_inv.mod.id]; + inv = (pjsip_inv_session*) dlg->mod_data[mod_inv.mod.id]; /* Report to dialog that we handle INVITE, CANCEL, BYE, ACK. * If we need to send response, it will be sent in the state @@ -411,7 +411,7 @@ PJ_DEF(pjsip_module*) pjsip_inv_usage_instance(void) */ PJ_DEF(pjsip_inv_session*) pjsip_dlg_get_inv_session(pjsip_dialog *dlg) { - return dlg->mod_data[mod_inv.mod.id]; + return (pjsip_inv_session*) dlg->mod_data[mod_inv.mod.id]; } @@ -452,7 +452,7 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uac( pjsip_dialog *dlg, options |= PJSIP_INV_SUPPORT_TIMER; /* Create the session */ - inv = pj_pool_zalloc(dlg->pool, sizeof(pjsip_inv_session)); + inv = PJ_POOL_ZALLOC_T(dlg->pool, pjsip_inv_session); pj_assert(inv != NULL); inv->pool = dlg->pool; @@ -577,8 +577,8 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request(pjsip_rx_data *rdata, } /* Parse and validate SDP */ - status = pjmedia_sdp_parse(rdata->tp_info.pool, body->data, body->len, - &sdp); + status = pjmedia_sdp_parse(rdata->tp_info.pool, + (char*)body->data, body->len, &sdp); if (status == PJ_SUCCESS) status = pjmedia_sdp_validate(sdp); @@ -650,7 +650,7 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request(pjsip_rx_data *rdata, * We just assume that peer supports standard INVITE, ACK, CANCEL, and BYE * implicitly by sending this INVITE. */ - allow = pjsip_msg_find_hdr(msg, PJSIP_H_ALLOW, NULL); + allow = (pjsip_allow_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_ALLOW, NULL); if (allow) { unsigned i; const pj_str_t STR_UPDATE = { "UPDATE", 6 }; @@ -668,7 +668,8 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request(pjsip_rx_data *rdata, } /* Check Supported header */ - sup_hdr = pjsip_msg_find_hdr(msg, PJSIP_H_SUPPORTED, NULL); + sup_hdr = (pjsip_supported_hdr*) + pjsip_msg_find_hdr(msg, PJSIP_H_SUPPORTED, NULL); if (sup_hdr) { unsigned i; pj_str_t STR_100REL = { "100rel", 6}; @@ -683,7 +684,8 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request(pjsip_rx_data *rdata, } /* Check Require header */ - req_hdr = pjsip_msg_find_hdr(msg, PJSIP_H_REQUIRE, NULL); + req_hdr = (pjsip_require_hdr*) + pjsip_msg_find_hdr(msg, PJSIP_H_REQUIRE, NULL); if (req_hdr) { unsigned i; const pj_str_t STR_100REL = { "100rel", 6}; @@ -742,7 +744,8 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request(pjsip_rx_data *rdata, NULL); pj_assert(h); if (h) { - sup_hdr = pjsip_hdr_clone(rdata->tp_info.pool, h); + sup_hdr = (pjsip_supported_hdr*) + pjsip_hdr_clone(rdata->tp_info.pool, h); pj_list_push_back(&res_hdr_list, sup_hdr); } } @@ -782,7 +785,8 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request(pjsip_rx_data *rdata, NULL); pj_assert(h); if (h) { - sup_hdr = pjsip_hdr_clone(rdata->tp_info.pool, h); + sup_hdr = (pjsip_supported_hdr*) + pjsip_hdr_clone(rdata->tp_info.pool, h); pj_list_push_back(&res_hdr_list, sup_hdr); } @@ -814,7 +818,7 @@ on_return: while (h != &res_hdr_list) { pjsip_hdr *cloned; - cloned = pjsip_hdr_clone(tdata->pool, h); + cloned = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, h); PJ_ASSERT_RETURN(cloned, PJ_ENOMEM); pjsip_msg_add_hdr(tdata->msg, cloned); @@ -874,7 +878,7 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uas( pjsip_dialog *dlg, options |= PJSIP_INV_SUPPORT_TIMER; /* Create the session */ - inv = pj_pool_zalloc(dlg->pool, sizeof(pjsip_inv_session)); + inv = PJ_POOL_ZALLOC_T(dlg->pool, pjsip_inv_session); pj_assert(inv != NULL); inv->pool = dlg->pool; @@ -893,7 +897,7 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uas( pjsip_dialog *dlg, pjsip_msg_body *body = msg->body; /* Parse and validate SDP */ - status = pjmedia_sdp_parse(inv->pool, body->data, body->len, + status = pjmedia_sdp_parse(inv->pool, (char*)body->data, body->len, &rem_sdp); if (status == PJ_SUCCESS) status = pjmedia_sdp_validate(rem_sdp); @@ -935,8 +939,7 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uas( pjsip_dialog *dlg, inv->invite_tsx = pjsip_rdata_get_tsx(rdata); /* Attach our data to the transaction. */ - tsx_inv_data = pj_pool_zalloc(inv->invite_tsx->pool, - sizeof(struct tsx_inv_data)); + tsx_inv_data = PJ_POOL_ZALLOC_T(inv->invite_tsx->pool, struct tsx_inv_data); tsx_inv_data->inv = inv; inv->invite_tsx->mod_data[mod_inv.mod.id] = tsx_inv_data; @@ -997,12 +1000,12 @@ PJ_DEF(pj_status_t) pjsip_inv_terminate( pjsip_inv_session *inv, static void *clone_sdp(pj_pool_t *pool, const void *data, unsigned len) { PJ_UNUSED_ARG(len); - return pjmedia_sdp_session_clone(pool, data); + return pjmedia_sdp_session_clone(pool, (const pjmedia_sdp_session*)data); } static int print_sdp(pjsip_msg_body *body, char *buf, pj_size_t len) { - return pjmedia_sdp_print(body->data, buf, len); + return pjmedia_sdp_print((const pjmedia_sdp_session*)body->data, buf, len); } @@ -1014,7 +1017,7 @@ PJ_DEF(pj_status_t) pjsip_create_sdp_body( pj_pool_t *pool, const pj_str_t STR_SDP = { "sdp", 3 }; pjsip_msg_body *body; - body = pj_pool_zalloc(pool, sizeof(pjsip_msg_body)); + body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body); PJ_ASSERT_RETURN(body != NULL, PJ_ENOMEM); body->content_type.type = STR_APPLICATION; @@ -1082,7 +1085,7 @@ PJ_DEF(pj_status_t) pjsip_inv_invite( pjsip_inv_session *inv, hdr = inv->dlg->inv_hdr.next; while (hdr != &inv->dlg->inv_hdr) { - pjsip_msg_add_hdr(tdata->msg, + pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*) pjsip_hdr_shallow_clone(tdata->pool, hdr)); hdr = hdr->next; } @@ -1117,14 +1120,14 @@ PJ_DEF(pj_status_t) pjsip_inv_invite( pjsip_inv_session *inv, /* Add Allow header. */ hdr = pjsip_endpt_get_capability(inv->dlg->endpt, PJSIP_H_ALLOW, NULL); if (hdr) { - pjsip_msg_add_hdr(tdata->msg, + pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*) pjsip_hdr_shallow_clone(tdata->pool, hdr)); } /* Add Supported header */ hdr = pjsip_endpt_get_capability(inv->dlg->endpt, PJSIP_H_SUPPORTED, NULL); if (hdr) { - pjsip_msg_add_hdr(tdata->msg, + pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*) pjsip_hdr_shallow_clone(tdata->pool, hdr)); } @@ -1177,9 +1180,9 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv, pjmedia_sdp_session *sdp; /* Get/attach invite session's transaction data */ - tsx_inv_data = tsx->mod_data[mod_inv.mod.id]; + tsx_inv_data = (struct tsx_inv_data*) tsx->mod_data[mod_inv.mod.id]; if (tsx_inv_data == NULL) { - tsx_inv_data = pj_pool_zalloc(tsx->pool, sizeof(struct tsx_inv_data)); + tsx_inv_data = PJ_POOL_ZALLOC_T(tsx->pool, struct tsx_inv_data); tsx_inv_data->inv = inv; tsx->mod_data[mod_inv.mod.id] = tsx_inv_data; } @@ -1207,7 +1210,8 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv, /* Parse the SDP body. */ - status = pjmedia_sdp_parse(rdata->tp_info.pool, msg->body->data, + status = pjmedia_sdp_parse(rdata->tp_info.pool, + (char*)msg->body->data, msg->body->len, &sdp); if (status != PJ_SUCCESS) { char errmsg[PJ_ERR_MSG_SIZE]; @@ -1587,7 +1591,8 @@ PJ_DEF(pj_status_t) pjsip_inv_reinvite( pjsip_inv_session *inv, const pj_str_t STR_CONTACT = { "Contact", 7 }; pj_strdup_with_null(inv->dlg->pool, &tmp, new_contact); - contact_hdr = pjsip_parse_hdr(inv->dlg->pool, &STR_CONTACT, + contact_hdr = (pjsip_contact_hdr*) + pjsip_parse_hdr(inv->dlg->pool, &STR_CONTACT, tmp.ptr, tmp.slen, NULL); if (!contact_hdr) { status = PJSIP_EINVALIDURI; @@ -1684,7 +1689,7 @@ PJ_DEF(pj_status_t) pjsip_inv_send_msg( pjsip_inv_session *inv, pjsip_dlg_inc_lock(inv->dlg); - tsx_inv_data = pj_pool_zalloc(inv->pool, sizeof(struct tsx_inv_data)); + tsx_inv_data = PJ_POOL_ZALLOC_T(inv->pool, struct tsx_inv_data); tsx_inv_data->inv = inv; pjsip_dlg_dec_lock(inv->dlg); @@ -1700,7 +1705,7 @@ PJ_DEF(pj_status_t) pjsip_inv_send_msg( pjsip_inv_session *inv, /* Can only do this to send response to original INVITE * request. */ - PJ_ASSERT_RETURN((cseq=pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL))!=NULL + PJ_ASSERT_RETURN((cseq=(pjsip_cseq_hdr*)pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL))!=NULL && (cseq->cseq == inv->invite_tsx->cseq), PJ_EINVALIDOP); @@ -2415,7 +2420,7 @@ static void inv_on_state_confirmed( pjsip_inv_session *inv, pjsip_event *e) accept = pjsip_endpt_get_capability(dlg->endpt, PJSIP_H_ACCEPT, NULL); if (accept) { - pjsip_msg_add_hdr(tdata->msg, + pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, accept)); } diff --git a/pjsip/src/pjsip-ua/sip_reg.c b/pjsip/src/pjsip-ua/sip_reg.c index e77273ad..dc15fefc 100644 --- a/pjsip/src/pjsip-ua/sip_reg.c +++ b/pjsip/src/pjsip-ua/sip_reg.c @@ -103,13 +103,13 @@ PJ_DEF(pj_status_t) pjsip_regc_create( pjsip_endpoint *endpt, void *token, pool = pjsip_endpt_create_pool(endpt, "regc%p", 1024, 1024); PJ_ASSERT_RETURN(pool != NULL, PJ_ENOMEM); - regc = pj_pool_zalloc(pool, sizeof(struct pjsip_regc)); + regc = PJ_POOL_ZALLOC_T(pool, pjsip_regc); regc->pool = pool; regc->endpt = endpt; regc->token = token; regc->cb = cb; - regc->contact_buf = pj_pool_alloc(pool, PJSIP_REGC_CONTACT_BUF_SIZE); + regc->contact_buf = (char*)pj_pool_alloc(pool, PJSIP_REGC_CONTACT_BUF_SIZE); regc->expires = PJSIP_REGC_EXPIRATION_NOT_SPECIFIED; status = pjsip_auth_clt_init(®c->auth_sess, endpt, regc->pool, 0); @@ -386,13 +386,15 @@ static pj_status_t create_request(pjsip_regc *regc, pjsip_hdr *route_pos; const pjsip_route_hdr *route; - route_pos = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); + route_pos = (pjsip_hdr*) + pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); if (!route_pos) route_pos = &tdata->msg->hdr; route = regc->route_set.next; while (route != ®c->route_set) { - pjsip_hdr *new_hdr = pjsip_hdr_shallow_clone(tdata->pool, route); + pjsip_hdr *new_hdr = (pjsip_hdr*) + pjsip_hdr_shallow_clone(tdata->pool, route); pj_list_insert_after(route_pos, new_hdr); route_pos = new_hdr; route = route->next; @@ -405,7 +407,8 @@ static pj_status_t create_request(pjsip_regc *regc, hdr = regc->hdr_list.next; while (hdr != ®c->hdr_list) { - pjsip_hdr *new_hdr = pjsip_hdr_shallow_clone(tdata->pool, hdr); + pjsip_hdr *new_hdr = (pjsip_hdr*) + pjsip_hdr_shallow_clone(tdata->pool, hdr); pjsip_msg_add_hdr(tdata->msg, new_hdr); hdr = hdr->next; } @@ -432,10 +435,12 @@ PJ_DEF(pj_status_t) pjsip_regc_register(pjsip_regc *regc, pj_bool_t autoreg, /* Add Contact header. */ msg = tdata->msg; - pjsip_msg_add_hdr(msg, pjsip_hdr_shallow_clone(tdata->pool, + pjsip_msg_add_hdr(msg, (pjsip_hdr*) + pjsip_hdr_shallow_clone(tdata->pool, regc->contact_hdr)); if (regc->expires_hdr) - pjsip_msg_add_hdr(msg, pjsip_hdr_shallow_clone(tdata->pool, + pjsip_msg_add_hdr(msg, (pjsip_hdr*) + pjsip_hdr_shallow_clone(tdata->pool, regc->expires_hdr)); if (regc->timer.id != 0) { @@ -470,7 +475,8 @@ PJ_DEF(pj_status_t) pjsip_regc_unregister(pjsip_regc *regc, return status; msg = tdata->msg; - pjsip_msg_add_hdr(msg, pjsip_hdr_shallow_clone(tdata->pool, + pjsip_msg_add_hdr(msg, (pjsip_hdr*) + pjsip_hdr_shallow_clone(tdata->pool, regc->contact_hdr)); pjsip_msg_add_hdr( msg, (pjsip_hdr*)regc->unreg_expires_hdr); @@ -553,7 +559,7 @@ static void call_callback(pjsip_regc *regc, pj_status_t status, int st_code, static void regc_refresh_timer_cb( pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry) { - pjsip_regc *regc = entry->user_data; + pjsip_regc *regc = (pjsip_regc*) entry->user_data; pjsip_tx_data *tdata; pj_status_t status; @@ -587,7 +593,7 @@ static void regc_refresh_timer_cb( pj_timer_heap_t *timer_heap, static void tsx_callback(void *token, pjsip_event *event) { pj_status_t status; - pjsip_regc *regc = token; + pjsip_regc *regc = (pjsip_regc*) token; pjsip_transaction *tsx = event->body.tsx_state.tsx; /* Decrement pending transaction counter. */ @@ -653,16 +659,19 @@ static void tsx_callback(void *token, pjsip_event *event) rdata = event->body.tsx_state.src.rdata; msg = rdata->msg_info.msg; - hdr = pjsip_msg_find_hdr( msg, PJSIP_H_CONTACT, NULL); + hdr = (pjsip_contact_hdr*) + pjsip_msg_find_hdr( msg, PJSIP_H_CONTACT, NULL); while (hdr) { contact[contact_cnt++] = hdr; hdr = hdr->next; if (hdr == (void*)&msg->hdr) break; - hdr = pjsip_msg_find_hdr(msg, PJSIP_H_CONTACT, hdr); + hdr = (pjsip_contact_hdr*) + pjsip_msg_find_hdr(msg, PJSIP_H_CONTACT, hdr); } - expires = pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES, NULL); + expires = (pjsip_expires_hdr*) + pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES, NULL); if (expires) expiration = expires->ivalue; @@ -740,7 +749,8 @@ PJ_DEF(pj_status_t) pjsip_regc_send(pjsip_regc *regc, pjsip_tx_data *tdata) /* Increment CSeq */ cseq = ++regc->cseq_hdr->cseq; - cseq_hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL); + cseq_hdr = (pjsip_cseq_hdr*) + pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL); cseq_hdr->cseq = cseq; /* Increment pending transaction first, since transaction callback diff --git a/pjsip/src/pjsip-ua/sip_replaces.c b/pjsip/src/pjsip-ua/sip_replaces.c index 545c4267..284c2828 100644 --- a/pjsip/src/pjsip-ua/sip_replaces.c +++ b/pjsip/src/pjsip-ua/sip_replaces.c @@ -52,7 +52,7 @@ static pjsip_endpoint *the_endpt; PJ_DEF(pjsip_replaces_hdr*) pjsip_replaces_hdr_create(pj_pool_t *pool) { - pjsip_replaces_hdr *hdr = pj_pool_zalloc(pool, sizeof(*hdr)); + pjsip_replaces_hdr *hdr = PJ_POOL_ZALLOC_T(pool, pjsip_replaces_hdr); hdr->type = PJSIP_H_OTHER; hdr->name.ptr = "Replaces"; hdr->name.slen = 8; @@ -108,7 +108,7 @@ static pjsip_replaces_hdr* replaces_hdr_shallow_clone( pj_pool_t *pool, const pjsip_replaces_hdr *rhs ) { - pjsip_replaces_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_replaces_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_replaces_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); return hdr; @@ -144,7 +144,7 @@ static pjsip_hdr *parse_hdr_replaces(pjsip_parse_ctx *ctx) } else if (pj_stricmp(&pname, &early_only_tag)==0) { hdr->early_only = PJ_TRUE; } else { - pjsip_param *param = pj_pool_alloc(ctx->pool, sizeof(pjsip_param)); + pjsip_param *param = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param); param->name = pname; param->value = pvalue; pj_list_push_back(&hdr->other_param, param); @@ -318,7 +318,7 @@ on_return: while (h != &res_hdr_list) { pjsip_hdr *cloned; - cloned = pjsip_hdr_clone(tdata->pool, h); + cloned = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, h); PJ_ASSERT_RETURN(cloned, PJ_ENOMEM); pjsip_msg_add_hdr(tdata->msg, cloned); diff --git a/pjsip/src/pjsip-ua/sip_xfer.c b/pjsip/src/pjsip-ua/sip_xfer.c index f772f78d..a4c46629 100644 --- a/pjsip/src/pjsip-ua/sip_xfer.c +++ b/pjsip/src/pjsip-ua/sip_xfer.c @@ -179,7 +179,7 @@ PJ_DEF(pj_status_t) pjsip_xfer_create_uac( pjsip_dialog *dlg, goto on_return; /* Create xfer session */ - xfer = pj_pool_zalloc(dlg->pool, sizeof(pjsip_xfer)); + xfer = PJ_POOL_ZALLOC_T(dlg->pool, pjsip_xfer); xfer->dlg = dlg; xfer->sub = sub; if (user_cb) @@ -248,7 +248,7 @@ PJ_DEF(pj_status_t) pjsip_xfer_create_uas( pjsip_dialog *dlg, goto on_return; /* Create server xfer subscription */ - xfer = pj_pool_zalloc(dlg->pool, sizeof(pjsip_xfer)); + xfer = PJ_POOL_ZALLOC_T(dlg->pool, pjsip_xfer); xfer->dlg = dlg; xfer->sub = sub; if (user_cb) @@ -286,7 +286,7 @@ PJ_DEF(pj_status_t) pjsip_xfer_initiate( pjsip_evsub *sub, /* Get the xfer object. */ - xfer = pjsip_evsub_get_mod_data(sub, mod_xfer.id); + xfer = (pjsip_xfer*) pjsip_evsub_get_mod_data(sub, mod_xfer.id); PJ_ASSERT_RETURN(xfer != NULL, PJSIP_ENOREFERSESSION); /* refer_to_uri argument MAY be NULL for subsequent REFER requests, @@ -373,7 +373,7 @@ PJ_DEF(pj_status_t) pjsip_xfer_notify( pjsip_evsub *sub, PJ_ASSERT_RETURN(sub, PJ_EINVAL); /* Get the xfer object. */ - xfer = pjsip_evsub_get_mod_data(sub, mod_xfer.id); + xfer = (pjsip_xfer*) pjsip_evsub_get_mod_data(sub, mod_xfer.id); PJ_ASSERT_RETURN(xfer != NULL, PJSIP_ENOREFERSESSION); @@ -398,7 +398,7 @@ PJ_DEF(pj_status_t) pjsip_xfer_notify( pjsip_evsub *sub, pj_strdup(xfer->dlg->pool, &xfer->last_st_text, xfer_st_text); /* Create sipfrag content. */ - body = pj_pool_alloc(tdata->pool, 128); + body = (char*) pj_pool_alloc(tdata->pool, 128); bodylen = pj_ansi_snprintf(body, 128, "SIP/2.0 %u %.*s", xfer_st_code, (int)xfer_st_text->slen, @@ -409,7 +409,7 @@ PJ_DEF(pj_status_t) pjsip_xfer_notify( pjsip_evsub *sub, /* Create SIP message body. */ - msg_body = pj_pool_zalloc(tdata->pool, sizeof(pjsip_msg_body)); + msg_body = PJ_POOL_ZALLOC_T(tdata->pool, pjsip_msg_body); msg_body->content_type.type = STR_MESSAGE; msg_body->content_type.subtype = STR_SIPFRAG; msg_body->content_type.param = STR_SIPFRAG_VERSION; @@ -447,7 +447,7 @@ PJ_DEF(pj_status_t) pjsip_xfer_current_notify( pjsip_evsub *sub, PJ_ASSERT_RETURN(sub, PJ_EINVAL); /* Get the xfer object. */ - xfer = pjsip_evsub_get_mod_data(sub, mod_xfer.id); + xfer = (pjsip_xfer*) pjsip_evsub_get_mod_data(sub, mod_xfer.id); PJ_ASSERT_RETURN(xfer != NULL, PJSIP_ENOREFERSESSION); pjsip_dlg_inc_lock(xfer->dlg); @@ -480,7 +480,7 @@ static void xfer_on_evsub_state( pjsip_evsub *sub, pjsip_event *event) { pjsip_xfer *xfer; - xfer = pjsip_evsub_get_mod_data(sub, mod_xfer.id); + xfer = (pjsip_xfer*) pjsip_evsub_get_mod_data(sub, mod_xfer.id); PJ_ASSERT_ON_FAIL(xfer!=NULL, {return;}); if (xfer->user_cb.on_evsub_state) @@ -496,7 +496,7 @@ static void xfer_on_evsub_tsx_state( pjsip_evsub *sub, pjsip_transaction *tsx, { pjsip_xfer *xfer; - xfer = pjsip_evsub_get_mod_data(sub, mod_xfer.id); + xfer = (pjsip_xfer*) pjsip_evsub_get_mod_data(sub, mod_xfer.id); PJ_ASSERT_ON_FAIL(xfer!=NULL, {return;}); if (xfer->user_cb.on_tsx_state) @@ -515,7 +515,7 @@ static void xfer_on_evsub_rx_refresh( pjsip_evsub *sub, { pjsip_xfer *xfer; - xfer = pjsip_evsub_get_mod_data(sub, mod_xfer.id); + xfer = (pjsip_xfer*) pjsip_evsub_get_mod_data(sub, mod_xfer.id); PJ_ASSERT_ON_FAIL(xfer!=NULL, {return;}); if (xfer->user_cb.on_rx_refresh) { @@ -556,7 +556,7 @@ static void xfer_on_evsub_rx_notify( pjsip_evsub *sub, { pjsip_xfer *xfer; - xfer = pjsip_evsub_get_mod_data(sub, mod_xfer.id); + xfer = (pjsip_xfer*) pjsip_evsub_get_mod_data(sub, mod_xfer.id); PJ_ASSERT_ON_FAIL(xfer!=NULL, {return;}); if (xfer->user_cb.on_rx_notify) @@ -571,7 +571,7 @@ static void xfer_on_evsub_client_refresh(pjsip_evsub *sub) { pjsip_xfer *xfer; - xfer = pjsip_evsub_get_mod_data(sub, mod_xfer.id); + xfer = (pjsip_xfer*) pjsip_evsub_get_mod_data(sub, mod_xfer.id); PJ_ASSERT_ON_FAIL(xfer!=NULL, {return;}); if (xfer->user_cb.on_client_refresh) { @@ -594,7 +594,7 @@ static void xfer_on_evsub_server_timeout(pjsip_evsub *sub) { pjsip_xfer *xfer; - xfer = pjsip_evsub_get_mod_data(sub, mod_xfer.id); + xfer = (pjsip_xfer*) pjsip_evsub_get_mod_data(sub, mod_xfer.id); PJ_ASSERT_ON_FAIL(xfer!=NULL, {return;}); if (xfer->user_cb.on_server_timeout) { diff --git a/pjsip/src/pjsip/sip_endpoint.c b/pjsip/src/pjsip/sip_endpoint.c index add8ad3e..81582094 100644 --- a/pjsip/src/pjsip/sip_endpoint.c +++ b/pjsip/src/pjsip/sip_endpoint.c @@ -167,7 +167,7 @@ PJ_DEF(pj_status_t) pjsip_endpt_register_module( pjsip_endpoint *endpt, { pj_status_t status = PJ_SUCCESS; pjsip_module *m; - int i; + unsigned i; pj_rwmutex_lock_write(endpt->mod_mutex); @@ -247,7 +247,8 @@ PJ_DEF(pj_status_t) pjsip_endpt_unregister_module( pjsip_endpoint *endpt, {status = PJ_ENOTFOUND;goto on_return;} ); /* Make sure the module exists in the array. */ - PJ_ASSERT_ON_FAIL( mod->id>=0 && mod->idmodules) && + PJ_ASSERT_ON_FAIL( mod->id>=0 && + mod->id<(int)PJ_ARRAY_SIZE(endpt->modules) && endpt->modules[mod->id] == mod, {status = PJ_ENOTFOUND; goto on_return;}); @@ -1079,7 +1080,7 @@ PJ_DEF(void) pjsip_endpt_log_error( pjsip_endpoint *endpt, PJ_UNUSED_ARG(endpt); len = pj_ansi_strlen(format); - if (len < sizeof(newformat)-30) { + if (len < (int)sizeof(newformat)-30) { pj_str_t errstr; pj_ansi_strcpy(newformat, format); diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c index f94cd315..c00fde54 100644 --- a/pjsip/src/pjsip/sip_msg.c +++ b/pjsip/src/pjsip/sip_msg.c @@ -97,7 +97,7 @@ static int print_media_type(char *buf, const pjsip_media_type *media); static int init_status_phrase() { - int i; + unsigned i; pj_str_t default_reason_phrase = { "Default status message", 22}; for (i=0; iptr, method_names[i]->ptr, str->slen)==0 || pj_stricmp(str, method_names[i])==0) @@ -515,7 +515,8 @@ PJ_DEF(const pj_str_t*) pjsip_get_status_text(int code) init_status_phrase(); } - return (code>=100 && code<(sizeof(status_phrase)/sizeof(status_phrase[0]))) ? + return (code>=100 && + code<(int)(sizeof(status_phrase)/sizeof(status_phrase[0]))) ? &status_phrase[code] : &status_phrase[0]; } diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c index afe0f1e4..91ac4343 100644 --- a/pjsip/src/pjsip/sip_transport.c +++ b/pjsip/src/pjsip/sip_transport.c @@ -97,7 +97,7 @@ struct transport_key /* * Transport names. */ -struct +struct transport_names_t { pjsip_transport_type_e type; pj_uint16_t port; @@ -216,7 +216,7 @@ pjsip_transport_get_flag_from_type( pjsip_transport_type_e type ) PJSIP_TRANSPORT_UDP, 0); /* Check that argument is valid. */ - PJ_ASSERT_RETURN(type < PJ_ARRAY_SIZE(transport_names), 0); + PJ_ASSERT_RETURN((unsigned)type < PJ_ARRAY_SIZE(transport_names), 0); /* Return transport flag. */ return transport_names[type].flag; @@ -235,7 +235,7 @@ pjsip_transport_get_default_port_for_type(pjsip_transport_type_e type) PJSIP_TRANSPORT_UDP, 0); /* Check that argument is valid. */ - PJ_ASSERT_RETURN(type < PJ_ARRAY_SIZE(transport_names), 5060); + PJ_ASSERT_RETURN((unsigned)type < PJ_ARRAY_SIZE(transport_names), 5060); /* Return the port. */ return transport_names[type].port; @@ -253,7 +253,7 @@ PJ_DEF(const char*) pjsip_transport_get_type_name(pjsip_transport_type_e type) PJSIP_TRANSPORT_UDP, "Unknown"); /* Check that argument is valid. */ - PJ_ASSERT_RETURN(type < PJ_ARRAY_SIZE(transport_names), "Unknown"); + PJ_ASSERT_RETURN((unsigned)typecseq, obj_name); } - if (len < 1 || len >= sizeof(info_buf)) { + if (len < 1 || len >= (int)sizeof(info_buf)) { return (char*)obj_name; } diff --git a/pjsip/src/pjsip/sip_transport_tls_ossl.c b/pjsip/src/pjsip/sip_transport_tls_ossl.c index e7a91c52..89537c1f 100644 --- a/pjsip/src/pjsip/sip_transport_tls_ossl.c +++ b/pjsip/src/pjsip/sip_transport_tls_ossl.c @@ -259,7 +259,7 @@ static void sockaddr_to_host_port( pj_pool_t *pool, const pj_sockaddr_in *addr ) { enum { M = 48 }; - host_port->host.ptr = pj_pool_alloc(pool, M); + host_port->host.ptr = (char*)pj_pool_alloc(pool, M); host_port->host.slen = pj_ansi_snprintf( host_port->host.ptr, M, "%s", pj_inet_ntoa(addr->sin_addr)); host_port->port = pj_ntohs(addr->sin_port); @@ -269,7 +269,7 @@ static void sockaddr_to_host_port( pj_pool_t *pool, /* SSL password callback. */ static int password_cb(char *buf, int num, int rwflag, void *user_data) { - struct tls_listener *lis = user_data; + struct tls_listener *lis = (struct tls_listener*) user_data; PJ_UNUSED_ARG(rwflag); @@ -904,7 +904,7 @@ PJ_DEF(pj_status_t) pjsip_tls_transport_start( pjsip_endpoint *endpt, PJ_ASSERT_RETURN(pool, PJ_ENOMEM); - listener = pj_pool_zalloc(pool, sizeof(struct tls_listener)); + listener = PJ_POOL_ZALLOC_T(pool, struct tls_listener); listener->factory.pool = pool; listener->factory.type = PJSIP_TRANSPORT_TLS; listener->factory.type_name = "tls"; @@ -1036,8 +1036,7 @@ PJ_DEF(pj_status_t) pjsip_tls_transport_start( pjsip_endpoint *endpt, goto on_error; } - listener->accept_op[i] = pj_pool_zalloc(pool, - sizeof(struct pending_accept)); + listener->accept_op[i] = PJ_POOL_ZALLOC_T(pool, struct pending_accept); pj_ioqueue_op_key_init(&listener->accept_op[i]->op_key, sizeof(listener->accept_op[i]->op_key)); listener->accept_op[i]->pool = pool; @@ -1191,7 +1190,7 @@ static pj_status_t tls_create( struct tls_listener *listener, /* * Create and initialize basic transport structure. */ - tls = pj_pool_zalloc(pool, sizeof(*tls)); + tls = PJ_POOL_ZALLOC_T(pool, struct tls_transport); tls->sock = sock; tls->is_server = is_server; tls->listener = listener; @@ -1217,7 +1216,7 @@ static pj_status_t tls_create( struct tls_listener *listener, tls->base.type_name = "tls"; tls->base.flag = pjsip_transport_get_flag_from_type(PJSIP_TRANSPORT_TLS); - tls->base.info = pj_pool_alloc(pool, 64); + tls->base.info = (char*) pj_pool_alloc(pool, 64); pj_ansi_snprintf(tls->base.info, 64, "TLS to %s:%d", pj_inet_ntoa(remote->sin_addr), (int)pj_ntohs(remote->sin_port)); @@ -1635,7 +1634,7 @@ static void on_accept_complete( pj_ioqueue_key_t *key, struct pending_accept *accept_op; int err_cnt = 0; - listener = pj_ioqueue_get_user_data(key); + listener = (struct tls_listener*) pj_ioqueue_get_user_data(key); accept_op = (struct pending_accept*) op_key; /* @@ -1694,7 +1693,7 @@ static void on_accept_complete( pj_ioqueue_key_t *key, /* Create new accept_opt */ pool = pjsip_endpt_create_pool(listener->endpt, "tlss%p", POOL_TP_INIT, POOL_TP_INC); - new_op = pj_pool_zalloc(pool, sizeof(struct pending_accept)); + new_op = PJ_POOL_ZALLOC_T(pool, struct pending_accept); new_op->pool = pool; new_op->listener = listener; new_op->index = accept_op->index; @@ -1756,9 +1755,10 @@ static void on_write_complete(pj_ioqueue_key_t *key, pj_ioqueue_op_key_t *op_key, pj_ssize_t bytes_sent) { - struct tls_transport *tls = pj_ioqueue_get_user_data(key); + struct tls_transport *tls; pjsip_tx_data_op_key *tdata_op_key = (pjsip_tx_data_op_key*)op_key; + tls = (struct tls_transport*) pj_ioqueue_get_user_data(key); tdata_op_key->tdata = NULL; /* Check for error/closure */ @@ -1789,8 +1789,7 @@ static void add_pending_tx(struct tls_transport *tls, { struct delayed_tdata *delayed_tdata; - delayed_tdata = pj_pool_alloc(tdata->pool, - sizeof(*delayed_tdata)); + delayed_tdata = PJ_POOL_ALLOC_T(tdata->pool, struct delayed_tdata); delayed_tdata->tdata_op_key = &tdata->op_key; pj_list_push_back(&tls->delayed_list, delayed_tdata); } @@ -2097,7 +2096,7 @@ static void on_connect_complete(pj_ioqueue_key_t *key, pj_sockaddr_in addr; int addrlen; - tls = pj_ioqueue_get_user_data(key); + tls = (struct tls_transport*) pj_ioqueue_get_user_data(key); /* Check connect() status */ if (status != PJ_SUCCESS) { diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 01be07f7..830b6ae2 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -37,7 +37,7 @@ PJ_DEF(unsigned) pjsua_acc_get_count(void) */ PJ_DEF(pj_bool_t) pjsua_acc_is_valid(pjsua_acc_id acc_id) { - return acc_id>=0 && acc_id=0 && acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc) && pjsua_var.acc[acc_id].valid; } @@ -185,7 +185,8 @@ static pj_status_t initialize_acc(unsigned acc_id) pj_strdup_with_null(pjsua_var.pool, &tmp, &pjsua_var.ua_cfg.outbound_proxy[i]); - r = pjsip_parse_hdr(pjsua_var.pool, &hname, tmp.ptr, tmp.slen, NULL); + r = (pjsip_route_hdr*) + pjsip_parse_hdr(pjsua_var.pool, &hname, tmp.ptr, tmp.slen, NULL); if (r == NULL) { pjsua_perror(THIS_FILE, "Invalid outbound proxy URI", PJSIP_EINVALIDURI); @@ -200,7 +201,8 @@ static pj_status_t initialize_acc(unsigned acc_id) pj_str_t tmp; pj_strdup_with_null(pjsua_var.pool, &tmp, &acc_cfg->proxy[i]); - r = pjsip_parse_hdr(pjsua_var.pool, &hname, tmp.ptr, tmp.slen, NULL); + r = (pjsip_route_hdr*) + pjsip_parse_hdr(pjsua_var.pool, &hname, tmp.ptr, tmp.slen, NULL); if (r == NULL) { pjsua_perror(THIS_FILE, "Invalid URI in account route set", PJ_EINVAL); @@ -322,7 +324,8 @@ PJ_DEF(pj_status_t) pjsua_acc_add_local( pjsua_transport_id tid, char uri[PJSIP_MAX_URL_SIZE]; /* ID must be valid */ - PJ_ASSERT_RETURN(tid>=0 && tid=0 && tid<(int)PJ_ARRAY_SIZE(pjsua_var.tpdata), + PJ_EINVAL); /* Transport must be valid */ PJ_ASSERT_RETURN(t->data.ptr != NULL, PJ_EINVAL); @@ -433,7 +436,7 @@ PJ_DEF(pj_status_t) pjsua_acc_set_online_status( pjsua_acc_id acc_id, static void regc_cb(struct pjsip_regc_cbparam *param) { - pjsua_acc *acc = param->token; + pjsua_acc *acc = (pjsua_acc*) param->token; PJSUA_LOCK(); @@ -816,7 +819,7 @@ PJ_DEF(pjsua_acc_id) pjsua_acc_find_for_outgoing(const pj_str_t *url) return pjsua_var.default_acc; } - sip_uri = pjsip_uri_get_uri(uri); + sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri(uri); /* Find matching domain AND port */ for (i=0; iroute_set.next; while (r != &acc->route_set) { - pjsip_msg_add_hdr(tdata->msg, pjsip_hdr_clone(tdata->pool, r)); + pjsip_msg_add_hdr(tdata->msg, + (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, r)); r = r->next; } @@ -1036,7 +1040,7 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uac_contact( pj_pool_t *pool, return status; /* Create the contact header */ - contact->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); + contact->ptr = (char*)pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE, "%.*s%s<%s:%.*s%s%.*s:%d;transport=%s>", (int)acc->display.slen, @@ -1097,17 +1101,18 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool, pjsip_uri *uri = NULL; /* Otherwise URI is Contact URI */ - h_contact = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, + h_contact = (pjsip_contact_hdr*) + pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL); if (h_contact) - uri = pjsip_uri_get_uri(h_contact->uri); + uri = (pjsip_uri*) pjsip_uri_get_uri(h_contact->uri); /* Or if Contact URI is not present, take the remote URI from * the From URI. */ if (uri == NULL) - uri = pjsip_uri_get_uri(rdata->msg_info.from->uri); + uri = (pjsip_uri*) pjsip_uri_get_uri(rdata->msg_info.from->uri); /* Can only do sip/sips scheme at present. */ @@ -1142,7 +1147,7 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool, return status; /* Create the contact header */ - contact->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); + contact->ptr = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE, "%.*s%s<%s:%.*s%s%.*s:%d;transport=%s>", (int)acc->display.slen, @@ -1169,7 +1174,7 @@ PJ_DEF(pj_status_t) pjsua_acc_set_transport( pjsua_acc_id acc_id, PJ_ASSERT_RETURN(pjsua_acc_is_valid(acc_id), PJ_EINVAL); acc = &pjsua_var.acc[acc_id]; - PJ_ASSERT_RETURN(tp_id >= 0 && tp_id < PJ_ARRAY_SIZE(pjsua_var.tpdata), + PJ_ASSERT_RETURN(tp_id >= 0 && tp_id < (int)PJ_ARRAY_SIZE(pjsua_var.tpdata), PJ_EINVAL); acc->cfg.transport_id = tp_id; diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c index 0f4f470b..e1b6d278 100644 --- a/pjsip/src/pjsua-lib/pjsua_call.c +++ b/pjsip/src/pjsua-lib/pjsua_call.c @@ -203,14 +203,14 @@ PJ_DEF(pj_status_t) pjsua_call_make_call( pjsua_acc_id acc_id, pjsip_inv_session *inv = NULL; pjsua_acc *acc; pjsua_call *call; - unsigned call_id; + int call_id = -1; pj_str_t contact; pjsip_tx_data *tdata; pj_status_t status; /* Check that account is valid */ - PJ_ASSERT_RETURN(acc_id>=0 || acc_id=0 || acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc), PJ_EINVAL); /* Options must be zero for now */ @@ -230,12 +230,12 @@ PJ_DEF(pj_status_t) pjsua_call_make_call( pjsua_acc_id acc_id, } /* Find free call slot. */ - for (call_id=0; call_idmod_data[pjsua_var.mod.id]; + replaced_call = (pjsua_call*) replaced_dlg->mod_data[pjsua_var.mod.id]; /* Notify application */ pjsua_var.ua_cfg.cb.on_call_replace_request(replaced_call->index, @@ -690,7 +690,7 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata) replaced_inv = pjsip_dlg_get_inv_session(replaced_dlg); /* Get the replaced call instance */ - replaced_call = replaced_dlg->mod_data[pjsua_var.mod.id]; + replaced_call = (pjsua_call*) replaced_dlg->mod_data[pjsua_var.mod.id]; /* Notify application */ if (pjsua_var.ua_cfg.cb.on_call_replaced) @@ -1377,13 +1377,13 @@ PJ_DEF(pj_status_t) pjsua_call_xfer_replaces( pjsua_call_id call_id, dest_dlg->call_id->id.slen + dest_dlg->remote.info->tag.slen + dest_dlg->local.info->tag.slen + 32 - < sizeof(str_dest_buf), PJSIP_EURITOOLONG); + < (long)sizeof(str_dest_buf), PJSIP_EURITOOLONG); /* Print URI */ str_dest_buf[0] = '<'; str_dest.slen = 1; - uri = pjsip_uri_get_uri(dest_dlg->remote.info->uri); + uri = (pjsip_uri*) pjsip_uri_get_uri(dest_dlg->remote.info->uri); len = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, uri, str_dest_buf+1, sizeof(str_dest_buf)-1); if (len < 0) @@ -1509,7 +1509,7 @@ PJ_DEF(pj_status_t) pjsua_call_send_im( pjsua_call_id call_id, pjsua_process_msg_data( tdata, msg_data); /* Create IM data and attach to the request. */ - im_data = pj_pool_zalloc(tdata->pool, sizeof(*im_data)); + im_data = PJ_POOL_ZALLOC_T(tdata->pool, pjsua_im_data); im_data->acc_id = call->acc_id; im_data->call_id = call_id; im_data->to = call->inv->dlg->remote.info_str; @@ -1934,7 +1934,7 @@ static void pjsua_call_on_state_changed(pjsip_inv_session *inv, PJSUA_LOCK(); - call = inv->dlg->mod_data[pjsua_var.mod.id]; + call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; if (!call) { PJSUA_UNLOCK(); @@ -2104,7 +2104,7 @@ static void pjsua_call_on_media_update(pjsip_inv_session *inv, PJSUA_LOCK(); - call = inv->dlg->mod_data[pjsua_var.mod.id]; + call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; if (status != PJ_SUCCESS) { @@ -2231,7 +2231,7 @@ static void pjsua_call_on_rx_offer(pjsip_inv_session *inv, PJSUA_LOCK(); - call = inv->dlg->mod_data[pjsua_var.mod.id]; + call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; /* * See if remote is offering active media (i.e. not on-hold) @@ -2314,7 +2314,7 @@ static void xfer_client_on_evsub_state( pjsip_evsub *sub, pjsip_event *event) const pj_str_t REFER_SUB = { "Refer-Sub", 9 }; pjsua_call *call; - call = pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); + call = (pjsua_call*) pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); /* Must be receipt of response message */ pj_assert(event->type == PJSIP_EVENT_TSX_STATE && @@ -2377,7 +2377,7 @@ static void xfer_client_on_evsub_state( pjsip_evsub *sub, pjsip_event *event) pj_bool_t cont; pj_status_t status; - call = pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); + call = (pjsua_call*) pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); /* When subscription is terminated, clear the xfer_sub member of * the inv_data. @@ -2421,7 +2421,7 @@ static void xfer_client_on_evsub_state( pjsip_evsub *sub, pjsip_event *event) } /* Try to parse the content */ - status = pjsip_parse_status_line(body->data, body->len, + status = pjsip_parse_status_line((char*)body->data, body->len, &status_line); if (status != PJ_SUCCESS) { PJ_LOG(4,(THIS_FILE, @@ -2466,7 +2466,7 @@ static void xfer_server_on_evsub_state( pjsip_evsub *sub, pjsip_event *event) if (pjsip_evsub_get_state(sub) == PJSIP_EVSUB_STATE_TERMINATED) { pjsua_call *call; - call = pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); + call = (pjsua_call*) pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); if (!call) return; @@ -2501,7 +2501,7 @@ static void on_call_transfered( pjsip_inv_session *inv, pjsip_status_code code; pjsip_evsub *sub; - existing_call = inv->dlg->mod_data[pjsua_var.mod.id]; + existing_call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; /* Find the Refer-To header */ refer_to = (pjsip_generic_string_hdr*) @@ -2528,7 +2528,8 @@ static void on_call_transfered( pjsip_inv_session *inv, /* Find optional Referred-By header (to be copied onto outgoing INVITE * request. */ - ref_by_hdr = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_ref_by, + ref_by_hdr = (pjsip_hdr*) + pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_ref_by, NULL); /* Notify callback */ @@ -2655,7 +2656,8 @@ static void on_call_transfered( pjsip_inv_session *inv, * to the outgoing INVITE request. */ if (ref_by_hdr != NULL) { - pjsip_hdr *dup = pjsip_hdr_clone(rdata->tp_info.pool, ref_by_hdr); + pjsip_hdr *dup = (pjsip_hdr*) + pjsip_hdr_clone(rdata->tp_info.pool, ref_by_hdr); pj_list_push_back(&msg_data.hdr_list, dup); } @@ -2710,7 +2712,7 @@ static void pjsua_call_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e) { - pjsua_call *call = inv->dlg->mod_data[pjsua_var.mod.id]; + pjsua_call *call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; PJSUA_LOCK(); @@ -2772,7 +2774,7 @@ static void pjsua_call_on_tsx_state_changed(pjsip_inv_session *inv, if (tsx->status_code >= 200) { pjsua_im_data *im_data; - im_data = tsx->mod_data[pjsua_var.mod.id]; + im_data = (pjsua_im_data*) tsx->mod_data[pjsua_var.mod.id]; /* im_data can be NULL if this is typing indication */ if (im_data && pjsua_var.ua_cfg.cb.on_pager_status) { diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c index 162d2da9..7452343c 100644 --- a/pjsip/src/pjsua-lib/pjsua_core.c +++ b/pjsip/src/pjsua-lib/pjsua_core.c @@ -164,25 +164,29 @@ static pj_bool_t options_on_rx_request(pjsip_rx_data *rdata) /* Add Allow header */ cap_hdr = pjsip_endpt_get_capability(pjsua_var.endpt, PJSIP_H_ALLOW, NULL); if (cap_hdr) { - pjsip_msg_add_hdr(tdata->msg, pjsip_hdr_clone(tdata->pool, cap_hdr)); + pjsip_msg_add_hdr(tdata->msg, + (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, cap_hdr)); } /* Add Accept header */ cap_hdr = pjsip_endpt_get_capability(pjsua_var.endpt, PJSIP_H_ACCEPT, NULL); if (cap_hdr) { - pjsip_msg_add_hdr(tdata->msg, pjsip_hdr_clone(tdata->pool, cap_hdr)); + pjsip_msg_add_hdr(tdata->msg, + (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, cap_hdr)); } /* Add Supported header */ cap_hdr = pjsip_endpt_get_capability(pjsua_var.endpt, PJSIP_H_SUPPORTED, NULL); if (cap_hdr) { - pjsip_msg_add_hdr(tdata->msg, pjsip_hdr_clone(tdata->pool, cap_hdr)); + pjsip_msg_add_hdr(tdata->msg, + (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, cap_hdr)); } /* Add Allow-Events header from the evsub module */ cap_hdr = pjsip_evsub_get_allow_events_hdr(NULL); if (cap_hdr) { - pjsip_msg_add_hdr(tdata->msg, pjsip_hdr_clone(tdata->pool, cap_hdr)); + pjsip_msg_add_hdr(tdata->msg, + (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, cap_hdr)); } /* Add User-Agent header */ @@ -1455,7 +1459,8 @@ PJ_DEF(pj_status_t) pjsua_transport_get_info( pjsua_transport_id id, pj_bzero(info, sizeof(*info)); /* Make sure id is in range. */ - PJ_ASSERT_RETURN(id>=0 && id=0 && id<(int)PJ_ARRAY_SIZE(pjsua_var.tpdata), + PJ_EINVAL); /* Make sure that transport exists */ PJ_ASSERT_RETURN(pjsua_var.tpdata[id].data.ptr != NULL, PJ_EINVAL); @@ -1523,7 +1528,8 @@ PJ_DEF(pj_status_t) pjsua_transport_set_enable( pjsua_transport_id id, pj_bool_t enabled) { /* Make sure id is in range. */ - PJ_ASSERT_RETURN(id>=0 && id=0 && id<(int)PJ_ARRAY_SIZE(pjsua_var.tpdata), + PJ_EINVAL); /* Make sure that transport exists */ PJ_ASSERT_RETURN(pjsua_var.tpdata[id].data.ptr != NULL, PJ_EINVAL); @@ -1546,7 +1552,8 @@ PJ_DEF(pj_status_t) pjsua_transport_close( pjsua_transport_id id, pj_status_t status; /* Make sure id is in range. */ - PJ_ASSERT_RETURN(id>=0 && id=0 && id<(int)PJ_ARRAY_SIZE(pjsua_var.tpdata), + PJ_EINVAL); /* Make sure that transport exists */ PJ_ASSERT_RETURN(pjsua_var.tpdata[id].data.ptr != NULL, PJ_EINVAL); @@ -1639,7 +1646,7 @@ void pjsua_process_msg_data(pjsip_tx_data *tdata, while (hdr && hdr != &msg_data->hdr_list) { pjsip_hdr *new_hdr; - new_hdr = pjsip_hdr_clone(tdata->pool, hdr); + new_hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, hdr); pjsip_msg_add_hdr(tdata->msg, new_hdr); hdr = hdr->next; @@ -1671,7 +1678,7 @@ void pjsua_set_msg_route_set( pjsip_tx_data *tdata, while (r != route_set) { pjsip_route_hdr *new_r; - new_r = pjsip_hdr_clone(tdata->pool, r); + new_r = (pjsip_route_hdr*) pjsip_hdr_clone(tdata->pool, r); pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)new_r); r = r->next; @@ -1718,7 +1725,7 @@ void pjsua_init_tpselector(pjsua_transport_id tp_id, if (tp_id == PJSUA_INVALID_ID) return; - pj_assert(tp_id >= 0 && tp_id < PJ_ARRAY_SIZE(pjsua_var.tpdata)); + pj_assert(tp_id >= 0 && tp_id < (int)PJ_ARRAY_SIZE(pjsua_var.tpdata)); tpdata = &pjsua_var.tpdata[tp_id]; flag = pjsip_transport_get_flag_from_type(tpdata->type); @@ -1748,7 +1755,7 @@ PJ_DEF(pj_status_t) pjsua_verify_sip_url(const char *c_url) pool = pj_pool_create(&pjsua_var.cp.factory, "check%p", 1024, 0, NULL); if (!pool) return -1; - url = pj_pool_alloc(pool, len+1); + url = (char*) pj_pool_alloc(pool, len+1); pj_ansi_strcpy(url, c_url); p = pjsip_parse_uri(pool, url, len, 0); diff --git a/pjsip/src/pjsua-lib/pjsua_im.c b/pjsip/src/pjsua-lib/pjsua_im.c index f9f945e6..b22d6f8c 100644 --- a/pjsip/src/pjsua-lib/pjsua_im.c +++ b/pjsip/src/pjsua-lib/pjsua_im.c @@ -112,7 +112,8 @@ pj_bool_t pjsua_im_accept_pager(pjsip_rx_data *rdata, /* Request MUST have message body, with Content-Type equal to * "text/plain". */ - ctype = pjsip_msg_find_hdr(msg, PJSIP_H_CONTENT_TYPE, NULL); + ctype = (pjsip_ctype_hdr*) + pjsip_msg_find_hdr(msg, PJSIP_H_CONTENT_TYPE, NULL); if (msg->body == NULL || ctype == NULL || !acceptable_message(&ctype->media)) { @@ -142,11 +143,12 @@ void pjsua_im_process_pager(int call_id, const pj_str_t *from, /* Build remote contact */ - contact_hdr = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, + contact_hdr = (pjsip_contact_hdr*) + pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL); if (contact_hdr) { - contact.ptr = pj_pool_alloc(rdata->tp_info.pool, - PJSIP_MAX_URL_SIZE); + contact.ptr = (char*) pj_pool_alloc(rdata->tp_info.pool, + PJSIP_MAX_URL_SIZE); contact.slen = pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR, contact_hdr->uri, contact.ptr, PJSIP_MAX_URL_SIZE); @@ -162,7 +164,7 @@ void pjsua_im_process_pager(int call_id, const pj_str_t *from, pj_str_t text_body; /* Save text body */ - text_body.ptr = rdata->msg_info.msg->body->data; + text_body.ptr = (char*) rdata->msg_info.msg->body->data; text_body.slen = rdata->msg_info.msg->body->len; if (pjsua_var.ua_cfg.cb.on_pager) { @@ -175,9 +177,9 @@ void pjsua_im_process_pager(int call_id, const pj_str_t *from, pj_status_t status; pj_bool_t is_typing; - status = pjsip_iscomposing_parse( rdata->tp_info.pool, body->data, - body->len, &is_typing, NULL, NULL, - NULL ); + status = pjsip_iscomposing_parse(rdata->tp_info.pool, (char*)body->data, + body->len, &is_typing, NULL, NULL, + NULL ); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Invalid MESSAGE body", status); return; @@ -240,8 +242,9 @@ static pj_bool_t im_on_rx_request(pjsip_rx_data *rdata) * Contact header contains the port number information. If this is * not available, then use From header. */ - from.ptr = pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_URL_SIZE); - contact_hdr = pjsip_msg_find_hdr(rdata->msg_info.msg, + from.ptr = (char*) pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_URL_SIZE); + contact_hdr = (pjsip_contact_hdr*) + pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL); if (contact_hdr) { from.slen = pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR, @@ -257,7 +260,7 @@ static pj_bool_t im_on_rx_request(pjsip_rx_data *rdata) from = pj_str("<--URI is too long-->"); /* Build the To text. */ - to.ptr = pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_URL_SIZE); + to.ptr = (char*) pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_URL_SIZE); to.slen = pjsip_uri_print( PJSIP_URI_IN_FROMTO_HDR, rdata->msg_info.to->uri, to.ptr, PJSIP_MAX_URL_SIZE); @@ -275,7 +278,7 @@ static pj_bool_t im_on_rx_request(pjsip_rx_data *rdata) /* Outgoing IM callback. */ static void im_callback(void *token, pjsip_event *e) { - pjsua_im_data *im_data = token; + pjsua_im_data *im_data = (pjsua_im_data*) token; if (e->type == PJSIP_EVENT_TSX_STATE) { @@ -352,7 +355,7 @@ static void im_callback(void *token, pjsip_event *e) */ static void typing_callback(void *token, pjsip_event *e) { - pjsua_im_data *im_data = token; + pjsua_im_data *im_data = (pjsua_im_data*) token; if (e->type == PJSIP_EVENT_TSX_STATE) { @@ -463,7 +466,7 @@ PJ_DEF(pj_status_t) pjsua_im_send( pjsua_acc_id acc_id, /* Create IM data to keep message details and give it back to * application on the callback */ - im_data = pj_pool_zalloc(tdata->pool, sizeof(*im_data)); + im_data = PJ_POOL_ZALLOC_T(tdata->pool, pjsua_im_data); im_data->acc_id = acc_id; im_data->call_id = PJSUA_INVALID_ID; pj_strdup_with_null(tdata->pool, &im_data->to, to); @@ -570,7 +573,7 @@ PJ_DEF(pj_status_t) pjsua_im_typing( pjsua_acc_id acc_id, pjsua_set_msg_route_set(tdata, &pjsua_var.acc[acc_id].route_set); /* Create data to reauthenticate */ - im_data = pj_pool_zalloc(tdata->pool, sizeof(*im_data)); + im_data = PJ_POOL_ZALLOC_T(tdata->pool, pjsua_im_data); im_data->acc_id = acc_id; /* Send request (statefully) */ diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index 7e5f1016..2c5b31b2 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -1237,7 +1237,7 @@ PJ_DEF(pj_status_t) pjsua_playlist_create( const pj_str_t file_names[], */ PJ_DEF(pjsua_conf_port_id) pjsua_player_get_conf_port(pjsua_player_id id) { - PJ_ASSERT_RETURN(id>=0 && id=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player), PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.player[id].port != NULL, PJ_EINVAL); return pjsua_var.player[id].slot; @@ -1249,7 +1249,7 @@ PJ_DEF(pjsua_conf_port_id) pjsua_player_get_conf_port(pjsua_player_id id) PJ_DEF(pj_status_t) pjsua_player_get_port( pjsua_recorder_id id, pjmedia_port **p_port) { - PJ_ASSERT_RETURN(id>=0 && id=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player), PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.player[id].port != NULL, PJ_EINVAL); PJ_ASSERT_RETURN(p_port != NULL, PJ_EINVAL); @@ -1264,7 +1264,7 @@ PJ_DEF(pj_status_t) pjsua_player_get_port( pjsua_recorder_id id, PJ_DEF(pj_status_t) pjsua_player_set_pos( pjsua_player_id id, pj_uint32_t samples) { - PJ_ASSERT_RETURN(id>=0 && id=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player), PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.player[id].port != NULL, PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.player[id].type == 0, PJ_EINVAL); @@ -1278,7 +1278,7 @@ PJ_DEF(pj_status_t) pjsua_player_set_pos( pjsua_player_id id, */ PJ_DEF(pj_status_t) pjsua_player_destroy(pjsua_player_id id) { - PJ_ASSERT_RETURN(id>=0 && id=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player), PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.player[id].port != NULL, PJ_EINVAL); PJSUA_LOCK(); @@ -1414,7 +1414,8 @@ PJ_DEF(pj_status_t) pjsua_recorder_create( const pj_str_t *filename, */ PJ_DEF(pjsua_conf_port_id) pjsua_recorder_get_conf_port(pjsua_recorder_id id) { - PJ_ASSERT_RETURN(id>=0 && id=0 && id<(int)PJ_ARRAY_SIZE(pjsua_var.recorder), + PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.recorder[id].port != NULL, PJ_EINVAL); return pjsua_var.recorder[id].slot; @@ -1426,7 +1427,8 @@ PJ_DEF(pjsua_conf_port_id) pjsua_recorder_get_conf_port(pjsua_recorder_id id) PJ_DEF(pj_status_t) pjsua_recorder_get_port( pjsua_recorder_id id, pjmedia_port **p_port) { - PJ_ASSERT_RETURN(id>=0 && id=0 && id<(int)PJ_ARRAY_SIZE(pjsua_var.recorder), + PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.recorder[id].port != NULL, PJ_EINVAL); PJ_ASSERT_RETURN(p_port != NULL, PJ_EINVAL); @@ -1439,7 +1441,8 @@ PJ_DEF(pj_status_t) pjsua_recorder_get_port( pjsua_recorder_id id, */ PJ_DEF(pj_status_t) pjsua_recorder_destroy(pjsua_recorder_id id) { - PJ_ASSERT_RETURN(id>=0 && id=0 && id<(int)PJ_ARRAY_SIZE(pjsua_var.recorder), + PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.recorder[id].port != NULL, PJ_EINVAL); PJSUA_LOCK(); diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c index 0a9ad74c..f9c51dda 100644 --- a/pjsip/src/pjsua-lib/pjsua_pres.c +++ b/pjsip/src/pjsua-lib/pjsua_pres.c @@ -37,7 +37,7 @@ PJ_DEF(unsigned) pjsua_get_buddy_count(void) */ PJ_DEF(pj_bool_t) pjsua_buddy_is_valid(pjsua_buddy_id buddy_id) { - return buddy_id>=0 && buddy_id=0 && buddy_id<(int)PJ_ARRAY_SIZE(pjsua_var.buddy) && pjsua_var.buddy[buddy_id].uri.slen != 0; } @@ -152,7 +152,7 @@ PJ_DEF(pj_status_t) pjsua_buddy_add( const pjsua_buddy_config *cfg, PJSUA_LOCK(); /* Find empty slot */ - for (index=0; indexremote, pjsip_evsub_get_state_name(sub))); @@ -516,9 +516,9 @@ static pj_bool_t pres_on_rx_request(pjsip_rx_data *rdata) } /* Attach our data to the subscription: */ - uapres = pj_pool_alloc(dlg->pool, sizeof(pjsua_srv_pres)); + uapres = PJ_POOL_ALLOC_T(dlg->pool, pjsua_srv_pres); uapres->sub = sub; - uapres->remote = pj_pool_alloc(dlg->pool, PJSIP_MAX_URL_SIZE); + uapres->remote = (char*) pj_pool_alloc(dlg->pool, PJSIP_MAX_URL_SIZE); status = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, dlg->remote.info->uri, uapres->remote, PJSIP_MAX_URL_SIZE); if (status < 1) @@ -585,7 +585,7 @@ static pj_bool_t pres_on_rx_request(pjsip_rx_data *rdata) */ static void publish_cb(struct pjsip_publishc_cbparam *param) { - pjsua_acc *acc = param->token; + pjsua_acc *acc = (pjsua_acc*) param->token; if (param->code/100 != 2 || param->status != PJ_SUCCESS) { if (param->status != PJ_SUCCESS) { @@ -855,7 +855,7 @@ static void pjsua_evsub_on_state( pjsip_evsub *sub, pjsip_event *event) PJSUA_LOCK(); - buddy = pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); + buddy = (pjsua_buddy*) pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); if (buddy) { PJ_LOG(3,(THIS_FILE, "Presence subscription to %.*s is %s", @@ -888,7 +888,7 @@ static void pjsua_evsub_on_tsx_state(pjsip_evsub *sub, PJSUA_LOCK(); - buddy = pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); + buddy = (pjsua_buddy*) pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); if (!buddy) { PJSUA_UNLOCK(); return; @@ -914,14 +914,16 @@ static void pjsua_evsub_on_tsx_state(pjsip_evsub *sub, } /* Find contact header. */ - contact_hdr = pjsip_msg_find_hdr(event->body.rx_msg.rdata->msg_info.msg, + contact_hdr = (pjsip_contact_hdr*) + pjsip_msg_find_hdr(event->body.rx_msg.rdata->msg_info.msg, PJSIP_H_CONTACT, NULL); if (!contact_hdr) { PJSUA_UNLOCK(); return; } - buddy->contact.ptr = pj_pool_alloc(pjsua_var.pool, PJSIP_MAX_URL_SIZE); + buddy->contact.ptr = (char*) + pj_pool_alloc(pjsua_var.pool, PJSIP_MAX_URL_SIZE); buddy->contact.slen = pjsip_uri_print( PJSIP_URI_IN_CONTACT_HDR, contact_hdr->uri, buddy->contact.ptr, @@ -945,7 +947,7 @@ static void pjsua_evsub_on_rx_notify(pjsip_evsub *sub, PJSUA_LOCK(); - buddy = pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); + buddy = (pjsua_buddy*) pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); if (buddy) { /* Update our info. */ pjsip_pres_get_status(sub, &buddy->status); diff --git a/pjsip/src/test-pjsip/dns_test.c b/pjsip/src/test-pjsip/dns_test.c index cefc4ed2..62484d4d 100644 --- a/pjsip/src/test-pjsip/dns_test.c +++ b/pjsip/src/test-pjsip/dns_test.c @@ -35,7 +35,7 @@ static void cb(pj_status_t status, void *token, const struct pjsip_server_addresses *addr) { - struct result *result = token; + struct result *result = (struct result*) token; result->status = status; if (status == PJ_SUCCESS) diff --git a/pjsip/src/test-pjsip/msg_test.c b/pjsip/src/test-pjsip/msg_test.c index 7bdc49dc..7491a0d7 100644 --- a/pjsip/src/test-pjsip/msg_test.c +++ b/pjsip/src/test-pjsip/msg_test.c @@ -186,8 +186,8 @@ parse_msg: ref_msg = entry->creator(pool); /* Create buffer for comparison. */ - str1.ptr = pj_pool_alloc(pool, BUFLEN); - str2.ptr = pj_pool_alloc(pool, BUFLEN); + str1.ptr = (char*)pj_pool_alloc(pool, BUFLEN); + str2.ptr = (char*)pj_pool_alloc(pool, BUFLEN); /* Compare message type. */ if (parsed_msg->type != ref_msg->type) { @@ -660,11 +660,11 @@ static pjsip_msg *create_msg1(pj_pool_t *pool) clen->len = 150; // Body - body = pj_pool_zalloc(pool, sizeof(*body)); + body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body); msg->body = body; body->content_type.type = pj_str("application"); body->content_type.subtype = pj_str("sdp"); - body->data = + body->data = (void*) "v=0\r\n" "o=alice 53655765 2353687637 IN IP4 pc33.atlanta.com\r\n" "s=-\r\n" @@ -672,7 +672,7 @@ static pjsip_msg *create_msg1(pj_pool_t *pool) "c=IN IP4 pc33.atlanta.com\r\n" "m=audio 3456 RTP/AVP 0 1 3 99\r\n" "a=rtpmap:0 PCMU/8000\r\n"; - body->len = pj_native_strlen(body->data); + body->len = pj_native_strlen((const char*) body->data); body->print_body = &pjsip_print_text_body; return msg; @@ -715,7 +715,7 @@ static int msg_benchmark(unsigned *p_detect, unsigned *p_parse, zero.u64 = 0; for (loop=0; loophname); len = strlen(test->hcontent); - parsed_hdr1 = pjsip_parse_hdr(pool, &hname, test->hcontent, len, &parsed_len); + parsed_hdr1 = (pjsip_hdr*) pjsip_parse_hdr(pool, &hname, + test->hcontent, len, + &parsed_len); if (parsed_hdr1 == NULL) { if (test->flags & HDR_FLAG_PARSE_FAIL) { pj_pool_release(pool); @@ -1475,7 +1477,7 @@ static int hdr_test(void) if (test->hshort_name) { hname = pj_str(test->hshort_name); len = strlen(test->hcontent); - parsed_hdr2 = pjsip_parse_hdr(pool, &hname, test->hcontent, len, &parsed_len); + parsed_hdr2 = (pjsip_hdr*) pjsip_parse_hdr(pool, &hname, test->hcontent, len, &parsed_len); if (parsed_hdr2 == NULL) { PJ_LOG(3,(THIS_FILE, " error parsing header %s: %s", test->hshort_name, test->hcontent)); return -510; @@ -1489,13 +1491,13 @@ static int hdr_test(void) } /* Print the original header */ - input = pj_pool_alloc(pool, 1024); + input = (char*) pj_pool_alloc(pool, 1024); len = pj_ansi_snprintf(input, 1024, "%s: %s", test->hname, test->hcontent); if (len < 1 || len >= 1024) return -520; /* Print the parsed header*/ - output = pj_pool_alloc(pool, 1024); + output = (char*) pj_pool_alloc(pool, 1024); len = pjsip_hdr_print_on(parsed_hdr1, output, 1024); if (len < 1 || len >= 1024) { PJ_LOG(3,(THIS_FILE, " header too long: %s: %s", test->hname, test->hcontent)); diff --git a/pjsip/src/test-pjsip/transport_test.c b/pjsip/src/test-pjsip/transport_test.c index d7ad4366..b751c573 100644 --- a/pjsip/src/test-pjsip/transport_test.c +++ b/pjsip/src/test-pjsip/transport_test.c @@ -560,7 +560,7 @@ int transport_rt_test( pjsip_transport_type_e tp_type, rt_test_data[i].timeout_timer.cb = &rt_timeout_timer; /* Generate Call-ID for each thread. */ - rt_test_data[i].call_id.ptr = pj_pool_alloc(pool, rt_call_id.slen+1); + rt_test_data[i].call_id.ptr = (char*) pj_pool_alloc(pool, rt_call_id.slen+1); pj_strcpy(&rt_test_data[i].call_id, &rt_call_id); buf[0] = '0' + i; pj_strcat(&rt_test_data[i].call_id, &str_id); diff --git a/pjsip/src/test-pjsip/tsx_bench.c b/pjsip/src/test-pjsip/tsx_bench.c index d14a82f2..3950827c 100644 --- a/pjsip/src/test-pjsip/tsx_bench.c +++ b/pjsip/src/test-pjsip/tsx_bench.c @@ -53,7 +53,7 @@ static int uac_tsx_bench(unsigned working_set, pj_timestamp *p_elapsed) NULL); /* Create transaction array */ - tsx = pj_pool_zalloc(request->pool, working_set * sizeof(pj_pool_t*)); + tsx = (pjsip_transaction**) pj_pool_zalloc(request->pool, working_set * sizeof(pj_pool_t*)); pj_bzero(&mod_tsx_user, sizeof(mod_tsx_user)); mod_tsx_user.id = -1; @@ -130,10 +130,10 @@ static int uas_tsx_bench(unsigned working_set, pj_timestamp *p_elapsed) pj_bzero(&rdata, sizeof(pjsip_rx_data)); rdata.tp_info.pool = request->pool; rdata.msg_info.msg = request->msg; - rdata.msg_info.from = pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL); - rdata.msg_info.to = pjsip_msg_find_hdr(request->msg, PJSIP_H_TO, NULL); - rdata.msg_info.cseq = pjsip_msg_find_hdr(request->msg, PJSIP_H_CSEQ, NULL); - rdata.msg_info.cid = pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL); + rdata.msg_info.from = (pjsip_from_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL); + rdata.msg_info.to = (pjsip_to_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_TO, NULL); + rdata.msg_info.cseq = (pjsip_cseq_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_CSEQ, NULL); + rdata.msg_info.cid = (pjsip_cid_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL); rdata.msg_info.via = via; pj_sockaddr_in_init(&remote, 0, 0); @@ -147,7 +147,7 @@ static int uas_tsx_bench(unsigned working_set, pj_timestamp *p_elapsed) /* Create transaction array */ - tsx = pj_pool_zalloc(request->pool, working_set * sizeof(pj_pool_t*)); + tsx = (pjsip_transaction**) pj_pool_zalloc(request->pool, working_set * sizeof(pj_pool_t*)); pj_bzero(&mod_tsx_user, sizeof(mod_tsx_user)); mod_tsx_user.id = -1; diff --git a/pjsip/src/test-pjsip/tsx_uac_test.c b/pjsip/src/test-pjsip/tsx_uac_test.c index fa6bf771..0e128474 100644 --- a/pjsip/src/test-pjsip/tsx_uac_test.c +++ b/pjsip/src/test-pjsip/tsx_uac_test.c @@ -364,7 +364,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_PROCEEDING) { PJ_LOG(3,(THIS_FILE, " error: prev state is %s instead of %s", - pjsip_tsx_state_str(e->body.tsx_state.prev_state), + pjsip_tsx_state_str((pjsip_tsx_state_e)e->body.tsx_state.prev_state), pjsip_tsx_state_str(PJSIP_TSX_STATE_PROCEEDING))); test_complete = -739; } @@ -547,7 +547,7 @@ struct response static void send_response_callback( pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry) { - struct response *r = entry->user_data; + struct response *r = (struct response*) entry->user_data; pjsip_transport *tp = r->res_addr.transport; pjsip_endpt_send_response(endpt, &r->res_addr, r->tdata, NULL, NULL); @@ -759,7 +759,7 @@ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) pj_assert(status == PJ_SUCCESS); /* Schedule sending final response in couple of of secs. */ - r = pj_pool_alloc(tdata->pool, sizeof(*r)); + r = PJ_POOL_ALLOC_T(tdata->pool, struct response); r->res_addr = res_addr; r->tdata = tdata; if (r->res_addr.transport) @@ -880,7 +880,7 @@ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) pj_assert(status == PJ_SUCCESS); /* Schedule sending final response in couple of of secs. */ - r = pj_pool_alloc(tdata->pool, sizeof(*r)); + r = PJ_POOL_ALLOC_T(tdata->pool, struct response); r->res_addr = res_addr; r->tdata = tdata; if (r->res_addr.transport) @@ -968,7 +968,7 @@ static int perform_tsx_test(int dummy, char *target_uri, char *from_uri, } /* Set the branch param for test 1. */ - via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); + via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); via->branch_param = pj_str(branch_param); /* Add additional reference to tdata to prevent transaction from @@ -1097,7 +1097,7 @@ static int tsx_uac_retransmit_test(void) */ enabled = msg_logger_set_enabled(0); - for (i=0; itype == PJSIP_TRANSPORT_LOOP_DGRAM) { PJ_LOG(3,(THIS_FILE, " variant %c: with %d ms transport delay", @@ -1343,7 +1343,7 @@ int tsx_uac_test(struct tsx_test_param *param) test_param = param; /* Get transport flag */ - tp_flag = pjsip_transport_get_flag_from_type(test_param->type); + tp_flag = pjsip_transport_get_flag_from_type((pjsip_transport_type_e)test_param->type); pj_ansi_sprintf(TARGET_URI, "sip:bob@127.0.0.1:%d;transport=%s", param->port, param->tp_type); diff --git a/pjsip/src/test-pjsip/tsx_uas_test.c b/pjsip/src/test-pjsip/tsx_uas_test.c index cd9aa056..7ca05a89 100644 --- a/pjsip/src/test-pjsip/tsx_uas_test.c +++ b/pjsip/src/test-pjsip/tsx_uas_test.c @@ -208,7 +208,7 @@ static void send_response_timer( pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry) { pjsip_transaction *tsx; - struct response *r = entry->user_data; + struct response *r = (struct response*) entry->user_data; pj_status_t status; tsx = pjsip_tsx_layer_find_tsx(&r->tsx_key, PJ_TRUE); @@ -276,7 +276,7 @@ static void schedule_send_response( pjsip_rx_data *rdata, return; } - r = pj_pool_alloc(tdata->pool, sizeof(*r)); + r = PJ_POOL_ALLOC_T(tdata->pool, struct response); pj_strdup(tdata->pool, &r->tsx_key, tsx_key); r->tdata = tdata; @@ -284,7 +284,7 @@ static void schedule_send_response( pjsip_rx_data *rdata, delay.msec = msec_delay; pj_time_val_normalize(&delay); - t = pj_pool_zalloc(tdata->pool, sizeof(*t)); + t = PJ_POOL_ZALLOC_T(tdata->pool, pj_timer_entry); t->user_data = r; t->cb = &send_response_timer; @@ -1096,7 +1096,7 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) uri=(pjsip_sip_uri*)pjsip_uri_get_uri(tdata->msg->line.req.uri); uri->transport_param = pj_str("loop-dgram"); - via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); + via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); via->branch_param = pj_str(TEST9_BRANCH_ID); status = pjsip_endpt_send_request_stateless(endpt, tdata, @@ -1197,7 +1197,7 @@ static int perform_test( char *target_uri, char *from_uri, } /* Set the branch param for test 1. */ - via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); + via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); via->branch_param = pj_str(branch_param); /* Schedule first send. */ @@ -1471,7 +1471,7 @@ static int tsx_transport_failure_test(void) }; int i, status; - for (i=0; itype); + tp_flag = pjsip_transport_get_flag_from_type((pjsip_transport_type_e)param->type); pj_ansi_sprintf(TARGET_URI, "sip:bob@127.0.0.1:%d;transport=%s", param->port, param->tp_type); diff --git a/pjsip/src/test-pjsip/txdata_test.c b/pjsip/src/test-pjsip/txdata_test.c index 851983f5..b9272ca1 100644 --- a/pjsip/src/test-pjsip/txdata_test.c +++ b/pjsip/src/test-pjsip/txdata_test.c @@ -444,7 +444,7 @@ static int txdata_test_uri_params(void) } /* Fill up the Via header to prevent syntax error on parsing */ - via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); + via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL); via->transport = pj_str("TCP"); via->sent_by.host = pj_str("127.0.0.1"); @@ -707,8 +707,8 @@ static int create_response_bench(pj_timestamp *p_elapsed) via->rport_param = 0; via->branch_param = pj_str("012345678901234567890123456789"); via->recvd_param = pj_str("192.168.0.7"); - pjsip_msg_insert_first_hdr(request->msg, pjsip_hdr_clone(request->pool, via)); - pjsip_msg_insert_first_hdr(request->msg, pjsip_hdr_clone(request->pool, via)); + pjsip_msg_insert_first_hdr(request->msg, (pjsip_hdr*) pjsip_hdr_clone(request->pool, via)); + pjsip_msg_insert_first_hdr(request->msg, (pjsip_hdr*) pjsip_hdr_clone(request->pool, via)); pjsip_msg_insert_first_hdr(request->msg, (pjsip_hdr*)via); @@ -716,10 +716,10 @@ static int create_response_bench(pj_timestamp *p_elapsed) pj_bzero(&rdata, sizeof(pjsip_rx_data)); rdata.tp_info.pool = request->pool; rdata.msg_info.msg = request->msg; - rdata.msg_info.from = pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL); - rdata.msg_info.to = pjsip_msg_find_hdr(request->msg, PJSIP_H_TO, NULL); - rdata.msg_info.cseq = pjsip_msg_find_hdr(request->msg, PJSIP_H_CSEQ, NULL); - rdata.msg_info.cid = pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL); + rdata.msg_info.from = (pjsip_from_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL); + rdata.msg_info.to = (pjsip_to_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_TO, NULL); + rdata.msg_info.cseq = (pjsip_cseq_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_CSEQ, NULL); + rdata.msg_info.cid = (pjsip_cid_hdr*) pjsip_msg_find_hdr(request->msg, PJSIP_H_FROM, NULL); rdata.msg_info.via = via; /* diff --git a/pjsip/src/test-pjsip/uri_test.c b/pjsip/src/test-pjsip/uri_test.c index 0cf34e97..d26df14c 100644 --- a/pjsip/src/test-pjsip/uri_test.c +++ b/pjsip/src/test-pjsip/uri_test.c @@ -382,7 +382,7 @@ static pjsip_uri *create_uri4(pj_pool_t *pool) #define param_add(list,pname,pvalue) \ do { \ pjsip_param *param; \ - param=pj_pool_alloc(pool, sizeof(pjsip_param)); \ + param=PJ_POOL_ALLOC_T(pool, pjsip_param); \ param->name = pj_str(pname); \ param->value = pj_str(pvalue); \ pj_list_insert_before(&list, param); \ @@ -662,7 +662,7 @@ static pjsip_uri *create_uri34(pj_pool_t *pool) uri->number = pj_str("911"); - p = pj_pool_alloc(pool, sizeof(*p)); + p = PJ_POOL_ALLOC_T(pool, pjsip_param); p->name = p->value = pj_str("p1"); pj_list_insert_before(&uri->other_param, p); @@ -725,8 +725,8 @@ static pj_status_t do_uri_test(pj_pool_t *pool, struct uri_test *entry) ref_uri = entry->creator(pool); /* Print both URI. */ - s1.ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); - s2.ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); + s1.ptr = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); + s2.ptr = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); pj_get_timestamp(&t1); len = pjsip_uri_print( PJSIP_URI_IN_OTHER, parsed_uri, s1.ptr, PJSIP_MAX_URL_SIZE); -- cgit v1.2.3