Changeset 266 for pjproject/trunk/pjsip/src/pjsip/sip_msg.c
- Timestamp:
- Mar 2, 2006 9:16:00 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_msg.c
r212 r266 1759 1759 } 1760 1760 1761 PJ_DEF(pj_status_t) pjsip_msg_body_c lone( pj_pool_t *pool,1762 1763 1761 PJ_DEF(pj_status_t) pjsip_msg_body_copy( pj_pool_t *pool, 1762 pjsip_msg_body *dst_body, 1763 const pjsip_msg_body *src_body ) 1764 1764 { 1765 1765 /* First check if clone_data field is initialized. */ … … 1788 1788 } 1789 1789 1790 1791 PJ_DEF(pjsip_msg_body*) pjsip_msg_body_clone( pj_pool_t *pool, 1792 const pjsip_msg_body *body ) 1793 { 1794 pjsip_msg_body *new_body; 1795 pj_status_t status; 1796 1797 new_body = pj_pool_alloc(pool, sizeof(pjsip_msg_body)); 1798 PJ_ASSERT_RETURN(new_body, NULL); 1799 1800 status = pjsip_msg_body_copy(pool, new_body, body); 1801 1802 return (status==PJ_SUCCESS) ? new_body : NULL; 1803 } 1804 1805 1806 PJ_DEF(pjsip_msg_body*) pjsip_msg_body_create( pj_pool_t *pool, 1807 const pj_str_t *type, 1808 const pj_str_t *subtype, 1809 const pj_str_t *text ) 1810 { 1811 pjsip_msg_body *body; 1812 1813 PJ_ASSERT_RETURN(pool && type && subtype && text, NULL); 1814 1815 body = pj_pool_zalloc(pool, sizeof(pjsip_msg_body)); 1816 PJ_ASSERT_RETURN(body != NULL, NULL); 1817 1818 pj_strdup(pool, &body->content_type.type, type); 1819 pj_strdup(pool, &body->content_type.subtype, subtype); 1820 body->content_type.param.slen = 0; 1821 1822 body->data = pj_pool_alloc(pool, text->slen); 1823 pj_memcpy(body->data, text->ptr, text->slen); 1824 body->len = text->slen; 1825 1826 body->clone_data = &pjsip_clone_text_data; 1827 body->print_body = &pjsip_print_text_body; 1828 1829 return body; 1830 } 1831
Note: See TracChangeset
for help on using the changeset viewer.