Module: sip-router Branch: master Commit: ff78f8722f20c68f2614788c55300581819a04b0 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ff78f872...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Thu Aug 26 21:33:45 2010 +0200
tm: warnings and avp param init. fixes
- wrong pointer was passed to pv_get_avp_name(): int instead of unsigned short ( => not the whole int was set and problems on big endian archs). - unneeded pointer casts removed - variables declared at the function start (otherwise older compilers won't work)
---
modules/tm/t_funcs.c | 11 +++++++---- modules/tm/t_msgbuilder.c | 4 ++-- modules/tm/t_reply.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/modules/tm/t_funcs.c b/modules/tm/t_funcs.c index 76bd6d8..13e3952 100644 --- a/modules/tm/t_funcs.c +++ b/modules/tm/t_funcs.c @@ -402,6 +402,7 @@ int init_avp_params(char *fr_timer_param, char *fr_inv_timer_param, char* contacts_avp_param) { pv_spec_t avp_spec; + unsigned short avp_type;
if (fr_timer_param && *fr_timer_param) { fr_timer_str.s = fr_timer_param; @@ -417,12 +418,12 @@ int init_avp_params(char *fr_timer_param, char *fr_inv_timer_param, return -1; }
- if(pv_get_avp_name(0, &avp_spec.pvp, &fr_timer_avp, - (unsigned short*)&fr_timer_avp_type)!=0) + if(pv_get_avp_name(0, &avp_spec.pvp, &fr_timer_avp, &avp_type)!=0) { LM_ERR("[%s]- invalid AVP definition\n", fr_timer_param); return -1; } + fr_timer_avp_type = avp_type; } else { if (parse_avp_spec( &fr_timer_str, &fr_timer_avp_type, &fr_timer_avp, &fr_timer_index)<0) { @@ -448,11 +449,12 @@ int init_avp_params(char *fr_timer_param, char *fr_inv_timer_param, }
if(pv_get_avp_name(0, &avp_spec.pvp, &fr_inv_timer_avp, - (unsigned short*)&fr_inv_timer_avp_type)!=0) + &avp_type)!=0) { LM_ERR("[%s]- invalid AVP definition\n", fr_inv_timer_param); return -1; } + fr_inv_timer_avp_type = avp_type; } else { if (parse_avp_spec( &fr_inv_timer_str, &fr_inv_timer_avp_type, &fr_inv_timer_avp, &fr_inv_timer_index)<0) { @@ -476,10 +478,11 @@ int init_avp_params(char *fr_timer_param, char *fr_inv_timer_param, }
if(pv_get_avp_name(0, &(avp_spec.pvp), &contacts_avp, - (unsigned short*)&contacts_avp_type) != 0) { + &avp_type) != 0) { LM_ERR("invalid AVP definition <%s>\n", contacts_avp_param); return -1; } + contacts_avp_type = avp_type; } else { if (parse_avp_spec( &contacts_avp_str, &contacts_avp_type, &contacts_avp, &contacts_avp_index)<0) { diff --git a/modules/tm/t_msgbuilder.c b/modules/tm/t_msgbuilder.c index b334380..340f99a 100644 --- a/modules/tm/t_msgbuilder.c +++ b/modules/tm/t_msgbuilder.c @@ -808,7 +808,7 @@ static unsigned long nhop_type(sip_msg_t *orig_inv, rte_t *rtset, * equals the address provided by this route; if does -> loose */ DEBUG("checking INVITE's destination against its first route.\n"); URI_PORT(&topr_uri, uri_port); - if (! (dst_port = su_getport((void *)&dst_inv->to))) + if (! (dst_port = su_getport(&dst_inv->to))) return 0; /* not really expected */ if (dst_port != uri_port) return F_RB_NH_STRICT; @@ -821,7 +821,7 @@ static unsigned long nhop_type(sip_msg_t *orig_inv, rte_t *rtset, /* we have an IP address in route -> comparison can go swiftly */ if (init_su(&uri_sau, uri_ia, uri_port) < 0) return 0; /* not really expected */ - if (su_cmp(&uri_sau, (void *)&dst_inv->to)) + if (su_cmp(&uri_sau, &dst_inv->to)) /* ;lr and sent there */ return F_RB_NH_LOOSE; else diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 1a90844..fcf214d 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -1595,6 +1595,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch, /* retransmission structure of outbound reply and request */ struct retr_buf *uas_rb; str* to_tag; + str reason; #ifdef TMCB_ONSEND struct tmcb_params onsend_params; #endif @@ -1605,7 +1606,6 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch, relayed_msg=0; relayed_code=0; totag_retr=0; - str reason;
/* remember, what was sent upstream to know whether we are