Changeset 1240 for pjproject/trunk/pjsip/src/pjsip/sip_msg.c
- Timestamp:
- May 1, 2007 4:54:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_msg.c
r1220 r1240 241 241 PJ_DEF(pjsip_msg*) pjsip_msg_create( pj_pool_t *pool, pjsip_msg_type_e type) 242 242 { 243 pjsip_msg *msg = pj_pool_alloc(pool, sizeof(pjsip_msg));243 pjsip_msg *msg = PJ_POOL_ALLOC_T(pool, pjsip_msg); 244 244 pj_list_init(&msg->hdr); 245 245 msg->type = type; … … 258 258 if (src->type == PJSIP_REQUEST_MSG) { 259 259 pjsip_method_copy(pool, &dst->line.req.method, &src->line.req.method); 260 dst->line.req.uri = pjsip_uri_clone(pool, src->line.req.uri); 260 dst->line.req.uri = (pjsip_uri*) pjsip_uri_clone(pool, 261 src->line.req.uri); 261 262 } else { 262 263 dst->line.status.code = src->line.status.code; … … 267 268 sh = src->hdr.next; 268 269 while (sh != &src->hdr) { 269 pjsip_hdr *dh = pjsip_hdr_clone(pool, sh);270 pjsip_hdr *dh = (pjsip_hdr*) pjsip_hdr_clone(pool, sh); 270 271 pjsip_msg_add_hdr(dst, dh); 271 272 sh = sh->next; … … 283 284 pjsip_hdr_e hdr_type, const void *start) 284 285 { 285 const pjsip_hdr *hdr= start, *end=&msg->hdr;286 const pjsip_hdr *hdr=(const pjsip_hdr*) start, *end=&msg->hdr; 286 287 287 288 if (hdr == NULL) { … … 299 300 const void *start) 300 301 { 301 const pjsip_hdr *hdr= start, *end=&msg->hdr;302 const pjsip_hdr *hdr=(const pjsip_hdr*)start, *end=&msg->hdr; 302 303 303 304 if (hdr == NULL) { … … 319 320 pjsip_hdr_e hdr_type, void *start) 320 321 { 321 pjsip_hdr *hdr = pjsip_msg_find_hdr(msg, hdr_type, start);322 pjsip_hdr *hdr = (pjsip_hdr*) pjsip_msg_find_hdr(msg, hdr_type, start); 322 323 if (hdr) { 323 324 pj_list_erase(hdr); … … 351 352 352 353 /* Add URI */ 353 uri = pjsip_uri_get_uri(msg->line.req.uri);354 uri = (pjsip_uri*) pjsip_uri_get_uri(msg->line.req.uri); 354 355 len = pjsip_uri_print( PJSIP_URI_IN_REQ_URI, uri, p, end-p); 355 356 if (len < 1) … … 485 486 PJ_DEF(void*) pjsip_hdr_clone( pj_pool_t *pool, const void *hdr_ptr ) 486 487 { 487 const pjsip_hdr *hdr = hdr_ptr;488 const pjsip_hdr *hdr = (const pjsip_hdr*) hdr_ptr; 488 489 return (*hdr->vptr->clone)(pool, hdr_ptr); 489 490 } … … 492 493 PJ_DEF(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr_ptr ) 493 494 { 494 const pjsip_hdr *hdr = hdr_ptr;495 const pjsip_hdr *hdr = (const pjsip_hdr*) hdr_ptr; 495 496 return (*hdr->vptr->shallow_clone)(pool, hdr_ptr); 496 497 } … … 498 499 PJ_DEF(int) pjsip_hdr_print_on( void *hdr_ptr, char *buf, pj_size_t len) 499 500 { 500 pjsip_hdr *hdr = hdr_ptr;501 pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr; 501 502 return (*hdr->vptr->print_on)(hdr_ptr, buf, len); 502 503 } … … 563 564 const pj_str_t *hvalue) 564 565 { 565 pjsip_generic_string_hdr *hdr = mem;566 pjsip_generic_string_hdr *hdr = (pjsip_generic_string_hdr*) mem; 566 567 pj_str_t dup_hname, dup_hval; 567 568 … … 625 626 const pjsip_generic_string_hdr *rhs ) 626 627 { 627 pjsip_generic_string_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));628 pjsip_generic_string_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_string_hdr); 628 629 pj_memcpy(hdr, rhs, sizeof(*hdr)); 629 630 return hdr; … … 654 655 int value) 655 656 { 656 pjsip_generic_int_hdr *hdr = mem;657 pjsip_generic_int_hdr *hdr = (pjsip_generic_int_hdr*) mem; 657 658 658 659 init_hdr(hdr, PJSIP_H_OTHER, &generic_int_hdr_vptr); … … 694 695 const pjsip_generic_int_hdr *rhs) 695 696 { 696 pjsip_generic_int_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));697 pjsip_generic_int_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_int_hdr); 697 698 pj_memcpy(hdr, rhs, sizeof(*hdr)); 698 699 return hdr; … … 702 703 const pjsip_generic_int_hdr *rhs ) 703 704 { 704 pjsip_generic_int_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));705 pjsip_generic_int_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_int_hdr); 705 706 pj_memcpy(hdr, rhs, sizeof(*hdr)); 706 707 return hdr; … … 729 730 const pj_str_t *hnames) 730 731 { 731 pjsip_generic_array_hdr *hdr = mem;732 pjsip_generic_array_hdr *hdr = (pjsip_generic_array_hdr*) mem; 732 733 733 734 init_hdr(hdr, PJSIP_H_OTHER, &generic_array_hdr_vptr); … … 773 774 { 774 775 unsigned i; 775 pjsip_generic_array_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));776 pjsip_generic_array_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_array_hdr); 776 777 777 778 pj_memcpy(hdr, rhs, sizeof(*hdr)); … … 787 788 const pjsip_generic_array_hdr *rhs) 788 789 { 789 pjsip_generic_array_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));790 pjsip_generic_array_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_generic_array_hdr); 790 791 pj_memcpy(hdr, rhs, sizeof(*hdr)); 791 792 return hdr; … … 799 800 void *mem ) 800 801 { 801 pjsip_accept_hdr *hdr = mem;802 pjsip_accept_hdr *hdr = (pjsip_accept_hdr*) mem; 802 803 803 804 PJ_UNUSED_ARG(pool); … … 823 824 void *mem ) 824 825 { 825 pjsip_allow_hdr *hdr = mem;826 pjsip_allow_hdr *hdr = (pjsip_allow_hdr*) mem; 826 827 827 828 PJ_UNUSED_ARG(pool); … … 846 847 void *mem ) 847 848 { 848 pjsip_cid_hdr *hdr = mem;849 pjsip_cid_hdr *hdr = (pjsip_cid_hdr*) mem; 849 850 850 851 PJ_UNUSED_ARG(pool); … … 880 881 void *mem ) 881 882 { 882 pjsip_clen_hdr *hdr = mem;883 pjsip_clen_hdr *hdr = (pjsip_clen_hdr*) mem; 883 884 884 885 PJ_UNUSED_ARG(pool); … … 942 943 void *mem ) 943 944 { 944 pjsip_cseq_hdr *hdr = mem;945 pjsip_cseq_hdr *hdr = (pjsip_cseq_hdr*) mem; 945 946 946 947 PJ_UNUSED_ARG(pool); … … 997 998 const pjsip_cseq_hdr *rhs ) 998 999 { 999 pjsip_cseq_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));1000 pjsip_cseq_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_cseq_hdr); 1000 1001 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1001 1002 return hdr; … … 1021 1022 void *mem ) 1022 1023 { 1023 pjsip_contact_hdr *hdr = mem;1024 pjsip_contact_hdr *hdr = (pjsip_contact_hdr*) mem; 1024 1025 1025 1026 PJ_UNUSED_ARG(pool); … … 1113 1114 return hdr; 1114 1115 1115 hdr->uri = pjsip_uri_clone(pool, rhs->uri);1116 hdr->uri = (pjsip_uri*) pjsip_uri_clone(pool, rhs->uri); 1116 1117 hdr->q1000 = rhs->q1000; 1117 1118 hdr->expires = rhs->expires; … … 1124 1125 const pjsip_contact_hdr *rhs) 1125 1126 { 1126 pjsip_contact_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));1127 pjsip_contact_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_contact_hdr); 1127 1128 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1128 1129 pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); … … 1150 1151 void *mem ) 1151 1152 { 1152 pjsip_ctype_hdr *hdr = mem;1153 pjsip_ctype_hdr *hdr = (pjsip_ctype_hdr*) mem; 1153 1154 1154 1155 PJ_UNUSED_ARG(pool); … … 1228 1229 int value) 1229 1230 { 1230 pjsip_expires_hdr *hdr = mem;1231 pjsip_expires_hdr *hdr = (pjsip_expires_hdr*) mem; 1231 1232 1232 1233 PJ_UNUSED_ARG(pool); … … 1267 1268 void *mem ) 1268 1269 { 1269 pjsip_from_hdr *hdr = mem;1270 pjsip_from_hdr *hdr = (pjsip_from_hdr*) mem; 1270 1271 1271 1272 PJ_UNUSED_ARG(pool); … … 1286 1287 void *mem ) 1287 1288 { 1288 pjsip_to_hdr *hdr = mem;1289 pjsip_to_hdr *hdr = (pjsip_to_hdr*) mem; 1289 1290 1290 1291 PJ_UNUSED_ARG(pool); … … 1355 1356 hdr->name = rhs->name; 1356 1357 hdr->sname = rhs->sname; 1357 hdr->uri = pjsip_uri_clone(pool, rhs->uri);1358 hdr->uri = (pjsip_uri*) pjsip_uri_clone(pool, rhs->uri); 1358 1359 pj_strdup( pool, &hdr->tag, &rhs->tag); 1359 1360 pjsip_param_clone( pool, &hdr->other_param, &rhs->other_param); … … 1366 1367 const pjsip_fromto_hdr *rhs) 1367 1368 { 1368 pjsip_fromto_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));1369 pjsip_fromto_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_fromto_hdr); 1369 1370 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1370 1371 pjsip_param_shallow_clone( pool, &hdr->other_param, &rhs->other_param); … … 1381 1382 int value) 1382 1383 { 1383 pjsip_max_fwd_hdr *hdr = mem;1384 pjsip_max_fwd_hdr *hdr = (pjsip_max_fwd_hdr*) mem; 1384 1385 1385 1386 PJ_UNUSED_ARG(pool); … … 1407 1408 int value ) 1408 1409 { 1409 pjsip_min_expires_hdr *hdr = mem;1410 pjsip_min_expires_hdr *hdr = (pjsip_min_expires_hdr*) mem; 1410 1411 1411 1412 PJ_UNUSED_ARG(pool); … … 1441 1442 void *mem ) 1442 1443 { 1443 pjsip_rr_hdr *hdr = mem;1444 pjsip_rr_hdr *hdr = (pjsip_rr_hdr*) mem; 1444 1445 1445 1446 PJ_UNUSED_ARG(pool); … … 1461 1462 void *mem ) 1462 1463 { 1463 pjsip_route_hdr *hdr = mem;1464 pjsip_route_hdr *hdr = (pjsip_route_hdr*) mem; 1464 1465 1465 1466 PJ_UNUSED_ARG(pool); … … 1521 1522 const pjsip_routing_hdr *rhs ) 1522 1523 { 1523 pjsip_routing_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));1524 pjsip_routing_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_routing_hdr); 1524 1525 1525 1526 init_hdr(hdr, rhs->type, rhs->vptr); … … 1533 1534 const pjsip_routing_hdr *rhs ) 1534 1535 { 1535 pjsip_routing_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));1536 pjsip_routing_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_routing_hdr); 1536 1537 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1537 1538 pjsip_param_shallow_clone( pool, &hdr->other_param, &rhs->other_param); … … 1547 1548 void *mem ) 1548 1549 { 1549 pjsip_require_hdr *hdr = mem;1550 pjsip_require_hdr *hdr = (pjsip_require_hdr*) mem; 1550 1551 1551 1552 PJ_UNUSED_ARG(pool); … … 1570 1571 int value ) 1571 1572 { 1572 pjsip_retry_after_hdr *hdr = mem;1573 pjsip_retry_after_hdr *hdr = (pjsip_retry_after_hdr*) mem; 1573 1574 1574 1575 PJ_UNUSED_ARG(pool); … … 1594 1595 void *mem ) 1595 1596 { 1596 pjsip_supported_hdr *hdr = mem;1597 pjsip_supported_hdr *hdr = (pjsip_supported_hdr*) mem; 1597 1598 1598 1599 PJ_UNUSED_ARG(pool); … … 1616 1617 void *mem ) 1617 1618 { 1618 pjsip_unsupported_hdr *hdr = mem;1619 pjsip_unsupported_hdr *hdr = (pjsip_unsupported_hdr*) mem; 1619 1620 1620 1621 PJ_UNUSED_ARG(pool); … … 1649 1650 void *mem ) 1650 1651 { 1651 pjsip_via_hdr *hdr = mem;1652 pjsip_via_hdr *hdr = (pjsip_via_hdr*) mem; 1652 1653 1653 1654 PJ_UNUSED_ARG(pool); … … 1756 1757 const pjsip_via_hdr *rhs ) 1757 1758 { 1758 pjsip_via_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));1759 pjsip_via_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_via_hdr); 1759 1760 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1760 1761 pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); … … 1774 1775 pj_str_t hvalue; 1775 1776 1776 hvalue.ptr = pj_pool_alloc(pool, 10 + /* code */1777 host->slen + 2 + /* host */1778 text->slen + 2); /* text */1777 hvalue.ptr = (char*) pj_pool_alloc(pool, 10 + /* code */ 1778 host->slen + 2 + /* host */ 1779 text->slen + 2); /* text */ 1779 1780 hvalue.slen = pj_ansi_sprintf(hvalue.ptr, "%u %.*s \"%.*s\"", 1780 1781 code, (int)host->slen, host->ptr, … … 1814 1815 1815 1816 if (len) { 1816 newdata = pj_pool_alloc(pool, len);1817 newdata = (char*) pj_pool_alloc(pool, len); 1817 1818 pj_memcpy(newdata, data, len); 1818 1819 } … … 1856 1857 pj_status_t status; 1857 1858 1858 new_body = pj_pool_alloc(pool, sizeof(pjsip_msg_body));1859 new_body = PJ_POOL_ALLOC_T(pool, pjsip_msg_body); 1859 1860 PJ_ASSERT_RETURN(new_body, NULL); 1860 1861 … … 1874 1875 PJ_ASSERT_RETURN(pool && type && subtype && text, NULL); 1875 1876 1876 body = pj_pool_zalloc(pool, sizeof(pjsip_msg_body));1877 body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body); 1877 1878 PJ_ASSERT_RETURN(body != NULL, NULL); 1878 1879
Note: See TracChangeset
for help on using the changeset viewer.