diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-05-11 15:14:34 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-05-11 15:14:34 +0000 |
commit | 208776ec0c5c77623637a28b88391067df24e682 (patch) | |
tree | d474825faeaa48869df57b5470a8ba417ebf4489 /pjsip/src/pjsua-lib | |
parent | b4e01cefd4f354128396e85f205ccfa0879bc319 (diff) |
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
Diffstat (limited to 'pjsip/src/pjsua-lib')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 31 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_call.c | 44 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_core.c | 29 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_im.c | 33 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_media.c | 17 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_pres.c | 24 |
6 files changed, 100 insertions, 78 deletions
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<PJ_ARRAY_SIZE(pjsua_var.acc) && + return 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<PJ_ARRAY_SIZE(pjsua_var.tpdata), PJ_EINVAL); + PJ_ASSERT_RETURN(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; i<pjsua_var.acc_cnt; ++i) { @@ -954,7 +957,8 @@ PJ_DEF(pj_status_t) pjsua_acc_create_request(pjsua_acc_id acc_id, /* Copy routeset */ r = acc->route_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<PJ_ARRAY_SIZE(pjsua_var.acc), + PJ_ASSERT_RETURN(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_id<pjsua_var.ua_cfg.max_calls; ++call_id) { + for (call_id=0; call_id<(int)pjsua_var.ua_cfg.max_calls; ++call_id) { if (pjsua_var.calls[call_id].inv == NULL) break; } - if (call_id == pjsua_var.ua_cfg.max_calls) { + if (call_id == (int)pjsua_var.ua_cfg.max_calls) { pjsua_perror(THIS_FILE, "Error making file", PJ_ETOOMANY); PJSUA_UNLOCK(); return PJ_ETOOMANY; @@ -507,7 +507,7 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata) pj_str_t st_text = { "OK", 2 }; /* 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 */ 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<PJ_ARRAY_SIZE(pjsua_var.tpdata), PJ_EINVAL); + PJ_ASSERT_RETURN(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<PJ_ARRAY_SIZE(pjsua_var.tpdata), PJ_EINVAL); + PJ_ASSERT_RETURN(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<PJ_ARRAY_SIZE(pjsua_var.tpdata), PJ_EINVAL); + PJ_ASSERT_RETURN(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<PJ_ARRAY_SIZE(pjsua_var.player), PJ_EINVAL); + PJ_ASSERT_RETURN(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<PJ_ARRAY_SIZE(pjsua_var.player), PJ_EINVAL); + PJ_ASSERT_RETURN(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<PJ_ARRAY_SIZE(pjsua_var.player), PJ_EINVAL); + PJ_ASSERT_RETURN(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<PJ_ARRAY_SIZE(pjsua_var.player), PJ_EINVAL); + PJ_ASSERT_RETURN(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<PJ_ARRAY_SIZE(pjsua_var.recorder), PJ_EINVAL); + PJ_ASSERT_RETURN(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<PJ_ARRAY_SIZE(pjsua_var.recorder), PJ_EINVAL); + PJ_ASSERT_RETURN(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<PJ_ARRAY_SIZE(pjsua_var.recorder), PJ_EINVAL); + PJ_ASSERT_RETURN(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<PJ_ARRAY_SIZE(pjsua_var.buddy) && + return 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; index<PJ_ARRAY_SIZE(pjsua_var.buddy); ++index) { + for (index=0; index<(int)PJ_ARRAY_SIZE(pjsua_var.buddy); ++index) { if (pjsua_var.buddy[index].uri.slen == 0) break; } @@ -423,7 +423,7 @@ static void pres_evsub_on_srv_state( pjsip_evsub *sub, pjsip_event *event) PJSUA_LOCK(); - uapres = pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); + uapres = (pjsua_srv_pres*) pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id); if (uapres) { PJ_LOG(3,(THIS_FILE, "Server subscription to %s is %s", uapres->remote, 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); |