Ignore:
Timestamp:
Nov 21, 2005 1:55:47 AM (18 years ago)
Author:
bennylp
Message:

Set svn:eol-style property

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_msg.c

    • Property svn:eol-style set to native
    r51 r65  
    869869    init_hdr(hdr, PJSIP_H_CONTACT, &contact_hdr_vptr); 
    870870    hdr->expires = -1; 
     871    pj_list_init(&hdr->other_param); 
    871872    return hdr; 
    872873} 
     
    884885        *p++ = ' '; 
    885886        *p++ = '*'; 
    886         *p = '\0'; 
    887887        return p - buf; 
    888888 
     
    928928        } 
    929929 
    930         if (hdr->other_param.slen) { 
    931             copy_advance(buf, hdr->other_param); 
    932         } 
    933  
    934         *buf = '\0'; 
     930        printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf,';'); 
     931        if (printed < 0) 
     932            return printed; 
     933        buf += printed; 
     934 
    935935        return buf-startbuf; 
    936936    } 
    937937} 
    938938 
    939 static pjsip_contact_hdr* pjsip_contact_hdr_clone( pj_pool_t *pool,  
    940                                                    const pjsip_contact_hdr *rhs) 
     939static pjsip_contact_hdr* pjsip_contact_hdr_clone(pj_pool_t *pool,  
     940                                                  const pjsip_contact_hdr *rhs) 
    941941{ 
    942942    pjsip_contact_hdr *hdr = pjsip_contact_hdr_create(pool); 
     
    949949    hdr->q1000 = rhs->q1000; 
    950950    hdr->expires = rhs->expires; 
    951     pj_strdup(pool, &hdr->other_param, &rhs->other_param); 
    952     return hdr; 
    953 } 
    954  
    955 static pjsip_contact_hdr* pjsip_contact_hdr_shallow_clone( pj_pool_t *pool, 
    956                                                            const pjsip_contact_hdr *rhs) 
     951    pjsip_param_clone(pool, &hdr->other_param, &rhs->other_param); 
     952    return hdr; 
     953} 
     954 
     955static pjsip_contact_hdr*  
     956pjsip_contact_hdr_shallow_clone( pj_pool_t *pool, 
     957                                 const pjsip_contact_hdr *rhs) 
    957958{ 
    958959    pjsip_contact_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 
    959960    pj_memcpy(hdr, rhs, sizeof(*hdr)); 
     961    pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); 
    960962    return hdr; 
    961963} 
     
    965967 * Content-Type header.. 
    966968 */ 
    967 static int pjsip_ctype_hdr_print( pjsip_ctype_hdr *hdr, char *buf, pj_size_t size); 
    968 static pjsip_ctype_hdr* pjsip_ctype_hdr_clone( pj_pool_t *pool, const pjsip_ctype_hdr *hdr); 
     969static int pjsip_ctype_hdr_print( pjsip_ctype_hdr *hdr, char *buf,  
     970                                  pj_size_t size); 
     971static pjsip_ctype_hdr* pjsip_ctype_hdr_clone(pj_pool_t *pool,  
     972                                              const pjsip_ctype_hdr *hdr); 
    969973#define pjsip_ctype_hdr_shallow_clone pjsip_ctype_hdr_clone 
    970974 
     
    10711075    pjsip_from_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 
    10721076    init_hdr(hdr, PJSIP_H_FROM, &fromto_hdr_vptr); 
     1077    pj_list_init(&hdr->other_param); 
    10731078    return hdr; 
    10741079} 
     
    10781083    pjsip_to_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 
    10791084    init_hdr(hdr, PJSIP_H_TO, &fromto_hdr_vptr); 
     1085    pj_list_init(&hdr->other_param); 
    10801086    return hdr; 
    10811087} 
     
    11061112    *buf++ = ' '; 
    11071113 
    1108     printed = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, hdr->uri, buf, endbuf-buf); 
     1114    printed = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, hdr->uri,  
     1115                              buf, endbuf-buf); 
    11091116    if (printed < 1) 
    11101117        return -1; 
     
    11131120 
    11141121    copy_advance_pair(buf, ";tag=", 5, hdr->tag); 
    1115     if (hdr->other_param.slen) 
    1116         copy_advance(buf, hdr->other_param); 
     1122 
     1123    printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, ';'); 
     1124    if (printed < 0) 
     1125        return -1; 
     1126    buf += printed; 
    11171127 
    11181128    return buf-startbuf; 
     
    11291139    hdr->uri = pjsip_uri_clone(pool, rhs->uri); 
    11301140    pj_strdup( pool, &hdr->tag, &rhs->tag); 
    1131     pj_strdup( pool, &hdr->other_param, &rhs->other_param); 
    1132  
    1133     return hdr; 
    1134 } 
    1135  
    1136 static pjsip_fromto_hdr* pjsip_fromto_hdr_shallow_clone( pj_pool_t *pool, 
    1137                                                          const pjsip_fromto_hdr *rhs) 
     1141    pjsip_param_clone( pool, &hdr->other_param, &rhs->other_param); 
     1142 
     1143    return hdr; 
     1144} 
     1145 
     1146static pjsip_fromto_hdr*  
     1147pjsip_fromto_hdr_shallow_clone( pj_pool_t *pool, 
     1148                                const pjsip_fromto_hdr *rhs) 
    11381149{ 
    11391150    pjsip_fromto_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 
    11401151    pj_memcpy(hdr, rhs, sizeof(*hdr)); 
     1152    pjsip_param_shallow_clone( pool, &hdr->other_param, &rhs->other_param); 
    11411153    return hdr; 
    11421154} 
     
    11881200    init_hdr(hdr, PJSIP_H_RECORD_ROUTE, &routing_hdr_vptr); 
    11891201    pjsip_name_addr_init(&hdr->name_addr); 
    1190     pj_memset(&hdr->other_param, 0, sizeof(hdr->other_param)); 
     1202    pj_list_init(&hdr->other_param); 
    11911203    return hdr; 
    11921204} 
     
    11971209    init_hdr(hdr, PJSIP_H_ROUTE, &routing_hdr_vptr); 
    11981210    pjsip_name_addr_init(&hdr->name_addr); 
    1199     pj_memset(&hdr->other_param, 0, sizeof(hdr->other_param)); 
     1211    pj_list_init(&hdr->other_param); 
    12001212    return hdr; 
    12011213} 
     
    12261238    *buf++ = ' '; 
    12271239 
    1228     printed = pjsip_uri_print(PJSIP_URI_IN_ROUTING_HDR, &hdr->name_addr, buf, endbuf-buf); 
     1240    printed = pjsip_uri_print(PJSIP_URI_IN_ROUTING_HDR, &hdr->name_addr, buf,  
     1241                              endbuf-buf); 
    12291242    if (printed < 1) 
    12301243        return -1; 
    12311244    buf += printed; 
    12321245 
    1233     if (hdr->other_param.slen) { 
    1234         copy_advance(buf, hdr->other_param); 
    1235     } 
     1246    printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, ';'); 
     1247    if (printed < 0) 
     1248        return -1; 
     1249    buf += printed; 
    12361250 
    12371251    return buf-startbuf; 
     
    12461260    pjsip_name_addr_init(&hdr->name_addr); 
    12471261    pjsip_name_addr_assign(pool, &hdr->name_addr, &rhs->name_addr); 
    1248     pj_strdup( pool, &hdr->other_param, &rhs->other_param); 
     1262    pjsip_param_clone( pool, &hdr->other_param, &rhs->other_param); 
    12491263    return hdr; 
    12501264} 
     
    12551269    pjsip_routing_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 
    12561270    pj_memcpy(hdr, rhs, sizeof(*hdr)); 
     1271    pjsip_param_shallow_clone( pool, &hdr->other_param, &rhs->other_param); 
    12571272    return hdr; 
    12581273} 
     
    13311346    hdr->ttl_param = -1; 
    13321347    hdr->rport_param = -1; 
     1348    pj_list_init(&hdr->other_param); 
    13331349    return hdr; 
    13341350} 
     
    13901406    copy_advance_pair(buf, ";received=", 10, hdr->recvd_param); 
    13911407    copy_advance_pair(buf, ";branch=", 8, hdr->branch_param); 
    1392     copy_advance(buf, hdr->other_param); 
    13931408     
    1394     *buf = '\0'; 
     1409    printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, ';'); 
     1410    if (printed < 0) 
     1411        return -1; 
     1412    buf += printed; 
     1413     
    13951414    return buf-startbuf; 
    13961415} 
     
    14081427    pj_strdup(pool, &hdr->recvd_param, &rhs->recvd_param); 
    14091428    pj_strdup(pool, &hdr->branch_param, &rhs->branch_param); 
    1410     pj_strdup(pool, &hdr->other_param, &rhs->other_param); 
     1429    pjsip_param_clone(pool, &hdr->other_param, &rhs->other_param); 
    14111430    return hdr; 
    14121431} 
     
    14171436    pjsip_via_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 
    14181437    pj_memcpy(hdr, rhs, sizeof(*hdr)); 
     1438    pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); 
    14191439    return hdr; 
    14201440} 
Note: See TracChangeset for help on using the changeset viewer.