- Timestamp:
- Aug 1, 2010 9:26:34 AM (14 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip/sip_uri.h
r2394 r3242 67 67 * @return The parameter if found, or NULL. 68 68 */ 69 PJ_DECL(pjsip_param*) pjsip_param_find( pjsip_param *param_list,69 PJ_DECL(pjsip_param*) pjsip_param_find( const pjsip_param *param_list, 70 70 const pj_str_t *name ); 71 71 72 72 73 73 /** 74 * Find the specified parameter name in the list. The name will be compared 75 * in case-insensitive comparison. 76 * 77 * @param param_list List of parameters to find. 78 * @param name Parameter/header name to find. 79 * 80 * @return The parameter if found, or NULL. 81 */ 82 PJ_DECL(const pjsip_param*) pjsip_param_cfind(const pjsip_param *param_list, 83 const pj_str_t *name ); 84 74 * Alias for pjsip_param_find() 75 */ 76 PJ_INLINE(pjsip_param*) pjsip_param_cfind(const pjsip_param *param_list, 77 const pj_str_t *name) 78 { 79 return pjsip_param_find(param_list, name); 80 } 81 82 /** 83 * Compare two parameter lists. 84 * 85 * @param param_list1 First parameter list. 86 * @param param_list2 Second parameter list. 87 * @param ig_nf If set to 1, do not compare parameters that only 88 * appear in one of the list. 89 * 90 * @return Zero if the parameter list are equal, non-zero 91 * otherwise. 92 */ 93 PJ_DECL(int) pjsip_param_cmp(const pjsip_param *param_list1, 94 const pjsip_param *param_list2, 95 pj_bool_t ig_nf); 85 96 86 97 /** -
pjproject/trunk/pjsip/src/pjsip/sip_uri.c
r3070 r3242 31 31 * Generic parameter manipulation. 32 32 */ 33 PJ_DEF(pjsip_param*) pjsip_param_find( pjsip_param *param_list,33 PJ_DEF(pjsip_param*) pjsip_param_find( const pjsip_param *param_list, 34 34 const pj_str_t *name ) 35 35 { 36 pjsip_param *p = param_list->next;36 pjsip_param *p = (pjsip_param*)param_list->next; 37 37 while (p != param_list) { 38 38 if (pj_stricmp(&p->name, name)==0) … … 43 43 } 44 44 45 PJ_DEF(const pjsip_param*) pjsip_param_cfind( const pjsip_param *param_list, 46 const pj_str_t *name ) 47 { 48 const pjsip_param *p = param_list->next; 49 while (p != param_list) { 50 if (pj_stricmp_alnum(&p->name, name)==0) 51 return p; 52 p = p->next; 53 } 54 return NULL; 45 PJ_DEF(int) pjsip_param_cmp( const pjsip_param *param_list1, 46 const pjsip_param *param_list2, 47 pj_bool_t ig_nf) 48 { 49 const pjsip_param *p1; 50 51 if ((ig_nf & 1)==0 && pj_list_size(param_list1)!=pj_list_size(param_list2)) 52 return 1; 53 54 p1 = param_list1->next; 55 while (p1 != param_list1) { 56 const pjsip_param *p2; 57 p2 = pjsip_param_find(param_list2, &p1->name); 58 if (p2 ) { 59 int rc = pj_stricmp(&p1->value, &p2->value); 60 if (rc != 0) 61 return rc; 62 } else if ((ig_nf & 1)==0) 63 return 1; 64 65 p1 = p1->next; 66 } 67 68 return 0; 55 69 } 56 70 … … 61 75 62 76 pj_list_init(dst_list); 63 while (p != src_list) {77 while (p && p != src_list) { 64 78 pjsip_param *new_param = PJ_POOL_ALLOC_T(pool, pjsip_param); 65 79 pj_strdup(pool, &new_param->name, &p->name); … … 99 113 100 114 p = param_list->next; 101 if (p == param_list)115 if (p == NULL || p == param_list) 102 116 return 0; 103 117 … … 456 470 * comparing the URIs. 457 471 */ 458 p1 = url1->other_param.next; 459 while (p1 != &url1->other_param) { 460 const pjsip_param *p2; 461 p2 = pjsip_param_cfind(&url2->other_param, &p1->name); 462 if (p2 ) { 463 if (pj_stricmp(&p1->value, &p2->value) != 0) 464 return PJSIP_ECMPOTHERPARAM; 465 } 466 467 p1 = p1->next; 468 } 472 if (pjsip_param_cmp(&url1->other_param, &url2->other_param, 1)!=0) 473 return PJSIP_ECMPOTHERPARAM; 469 474 470 475 /* URI header components are never ignored. Any present header component … … 475 480 while (p1 != &url1->header_param) { 476 481 const pjsip_param *p2; 477 p2 = pjsip_param_ cfind(&url2->header_param, &p1->name);482 p2 = pjsip_param_find(&url2->header_param, &p1->name); 478 483 if (p2) { 479 484 /* It seems too much to compare two header params according to
Note: See TracChangeset
for help on using the changeset viewer.