tm: warnings and avp param init. fixes
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Thu, 26 Aug 2010 19:33:45 +0000 (21:33 +0200)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Thu, 26 Aug 2010 20:00:01 +0000 (22:00 +0200)
- 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
modules/tm/t_msgbuilder.c
modules/tm/t_reply.c

index 76bd6d8..13e3952 100644 (file)
@@ -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) {
index b334380..340f99a 100644 (file)
@@ -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
index 1a90844..fcf214d 100644 (file)
@@ -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