diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-05-01 16:54:54 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-05-01 16:54:54 +0000 |
commit | 682ee6718afa661df775bd44b4fdf89344ec67b2 (patch) | |
tree | 5949acca77d1ff14c50b1fc3b6d3a996539fe7d6 /pjsip/src | |
parent | b93717c9a39a0755f65df6b252b1e3506d7a42c8 (diff) |
PJSDP port to Symbian
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1240 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src')
-rw-r--r-- | pjsip/src/pjsip/sip_auth_client.c | 17 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_auth_msg.c | 23 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_auth_parser.c | 4 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_auth_server.c | 2 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_dialog.c | 80 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_endpoint.c | 6 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_msg.c | 103 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_parser.c | 25 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_resolve.c | 8 |
9 files changed, 149 insertions, 119 deletions
diff --git a/pjsip/src/pjsip/sip_auth_client.c b/pjsip/src/pjsip/sip_auth_client.c index 75a86abd..86724a90 100644 --- a/pjsip/src/pjsip/sip_auth_client.c +++ b/pjsip/src/pjsip/sip_auth_client.c @@ -213,7 +213,7 @@ static pj_status_t respond_digest( pj_pool_t *pool, pj_strdup(pool, &cred->opaque, &chal->opaque); /* Allocate memory. */ - cred->response.ptr = pj_pool_alloc(pool, PJSIP_MD5STRLEN); + cred->response.ptr = (char*) pj_pool_alloc(pool, PJSIP_MD5STRLEN); cred->response.slen = PJSIP_MD5STRLEN; if (chal->qop.slen == 0) { @@ -228,7 +228,7 @@ static pj_status_t respond_digest( pj_pool_t *pool, * We respond with selecting "qop=auth" protection. */ cred->qop = pjsip_AUTH_STR; - cred->nc.ptr = pj_pool_alloc(pool, 16); + cred->nc.ptr = (char*) pj_pool_alloc(pool, 16); cred->nc.slen = pj_ansi_snprintf(cred->nc.ptr, 16, "%08u", nc); if (cnonce && cnonce->slen) { @@ -266,7 +266,8 @@ static void update_digest_session( pj_pool_t *ses_pool, /* Initialize cnonce and qop if not present. */ if (cached_auth->cnonce.slen == 0) { /* Save the whole challenge */ - cached_auth->last_chal = pjsip_hdr_clone(ses_pool, hdr); + cached_auth->last_chal = (pjsip_www_authenticate_hdr*) + pjsip_hdr_clone(ses_pool, hdr); /* Create cnonce */ pj_create_unique_string( ses_pool, &cached_auth->cnonce ); @@ -366,7 +367,8 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_clone( pj_pool_t *pool, sess->pool = pool; sess->endpt = (pjsip_endpoint*)rhs->endpt; sess->cred_cnt = rhs->cred_cnt; - sess->cred_info = pj_pool_alloc(pool, + sess->cred_info = (pjsip_cred_info*) + pj_pool_alloc(pool, sess->cred_cnt*sizeof(pjsip_cred_info)); for (i=0; i<rhs->cred_cnt; ++i) { pj_strdup(pool, &sess->cred_info[i].realm, &rhs->cred_info[i].realm); @@ -401,7 +403,8 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_set_credentials( pjsip_auth_clt_sess *sess, sess->cred_cnt = 0; } else { int i; - sess->cred_info = pj_pool_alloc(sess->pool, cred_cnt * sizeof(*c)); + sess->cred_info = (pjsip_cred_info*) + pj_pool_alloc(sess->pool, cred_cnt * sizeof(*c)); for (i=0; i<cred_cnt; ++i) { sess->cred_info[i].data_type = c[i].data_type; pj_strdup(sess->pool, &sess->cred_info[i].scheme, &c[i].scheme); @@ -816,7 +819,7 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reinit_req( pjsip_auth_clt_sess *sess, */ cached_auth = find_cached_auth(sess, &hchal->challenge.common.realm ); if (!cached_auth) { - cached_auth = pj_pool_zalloc( sess->pool, sizeof(*cached_auth)); + cached_auth = PJ_POOL_ZALLOC_T( sess->pool, pjsip_cached_auth); pj_strdup( sess->pool, &cached_auth->realm, &hchal->challenge.common.realm); cached_auth->is_proxy = (hchal->type == PJSIP_H_PROXY_AUTHENTICATE); # if (PJSIP_AUTH_HEADER_CACHING) @@ -844,7 +847,7 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reinit_req( pjsip_auth_clt_sess *sess, /* Remove branch param in Via header. */ - 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.slen = 0; /* Must invalidate the message! */ diff --git a/pjsip/src/pjsip/sip_auth_msg.c b/pjsip/src/pjsip/sip_auth_msg.c index 86d62bd3..7b6cbc20 100644 --- a/pjsip/src/pjsip/sip_auth_msg.c +++ b/pjsip/src/pjsip/sip_auth_msg.c @@ -46,7 +46,8 @@ static pjsip_hdr_vptr authorization_hdr_vptr = PJ_DEF(pjsip_authorization_hdr*) pjsip_authorization_hdr_create(pj_pool_t *pool) { - pjsip_authorization_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); + pjsip_authorization_hdr *hdr; + hdr = PJ_POOL_ZALLOC_T(pool, pjsip_authorization_hdr); init_hdr(hdr, PJSIP_H_AUTHORIZATION, &authorization_hdr_vptr); pj_list_init(&hdr->credential.common.other_param); return hdr; @@ -54,7 +55,8 @@ PJ_DEF(pjsip_authorization_hdr*) pjsip_authorization_hdr_create(pj_pool_t *pool) PJ_DEF(pjsip_proxy_authorization_hdr*) pjsip_proxy_authorization_hdr_create(pj_pool_t *pool) { - pjsip_proxy_authorization_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); + pjsip_proxy_authorization_hdr *hdr; + hdr = PJ_POOL_ZALLOC_T(pool, pjsip_proxy_authorization_hdr); init_hdr(hdr, PJSIP_H_PROXY_AUTHORIZATION, &authorization_hdr_vptr); pj_list_init(&hdr->credential.common.other_param); return hdr; @@ -168,11 +170,13 @@ static pjsip_authorization_hdr* pjsip_authorization_hdr_clone( pj_pool_t *pool, return hdr; } -static pjsip_authorization_hdr* pjsip_authorization_hdr_shallow_clone( pj_pool_t *pool, - const pjsip_authorization_hdr *rhs) +static pjsip_authorization_hdr* +pjsip_authorization_hdr_shallow_clone( pj_pool_t *pool, + const pjsip_authorization_hdr *rhs) { /* This function also serves Proxy-Authorization header. */ - pjsip_authorization_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_authorization_hdr *hdr; + hdr = PJ_POOL_ALLOC_T(pool, pjsip_authorization_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); pjsip_param_shallow_clone(pool, &hdr->credential.common.other_param, &rhs->credential.common.other_param); @@ -201,7 +205,8 @@ static pjsip_hdr_vptr www_authenticate_hdr_vptr = PJ_DEF(pjsip_www_authenticate_hdr*) pjsip_www_authenticate_hdr_create(pj_pool_t *pool) { - pjsip_www_authenticate_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); + pjsip_www_authenticate_hdr *hdr; + hdr = PJ_POOL_ZALLOC_T(pool, pjsip_www_authenticate_hdr); init_hdr(hdr, PJSIP_H_WWW_AUTHENTICATE, &www_authenticate_hdr_vptr); pj_list_init(&hdr->challenge.common.other_param); return hdr; @@ -210,7 +215,8 @@ PJ_DEF(pjsip_www_authenticate_hdr*) pjsip_www_authenticate_hdr_create(pj_pool_t PJ_DEF(pjsip_proxy_authenticate_hdr*) pjsip_proxy_authenticate_hdr_create(pj_pool_t *pool) { - pjsip_proxy_authenticate_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); + pjsip_proxy_authenticate_hdr *hdr; + hdr = PJ_POOL_ZALLOC_T(pool, pjsip_proxy_authenticate_hdr); init_hdr(hdr, PJSIP_H_PROXY_AUTHENTICATE, &www_authenticate_hdr_vptr); pj_list_init(&hdr->challenge.common.other_param); return hdr; @@ -322,7 +328,8 @@ static pjsip_www_authenticate_hdr* pjsip_www_authenticate_hdr_shallow_clone( pj_ const pjsip_www_authenticate_hdr *rhs) { /* This function also serves Proxy-Authenticate header. */ - pjsip_www_authenticate_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_www_authenticate_hdr *hdr; + hdr = PJ_POOL_ALLOC_T(pool, pjsip_www_authenticate_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); pjsip_param_shallow_clone(pool, &hdr->challenge.common.other_param, &rhs->challenge.common.other_param); diff --git a/pjsip/src/pjsip/sip_auth_parser.c b/pjsip/src/pjsip/sip_auth_parser.c index e6394af2..fca1a41a 100644 --- a/pjsip/src/pjsip/sip_auth_parser.c +++ b/pjsip/src/pjsip/sip_auth_parser.c @@ -106,7 +106,7 @@ static void parse_digest_credential( pj_scanner *scanner, pj_pool_t *pool, cred->nc = value; } else { - pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); + pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param); p->name = name; p->value = value; pj_list_insert_before(&cred->other_param, p); @@ -168,7 +168,7 @@ static void parse_digest_challenge( pj_scanner *scanner, pj_pool_t *pool, chal->qop = value; } else { - pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); + pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param); p->name = name; p->value = value; pj_list_insert_before(&chal->other_param, p); diff --git a/pjsip/src/pjsip/sip_auth_server.c b/pjsip/src/pjsip/sip_auth_server.c index 7e572693..816c218c 100644 --- a/pjsip/src/pjsip/sip_auth_server.c +++ b/pjsip/src/pjsip/sip_auth_server.c @@ -114,7 +114,7 @@ PJ_DEF(pj_status_t) pjsip_auth_srv_verify( pjsip_auth_srv *auth_srv, { pjsip_authorization_hdr *h_auth; pjsip_msg *msg = rdata->msg_info.msg; - int htype; + pjsip_hdr_e htype; pj_str_t acc_name; pjsip_cred_info cred_info; pj_status_t status; diff --git a/pjsip/src/pjsip/sip_dialog.c b/pjsip/src/pjsip/sip_dialog.c index bd6e99f1..5cb285b1 100644 --- a/pjsip/src/pjsip/sip_dialog.c +++ b/pjsip/src/pjsip/sip_dialog.c @@ -69,7 +69,7 @@ static pj_status_t create_dialog( pjsip_user_agent *ua, if (!pool) return PJ_ENOMEM; - dlg = pj_pool_zalloc(pool, sizeof(pjsip_dialog)); + dlg = PJ_POOL_ZALLOC_T(pool, pjsip_dialog); PJ_ASSERT_RETURN(dlg != NULL, PJ_ENOMEM); dlg->pool = pool; @@ -154,7 +154,8 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uac( pjsip_user_agent *ua, c = param->value.ptr[param->value.slen]; param->value.ptr[param->value.slen] = '\0'; - hdr = pjsip_parse_hdr(dlg->pool, ¶m->name, param->value.ptr, + hdr = (pjsip_hdr*) + pjsip_parse_hdr(dlg->pool, ¶m->name, param->value.ptr, param->value.slen, NULL); param->value.ptr[param->value.slen] = (char)c; @@ -222,7 +223,8 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uac( pjsip_user_agent *ua, if (PJSIP_URI_SCHEME_IS_SIP(dlg->remote.info->uri) || PJSIP_URI_SCHEME_IS_SIPS(dlg->remote.info->uri)) { - pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(dlg->remote.info->uri); + pjsip_sip_uri *sip_uri = (pjsip_sip_uri *) + pjsip_uri_get_uri(dlg->remote.info->uri); if (!pj_list_empty(&sip_uri->header_param)) { pj_str_t tmp; @@ -230,7 +232,8 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uac( pjsip_user_agent *ua, pj_list_init(&sip_uri->header_param); /* Print URI */ - tmp.ptr = pj_pool_alloc(dlg->pool, dlg->remote.info_str.slen); + tmp.ptr = (char*) pj_pool_alloc(dlg->pool, + dlg->remote.info_str.slen); tmp.slen = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, sip_uri, tmp.ptr, dlg->remote.info_str.slen); @@ -330,10 +333,11 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua, /* Temprary string for getting the string representation of * both local and remote URI. */ - tmp.ptr = pj_pool_alloc(rdata->tp_info.pool, TMP_LEN); + tmp.ptr = (char*) pj_pool_alloc(rdata->tp_info.pool, TMP_LEN); /* Init local info from the To header. */ - dlg->local.info = pjsip_hdr_clone(dlg->pool, rdata->msg_info.to); + dlg->local.info = (pjsip_fromto_hdr*) + pjsip_hdr_clone(dlg->pool, rdata->msg_info.to); pjsip_fromto_hdr_set_from(dlg->local.info); /* Generate local tag. */ @@ -388,7 +392,8 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua, } /* Init remote info from the From header. */ - dlg->remote.info = pjsip_hdr_clone(dlg->pool, rdata->msg_info.from); + dlg->remote.info = (pjsip_fromto_hdr*) + pjsip_hdr_clone(dlg->pool, rdata->msg_info.from); pjsip_fromto_hdr_set_to(dlg->remote.info); /* Print the remote info. */ @@ -405,13 +410,15 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua, /* Init remote's contact from Contact header. */ - contact_hdr = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, + contact_hdr = (pjsip_hdr*) + pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL); if (!contact_hdr) { status = PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_BAD_REQUEST); goto on_error; } - dlg->remote.contact = pjsip_hdr_clone(dlg->pool, contact_hdr); + dlg->remote.contact = (pjsip_contact_hdr*) + pjsip_hdr_clone(dlg->pool, contact_hdr); /* Init remote's CSeq from CSeq header */ dlg->remote.cseq = dlg->remote.first_cseq = rdata->msg_info.cseq->cseq; @@ -431,7 +438,8 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua, PJSIP_URI_SCHEME_IS_SIPS(rdata->msg_info.msg->line.req.uri); /* Call-ID */ - dlg->call_id = pjsip_hdr_clone(dlg->pool, rdata->msg_info.cid); + dlg->call_id = (pjsip_cid_hdr*) + pjsip_hdr_clone(dlg->pool, rdata->msg_info.cid); /* Route set. * RFC 3261 Section 12.1.1: @@ -446,7 +454,7 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua, pjsip_route_hdr *route; /* Clone the Record-Route, change the type to Route header. */ - route = pjsip_hdr_clone(dlg->pool, rr); + route = (pjsip_route_hdr*) pjsip_hdr_clone(dlg->pool, rr); pjsip_routing_hdr_set_route(route); /* Add to route set. */ @@ -456,7 +464,8 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua, rr = rr->next; if (rr == (void*)&rdata->msg_info.msg->hdr) break; - rr = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_RECORD_ROUTE, rr); + rr = (pjsip_route_hdr*) pjsip_msg_find_hdr(rdata->msg_info.msg, + PJSIP_H_RECORD_ROUTE, rr); } /* Init client authentication session. */ @@ -569,10 +578,11 @@ PJ_DEF(pj_status_t) pjsip_dlg_fork( const pjsip_dialog *first_dlg, return status; /* Clone remote target. */ - dlg->target = pjsip_uri_clone(dlg->pool, first_dlg->target); + dlg->target = (pjsip_uri*) pjsip_uri_clone(dlg->pool, first_dlg->target); /* Clone local info. */ - dlg->local.info = pjsip_hdr_clone(dlg->pool, first_dlg->local.info); + dlg->local.info = (pjsip_fromto_hdr*) + pjsip_hdr_clone(dlg->pool, first_dlg->local.info); /* Clone local tag. */ pj_strdup(dlg->pool, &dlg->local.info->tag, &first_dlg->local.info->tag); @@ -583,10 +593,12 @@ PJ_DEF(pj_status_t) pjsip_dlg_fork( const pjsip_dialog *first_dlg, dlg->local.cseq = first_dlg->local.cseq; /* Clone local Contact. */ - dlg->local.contact = pjsip_hdr_clone(dlg->pool, first_dlg->local.contact); + dlg->local.contact = (pjsip_contact_hdr*) + pjsip_hdr_clone(dlg->pool, first_dlg->local.contact); /* Clone remote info. */ - dlg->remote.info = pjsip_hdr_clone(dlg->pool, first_dlg->remote.info); + dlg->remote.info = (pjsip_fromto_hdr*) + pjsip_hdr_clone(dlg->pool, first_dlg->remote.info); /* Set remote tag from the response. */ pj_strdup(dlg->pool, &dlg->remote.info->tag, &rdata->msg_info.to->tag); @@ -610,7 +622,8 @@ PJ_DEF(pj_status_t) pjsip_dlg_fork( const pjsip_dialog *first_dlg, dlg->secure = PJSIP_URI_SCHEME_IS_SIPS(dlg->target); /* Clone Call-ID header. */ - dlg->call_id = pjsip_hdr_clone(dlg->pool, first_dlg->call_id); + dlg->call_id = (pjsip_cid_hdr*) + pjsip_hdr_clone(dlg->pool, first_dlg->call_id); /* Duplicate Route-Set. */ pj_list_init(&dlg->route_set); @@ -618,7 +631,7 @@ PJ_DEF(pj_status_t) pjsip_dlg_fork( const pjsip_dialog *first_dlg, while (r != &first_dlg->route_set) { pjsip_route_hdr *h; - h = pjsip_hdr_clone(dlg->pool, r); + h = (pjsip_route_hdr*) pjsip_hdr_clone(dlg->pool, r); pj_list_push_back(&dlg->route_set, h); r = r->next; @@ -720,7 +733,7 @@ PJ_DEF(pj_status_t) pjsip_dlg_set_route_set( pjsip_dialog *dlg, while (r != route_set) { pjsip_route_hdr *new_r; - new_r = pjsip_hdr_clone(dlg->pool, r); + new_r = (pjsip_route_hdr*) pjsip_hdr_clone(dlg->pool, r); pj_list_push_back(&dlg->route_set, new_r); r = r->next; @@ -979,7 +992,7 @@ static pj_status_t dlg_create_request_throw( pjsip_dialog *dlg, end_list = &dlg->route_set; for (; route != end_list; route = route->next ) { pjsip_route_hdr *r; - r = pjsip_hdr_shallow_clone( tdata->pool, route ); + r = (pjsip_route_hdr*) pjsip_hdr_shallow_clone( tdata->pool, route ); pjsip_routing_hdr_set_route(r); pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)r); } @@ -1176,7 +1189,8 @@ static void dlg_beautify_response(pjsip_dialog *dlg, if (pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL) == 0 && pjsip_msg_find_hdr_by_name(tdata->msg, &hcontact, NULL) == 0) { - hdr = pjsip_hdr_clone(tdata->pool, dlg->local.contact); + hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, + dlg->local.contact); pjsip_msg_add_hdr(tdata->msg, hdr); } } @@ -1188,7 +1202,7 @@ static void dlg_beautify_response(pjsip_dialog *dlg, c_hdr = pjsip_endpt_get_capability(dlg->endpt, PJSIP_H_ALLOW, NULL); if (c_hdr) { - hdr = pjsip_hdr_clone(tdata->pool, c_hdr); + hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, c_hdr); pjsip_msg_add_hdr(tdata->msg, hdr); } } @@ -1200,7 +1214,7 @@ static void dlg_beautify_response(pjsip_dialog *dlg, c_hdr = pjsip_endpt_get_capability(dlg->endpt, PJSIP_H_SUPPORTED, NULL); if (c_hdr) { - hdr = pjsip_hdr_clone(tdata->pool, c_hdr); + hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, c_hdr); pjsip_msg_add_hdr(tdata->msg, hdr); } } @@ -1285,7 +1299,7 @@ PJ_DEF(pj_status_t) pjsip_dlg_modify_response( pjsip_dialog *dlg, /* Remove existing Contact header (without this, when dialog sent * 180 and then 302, the Contact in 302 will not get updated). */ - hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL); + hdr = (pjsip_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL); if (hdr) pj_list_erase(hdr); @@ -1398,7 +1412,7 @@ PJ_DEF(pj_status_t) pjsip_dlg_respond( pjsip_dialog *dlg, hdr = hdr_list->next; while (hdr != hdr_list) { pjsip_msg_add_hdr(tdata->msg, - pjsip_hdr_clone(tdata->pool, hdr)); + (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, hdr)); hdr = hdr->next; } } @@ -1526,7 +1540,7 @@ static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_msg *msg) for (hdr=msg->hdr.prev; hdr!=end_hdr; hdr=hdr->prev) { if (hdr->type == PJSIP_H_RECORD_ROUTE) { pjsip_route_hdr *r; - r = pjsip_hdr_clone(dlg->pool, hdr); + r = (pjsip_route_hdr*) pjsip_hdr_clone(dlg->pool, hdr); pjsip_routing_hdr_set_route(r); pj_list_push_back(&dlg->route_set, r); } @@ -1598,10 +1612,12 @@ void pjsip_dlg_on_rx_response( pjsip_dialog *dlg, pjsip_rx_data *rdata ) /* The remote target MUST be set to the URI from the Contact header * field of the response. */ - contact = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, + contact = (pjsip_contact_hdr*) + pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL); if (contact) { - dlg->remote.contact = pjsip_hdr_clone(dlg->pool, contact); + dlg->remote.contact = (pjsip_contact_hdr*) + pjsip_hdr_clone(dlg->pool, contact); dlg->target = dlg->remote.contact->uri; } @@ -1642,10 +1658,12 @@ void pjsip_dlg_on_rx_response( pjsip_dialog *dlg, pjsip_rx_data *rdata ) { pjsip_contact_hdr *contact; - contact = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, - NULL); + contact = (pjsip_contact_hdr*) pjsip_msg_find_hdr(rdata->msg_info.msg, + PJSIP_H_CONTACT, + NULL); if (contact) { - dlg->remote.contact = pjsip_hdr_clone(dlg->pool, contact); + dlg->remote.contact = (pjsip_contact_hdr*) + pjsip_hdr_clone(dlg->pool, contact); dlg->target = dlg->remote.contact->uri; } diff --git a/pjsip/src/pjsip/sip_endpoint.c b/pjsip/src/pjsip/sip_endpoint.c index 1a509aab..add8ad3e 100644 --- a/pjsip/src/pjsip/sip_endpoint.c +++ b/pjsip/src/pjsip/sip_endpoint.c @@ -153,7 +153,7 @@ static void pool_callback( pj_pool_t *pool, pj_size_t size ) /* Compare module name, used for searching module based on name. */ static int cmp_mod_name(void *name, const void *mod) { - return pj_stricmp(name, &((pjsip_module*)mod)->name); + return pj_stricmp((const pj_str_t*)name, &((pjsip_module*)mod)->name); } /* @@ -445,7 +445,7 @@ PJ_DEF(pj_status_t) pjsip_endpt_create(pj_pool_factory *pf, return PJ_ENOMEM; /* Create endpoint. */ - endpt = pj_pool_zalloc(pool, sizeof(*endpt)); + endpt = PJ_POOL_ZALLOC_T(pool, pjsip_endpoint); endpt->pool = pool; endpt->pf = pf; @@ -828,7 +828,7 @@ static void endpt_on_rx_msg( pjsip_endpoint *endpt, int port = rdata->msg_info.via->sent_by.port; pj_bool_t mismatch = PJ_FALSE; if (port == 0) { - int type; + pjsip_transport_type_e type; type = rdata->tp_info.transport->key.type; port = pjsip_transport_get_default_port_for_type(type); } diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c index 47c493db..f94cd315 100644 --- a/pjsip/src/pjsip/sip_msg.c +++ b/pjsip/src/pjsip/sip_msg.c @@ -240,7 +240,7 @@ PJ_DEF(int) pjsip_method_cmp( const pjsip_method *m1, const pjsip_method *m2) PJ_DEF(pjsip_msg*) pjsip_msg_create( pj_pool_t *pool, pjsip_msg_type_e type) { - pjsip_msg *msg = pj_pool_alloc(pool, sizeof(pjsip_msg)); + pjsip_msg *msg = PJ_POOL_ALLOC_T(pool, pjsip_msg); pj_list_init(&msg->hdr); msg->type = type; msg->body = NULL; @@ -257,7 +257,8 @@ PJ_DEF(pjsip_msg*) pjsip_msg_clone( pj_pool_t *pool, const pjsip_msg *src) /* Clone request/status line */ if (src->type == PJSIP_REQUEST_MSG) { pjsip_method_copy(pool, &dst->line.req.method, &src->line.req.method); - dst->line.req.uri = pjsip_uri_clone(pool, src->line.req.uri); + dst->line.req.uri = (pjsip_uri*) pjsip_uri_clone(pool, + src->line.req.uri); } else { dst->line.status.code = src->line.status.code; pj_strdup(pool, &dst->line.status.reason, &src->line.status.reason); @@ -266,7 +267,7 @@ PJ_DEF(pjsip_msg*) pjsip_msg_clone( pj_pool_t *pool, const pjsip_msg *src) /* Clone headers */ sh = src->hdr.next; while (sh != &src->hdr) { - pjsip_hdr *dh = pjsip_hdr_clone(pool, sh); + pjsip_hdr *dh = (pjsip_hdr*) pjsip_hdr_clone(pool, sh); pjsip_msg_add_hdr(dst, dh); sh = sh->next; } @@ -282,7 +283,7 @@ PJ_DEF(pjsip_msg*) pjsip_msg_clone( pj_pool_t *pool, const pjsip_msg *src) PJ_DEF(void*) pjsip_msg_find_hdr( const pjsip_msg *msg, pjsip_hdr_e hdr_type, const void *start) { - const pjsip_hdr *hdr=start, *end=&msg->hdr; + const pjsip_hdr *hdr=(const pjsip_hdr*) start, *end=&msg->hdr; if (hdr == NULL) { hdr = msg->hdr.next; @@ -298,7 +299,7 @@ PJ_DEF(void*) pjsip_msg_find_hdr_by_name( const pjsip_msg *msg, const pj_str_t *name, const void *start) { - const pjsip_hdr *hdr=start, *end=&msg->hdr; + const pjsip_hdr *hdr=(const pjsip_hdr*)start, *end=&msg->hdr; if (hdr == NULL) { hdr = msg->hdr.next; @@ -318,7 +319,7 @@ PJ_DEF(void*) pjsip_msg_find_hdr_by_name( const pjsip_msg *msg, PJ_DEF(void*) pjsip_msg_find_remove_hdr( pjsip_msg *msg, pjsip_hdr_e hdr_type, void *start) { - pjsip_hdr *hdr = pjsip_msg_find_hdr(msg, hdr_type, start); + pjsip_hdr *hdr = (pjsip_hdr*) pjsip_msg_find_hdr(msg, hdr_type, start); if (hdr) { pj_list_erase(hdr); } @@ -350,7 +351,7 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg, *p++ = ' '; /* Add URI */ - uri = pjsip_uri_get_uri(msg->line.req.uri); + uri = (pjsip_uri*) pjsip_uri_get_uri(msg->line.req.uri); len = pjsip_uri_print( PJSIP_URI_IN_REQ_URI, uri, p, end-p); if (len < 1) return -1; @@ -484,20 +485,20 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg, /////////////////////////////////////////////////////////////////////////////// PJ_DEF(void*) pjsip_hdr_clone( pj_pool_t *pool, const void *hdr_ptr ) { - const pjsip_hdr *hdr = hdr_ptr; + const pjsip_hdr *hdr = (const pjsip_hdr*) hdr_ptr; return (*hdr->vptr->clone)(pool, hdr_ptr); } PJ_DEF(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr_ptr ) { - const pjsip_hdr *hdr = hdr_ptr; + const pjsip_hdr *hdr = (const pjsip_hdr*) hdr_ptr; return (*hdr->vptr->shallow_clone)(pool, hdr_ptr); } PJ_DEF(int) pjsip_hdr_print_on( void *hdr_ptr, char *buf, pj_size_t len) { - pjsip_hdr *hdr = hdr_ptr; + pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr; return (*hdr->vptr->print_on)(hdr_ptr, buf, len); } @@ -562,7 +563,7 @@ pjsip_generic_string_hdr_init( pj_pool_t *pool, const pj_str_t *hnames, const pj_str_t *hvalue) { - pjsip_generic_string_hdr *hdr = mem; + pjsip_generic_string_hdr *hdr = (pjsip_generic_string_hdr*) mem; pj_str_t dup_hname, dup_hval; if (hnames) { @@ -624,7 +625,7 @@ static pjsip_generic_string_hdr* pjsip_generic_string_hdr_clone( pj_pool_t *pool static pjsip_generic_string_hdr* pjsip_generic_string_hdr_shallow_clone( pj_pool_t *pool, const pjsip_generic_string_hdr *rhs ) { - pjsip_generic_string_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_generic_string_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_string_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); return hdr; } @@ -653,7 +654,7 @@ PJ_DEF(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_init( pj_pool_t *pool, const pj_str_t *hnames, int value) { - pjsip_generic_int_hdr *hdr = mem; + pjsip_generic_int_hdr *hdr = (pjsip_generic_int_hdr*) mem; init_hdr(hdr, PJSIP_H_OTHER, &generic_int_hdr_vptr); if (hnames) { @@ -693,7 +694,7 @@ static int pjsip_generic_int_hdr_print( pjsip_generic_int_hdr *hdr, static pjsip_generic_int_hdr* pjsip_generic_int_hdr_clone( pj_pool_t *pool, const pjsip_generic_int_hdr *rhs) { - pjsip_generic_int_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_generic_int_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_int_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); return hdr; } @@ -701,7 +702,7 @@ static pjsip_generic_int_hdr* pjsip_generic_int_hdr_clone( pj_pool_t *pool, static pjsip_generic_int_hdr* pjsip_generic_int_hdr_shallow_clone( pj_pool_t *pool, const pjsip_generic_int_hdr *rhs ) { - pjsip_generic_int_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_generic_int_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_int_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); return hdr; } @@ -728,7 +729,7 @@ PJ_DEF(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_init( pj_pool_t *pool, void *mem, const pj_str_t *hnames) { - pjsip_generic_array_hdr *hdr = mem; + pjsip_generic_array_hdr *hdr = (pjsip_generic_array_hdr*) mem; init_hdr(hdr, PJSIP_H_OTHER, &generic_array_hdr_vptr); if (hnames) { @@ -772,7 +773,7 @@ static pjsip_generic_array_hdr* pjsip_generic_array_hdr_clone( pj_pool_t *pool, const pjsip_generic_array_hdr *rhs) { unsigned i; - pjsip_generic_array_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_generic_array_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_array_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); for (i=0; i<rhs->count; ++i) { @@ -786,7 +787,7 @@ static pjsip_generic_array_hdr* pjsip_generic_array_hdr_clone( pj_pool_t *pool, static pjsip_generic_array_hdr* pjsip_generic_array_hdr_shallow_clone( pj_pool_t *pool, const pjsip_generic_array_hdr *rhs) { - pjsip_generic_array_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_generic_array_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_array_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); return hdr; } @@ -798,7 +799,7 @@ static pjsip_generic_array_hdr* pjsip_generic_array_hdr_shallow_clone( pj_pool_t PJ_DEF(pjsip_accept_hdr*) pjsip_accept_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_accept_hdr *hdr = mem; + pjsip_accept_hdr *hdr = (pjsip_accept_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -822,7 +823,7 @@ PJ_DEF(pjsip_accept_hdr*) pjsip_accept_hdr_create(pj_pool_t *pool) PJ_DEF(pjsip_allow_hdr*) pjsip_allow_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_allow_hdr *hdr = mem; + pjsip_allow_hdr *hdr = (pjsip_allow_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -845,7 +846,7 @@ PJ_DEF(pjsip_allow_hdr*) pjsip_allow_hdr_create(pj_pool_t *pool) PJ_DEF(pjsip_cid_hdr*) pjsip_cid_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_cid_hdr *hdr = mem; + pjsip_cid_hdr *hdr = (pjsip_cid_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -879,7 +880,7 @@ static pjsip_hdr_vptr clen_hdr_vptr = PJ_DEF(pjsip_clen_hdr*) pjsip_clen_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_clen_hdr *hdr = mem; + pjsip_clen_hdr *hdr = (pjsip_clen_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -941,7 +942,7 @@ static pjsip_hdr_vptr cseq_hdr_vptr = PJ_DEF(pjsip_cseq_hdr*) pjsip_cseq_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_cseq_hdr *hdr = mem; + pjsip_cseq_hdr *hdr = (pjsip_cseq_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -996,7 +997,7 @@ static pjsip_cseq_hdr* pjsip_cseq_hdr_clone( pj_pool_t *pool, static pjsip_cseq_hdr* pjsip_cseq_hdr_shallow_clone( pj_pool_t *pool, const pjsip_cseq_hdr *rhs ) { - pjsip_cseq_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_cseq_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_cseq_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); return hdr; } @@ -1020,7 +1021,7 @@ static pjsip_hdr_vptr contact_hdr_vptr = PJ_DEF(pjsip_contact_hdr*) pjsip_contact_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_contact_hdr *hdr = mem; + pjsip_contact_hdr *hdr = (pjsip_contact_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1112,7 +1113,7 @@ static pjsip_contact_hdr* pjsip_contact_hdr_clone(pj_pool_t *pool, if (hdr->star) return hdr; - hdr->uri = pjsip_uri_clone(pool, rhs->uri); + hdr->uri = (pjsip_uri*) pjsip_uri_clone(pool, rhs->uri); hdr->q1000 = rhs->q1000; hdr->expires = rhs->expires; pjsip_param_clone(pool, &hdr->other_param, &rhs->other_param); @@ -1123,7 +1124,7 @@ static pjsip_contact_hdr* pjsip_contact_hdr_shallow_clone( pj_pool_t *pool, const pjsip_contact_hdr *rhs) { - pjsip_contact_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_contact_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_contact_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); return hdr; @@ -1149,7 +1150,7 @@ static pjsip_hdr_vptr ctype_hdr_vptr = PJ_DEF(pjsip_ctype_hdr*) pjsip_ctype_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_ctype_hdr *hdr = mem; + pjsip_ctype_hdr *hdr = (pjsip_ctype_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1227,7 +1228,7 @@ PJ_DEF(pjsip_expires_hdr*) pjsip_expires_hdr_init( pj_pool_t *pool, void *mem, int value) { - pjsip_expires_hdr *hdr = mem; + pjsip_expires_hdr *hdr = (pjsip_expires_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1266,7 +1267,7 @@ static pjsip_hdr_vptr fromto_hdr_vptr = PJ_DEF(pjsip_from_hdr*) pjsip_from_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_from_hdr *hdr = mem; + pjsip_from_hdr *hdr = (pjsip_from_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1285,7 +1286,7 @@ PJ_DEF(pjsip_from_hdr*) pjsip_from_hdr_create( pj_pool_t *pool ) PJ_DEF(pjsip_to_hdr*) pjsip_to_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_to_hdr *hdr = mem; + pjsip_to_hdr *hdr = (pjsip_to_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1354,7 +1355,7 @@ static pjsip_fromto_hdr* pjsip_fromto_hdr_clone( pj_pool_t *pool, hdr->type = rhs->type; hdr->name = rhs->name; hdr->sname = rhs->sname; - hdr->uri = pjsip_uri_clone(pool, rhs->uri); + hdr->uri = (pjsip_uri*) pjsip_uri_clone(pool, rhs->uri); pj_strdup( pool, &hdr->tag, &rhs->tag); pjsip_param_clone( pool, &hdr->other_param, &rhs->other_param); @@ -1365,7 +1366,7 @@ static pjsip_fromto_hdr* pjsip_fromto_hdr_shallow_clone( pj_pool_t *pool, const pjsip_fromto_hdr *rhs) { - pjsip_fromto_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_fromto_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_fromto_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); pjsip_param_shallow_clone( pool, &hdr->other_param, &rhs->other_param); return hdr; @@ -1380,7 +1381,7 @@ PJ_DEF(pjsip_max_fwd_hdr*) pjsip_max_fwd_hdr_init( pj_pool_t *pool, void *mem, int value) { - pjsip_max_fwd_hdr *hdr = mem; + pjsip_max_fwd_hdr *hdr = (pjsip_max_fwd_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1406,7 +1407,7 @@ PJ_DEF(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_init( pj_pool_t *pool, void *mem, int value ) { - pjsip_min_expires_hdr *hdr = mem; + pjsip_min_expires_hdr *hdr = (pjsip_min_expires_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1440,7 +1441,7 @@ static pjsip_hdr_vptr routing_hdr_vptr = PJ_DEF(pjsip_rr_hdr*) pjsip_rr_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_rr_hdr *hdr = mem; + pjsip_rr_hdr *hdr = (pjsip_rr_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1460,7 +1461,7 @@ PJ_DEF(pjsip_rr_hdr*) pjsip_rr_hdr_create( pj_pool_t *pool ) PJ_DEF(pjsip_route_hdr*) pjsip_route_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_route_hdr *hdr = mem; + pjsip_route_hdr *hdr = (pjsip_route_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1520,7 +1521,7 @@ static int pjsip_routing_hdr_print( pjsip_routing_hdr *hdr, static pjsip_routing_hdr* pjsip_routing_hdr_clone( pj_pool_t *pool, const pjsip_routing_hdr *rhs ) { - pjsip_routing_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_routing_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_routing_hdr); init_hdr(hdr, rhs->type, rhs->vptr); pjsip_name_addr_init(&hdr->name_addr); @@ -1532,7 +1533,7 @@ static pjsip_routing_hdr* pjsip_routing_hdr_clone( pj_pool_t *pool, static pjsip_routing_hdr* pjsip_routing_hdr_shallow_clone( pj_pool_t *pool, const pjsip_routing_hdr *rhs ) { - pjsip_routing_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_routing_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_routing_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); pjsip_param_shallow_clone( pool, &hdr->other_param, &rhs->other_param); return hdr; @@ -1546,7 +1547,7 @@ static pjsip_routing_hdr* pjsip_routing_hdr_shallow_clone( pj_pool_t *pool, PJ_DEF(pjsip_require_hdr*) pjsip_require_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_require_hdr *hdr = mem; + pjsip_require_hdr *hdr = (pjsip_require_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1569,7 +1570,7 @@ PJ_DEF(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_init( pj_pool_t *pool, void *mem, int value ) { - pjsip_retry_after_hdr *hdr = mem; + pjsip_retry_after_hdr *hdr = (pjsip_retry_after_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1593,7 +1594,7 @@ PJ_DEF(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_create(pj_pool_t *pool, PJ_DEF(pjsip_supported_hdr*) pjsip_supported_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_supported_hdr *hdr = mem; + pjsip_supported_hdr *hdr = (pjsip_supported_hdr*) mem; PJ_UNUSED_ARG(pool); init_hdr(hdr, PJSIP_H_SUPPORTED, &generic_array_hdr_vptr); @@ -1615,7 +1616,7 @@ PJ_DEF(pjsip_supported_hdr*) pjsip_supported_hdr_create(pj_pool_t *pool) PJ_DEF(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_unsupported_hdr *hdr = mem; + pjsip_unsupported_hdr *hdr = (pjsip_unsupported_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1648,7 +1649,7 @@ static pjsip_hdr_vptr via_hdr_vptr = PJ_DEF(pjsip_via_hdr*) pjsip_via_hdr_init( pj_pool_t *pool, void *mem ) { - pjsip_via_hdr *hdr = mem; + pjsip_via_hdr *hdr = (pjsip_via_hdr*) mem; PJ_UNUSED_ARG(pool); @@ -1755,7 +1756,7 @@ static pjsip_via_hdr* pjsip_via_hdr_clone( pj_pool_t *pool, static pjsip_via_hdr* pjsip_via_hdr_shallow_clone( pj_pool_t *pool, const pjsip_via_hdr *rhs ) { - pjsip_via_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); + pjsip_via_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_via_hdr); pj_memcpy(hdr, rhs, sizeof(*hdr)); pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); return hdr; @@ -1773,9 +1774,9 @@ PJ_DEF(pjsip_warning_hdr*) pjsip_warning_hdr_create( pj_pool_t *pool, const pj_str_t str_warning = { "Warning", 7 }; pj_str_t hvalue; - hvalue.ptr = pj_pool_alloc(pool, 10 + /* code */ - host->slen + 2 + /* host */ - text->slen + 2); /* text */ + hvalue.ptr = (char*) pj_pool_alloc(pool, 10 + /* code */ + host->slen + 2 + /* host */ + text->slen + 2); /* text */ hvalue.slen = pj_ansi_sprintf(hvalue.ptr, "%u %.*s \"%.*s\"", code, (int)host->slen, host->ptr, (int)text->slen, text->ptr); @@ -1813,7 +1814,7 @@ PJ_DEF(void*) pjsip_clone_text_data( pj_pool_t *pool, const void *data, char *newdata = ""; if (len) { - newdata = pj_pool_alloc(pool, len); + newdata = (char*) pj_pool_alloc(pool, len); pj_memcpy(newdata, data, len); } return newdata; @@ -1855,7 +1856,7 @@ PJ_DEF(pjsip_msg_body*) pjsip_msg_body_clone( pj_pool_t *pool, pjsip_msg_body *new_body; pj_status_t status; - new_body = pj_pool_alloc(pool, sizeof(pjsip_msg_body)); + new_body = PJ_POOL_ALLOC_T(pool, pjsip_msg_body); PJ_ASSERT_RETURN(new_body, NULL); status = pjsip_msg_body_copy(pool, new_body, body); @@ -1873,7 +1874,7 @@ PJ_DEF(pjsip_msg_body*) pjsip_msg_body_create( pj_pool_t *pool, PJ_ASSERT_RETURN(pool && type && subtype && text, NULL); - body = pj_pool_zalloc(pool, sizeof(pjsip_msg_body)); + body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body); PJ_ASSERT_RETURN(body != NULL, NULL); pj_strdup(pool, &body->content_type.type, type); diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c index ea24a71a..644532ec 100644 --- a/pjsip/src/pjsip/sip_parser.c +++ b/pjsip/src/pjsip/sip_parser.c @@ -250,7 +250,7 @@ void pjsip_concat_param_imp( pj_str_t *param, pj_pool_t *pool, int len; len = param->slen + pname->slen + pvalue->slen + 3; - p = new_param = pj_pool_alloc(pool, len); + p = new_param = (char*) pj_pool_alloc(pool, len); if (param->slen) { int old_len = param->slen; @@ -1001,7 +1001,7 @@ parse_headers: * as body. */ if (ctype_hdr && scanner->curptr!=scanner->end) { - pjsip_msg_body *body = pj_pool_alloc(pool, sizeof(pjsip_msg_body)); + pjsip_msg_body *body = PJ_POOL_ALLOC_T(pool, pjsip_msg_body); body->content_type.type = ctype_hdr->media.type; body->content_type.subtype = ctype_hdr->media.subtype; body->content_type.param = ctype_hdr->media.param; @@ -1022,7 +1022,7 @@ parse_headers: if (err_list) { pjsip_parser_err_report *err_info; - err_info = pj_pool_alloc(pool, sizeof(*err_info)); + err_info = PJ_POOL_ALLOC_T(pool, pjsip_parser_err_report); err_info->except_code = PJ_GET_EXCEPTION(); err_info->line = scanner->line; /* Scanner's column is zero based, so add 1 */ @@ -1250,8 +1250,9 @@ static pjsip_uri *int_parse_uri_or_name_addr( pj_scanner *scanner, pj_pool_t *po PJ_THROW(PJSIP_SYN_ERR_EXCEPTION); } - uri = (*func)( scanner, pool, - (opt & PJSIP_PARSE_URI_IN_FROM_TO_HDR)== 0); + uri = (pjsip_uri*) + (*func)(scanner, pool, + (opt & PJSIP_PARSE_URI_IN_FROM_TO_HDR)==0); } else { @@ -1379,7 +1380,7 @@ static void* int_parse_sip_url( pj_scanner *scanner, url->lr_param = 1; } else { - pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); + pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param); p->name = pname; p->value = pvalue; pj_list_insert_before(&url->other_param, p); @@ -1391,7 +1392,7 @@ static void* int_parse_sip_url( pj_scanner *scanner, if (parse_params && *scanner->curptr == '?') { do { pjsip_param *param; - param = pj_pool_alloc(pool, sizeof(pjsip_param)); + param = PJ_POOL_ALLOC_T(pool, pjsip_param); int_parse_hparam(scanner, pool, ¶m->name, ¶m->value); pj_list_insert_before(&url->header_param, param); } while (*scanner->curptr == '&'); @@ -1623,7 +1624,7 @@ static void int_parse_contact_param( pjsip_contact_hdr *hdr, int_parse_param( scanner, pool, &pname, &pvalue, 0); if (!parser_stricmp(pname, pjsip_Q_STR) && pvalue.slen) { - char *dot_pos = pj_memchr(pvalue.ptr, '.', pvalue.slen); + char *dot_pos = (char*) pj_memchr(pvalue.ptr, '.', pvalue.slen); if (!dot_pos) { hdr->q1000 = pj_strtoul(&pvalue); } else { @@ -1635,7 +1636,7 @@ static void int_parse_contact_param( pjsip_contact_hdr *hdr, hdr->expires = pj_strtoul(&pvalue); } else { - pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); + pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param); p->name = pname; p->value = pvalue; pj_list_insert_before(&hdr->other_param, p); @@ -1773,7 +1774,7 @@ static void parse_hdr_fromto( pj_scanner *scanner, hdr->tag = pvalue; } else { - pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); + pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param); p->name = pname; p->value = pvalue; pj_list_insert_before(&hdr->other_param, p); @@ -1871,7 +1872,7 @@ static void int_parse_via_param( pjsip_via_hdr *hdr, pj_scanner *scanner, else hdr->rport_param = 0; } else { - pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); + pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param); p->name = pname; p->value = pvalue; pj_list_insert_before(&hdr->other_param, p); @@ -1911,7 +1912,7 @@ static void parse_hdr_rr_route( pj_scanner *scanner, pj_pool_t *pool, pj_memcpy(&hdr->name_addr, temp, sizeof(*temp)); while (*scanner->curptr == ';') { - pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); + pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param); int_parse_param(scanner, pool, &p->name, &p->value, 0); pj_list_insert_before(&hdr->other_param, p); } diff --git a/pjsip/src/pjsip/sip_resolve.c b/pjsip/src/pjsip/sip_resolve.c index 8faa57d4..04c36986 100644 --- a/pjsip/src/pjsip/sip_resolve.c +++ b/pjsip/src/pjsip/sip_resolve.c @@ -103,7 +103,7 @@ PJ_DEF(pj_status_t) pjsip_resolver_create( pj_pool_t *pool, pjsip_resolver_t *resolver; PJ_ASSERT_RETURN(pool && p_res, PJ_EINVAL); - resolver = pj_pool_zalloc(pool, sizeof(*resolver)); + resolver = PJ_POOL_ZALLOC_T(pool, pjsip_resolver_t); *p_res = resolver; return PJ_SUCCESS; @@ -278,7 +278,7 @@ PJ_DEF(void) pjsip_resolve( pjsip_resolver_t *resolver, #if PJSIP_HAS_RESOLVER /* Build the query state */ - query = pj_pool_zalloc(pool, sizeof(struct query)); + query = PJ_POOL_ZALLOC_T(pool, struct query); pj_ansi_snprintf(query->objname, sizeof(query->objname), "rsvjob%X", resolver->job_id++); query->resolver = resolver; @@ -298,7 +298,7 @@ PJ_DEF(void) pjsip_resolve( pjsip_resolver_t *resolver, query->naptr[0].order = 0; query->naptr[0].pref = 0; query->naptr[0].type = type; - query->naptr[0].target_name.ptr = + query->naptr[0].target_name.ptr = (char*) pj_pool_alloc(pool, target->addr.host.slen + 12); if (type == PJSIP_TRANSPORT_TLS) @@ -639,7 +639,7 @@ static void dns_callback(void *user_data, pj_status_t status, pj_dns_parsed_packet *pkt) { - struct query *query = user_data; + struct query *query = (struct query*) user_data; unsigned i; /* Proceed to next stage */ |