[sr-dev] git:master: core and modules: fix compile warnings on freebsd

Daniel-Constantin Mierla miconda at gmail.com
Tue Oct 18 12:51:21 CEST 2011


Module: sip-router
Branch: master
Commit: 7dfda822e579a543bbda65dc4764b0f426a144e5
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7dfda822e579a543bbda65dc4764b0f426a144e5

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Oct 18 12:50:49 2011 +0200

core and modules: fix compile warnings on freebsd

---

 lib/srdb2/db_uri.c                      |    4 +++-
 modules_k/acc/acc_cdr.c                 |    4 ++--
 modules_k/dmq/bind_dmq.c                |    3 ++-
 modules_k/dmq/bind_dmq.h                |    3 ++-
 modules_k/dmq/dmq.c                     |    3 ++-
 modules_k/dmq/dmq.h                     |    3 ++-
 modules_k/dmq/dmq_funcs.c               |    1 +
 modules_k/dmq/dmq_funcs.h               |    3 ++-
 modules_k/dmq/dmqnode.c                 |    1 +
 modules_k/dmq/dmqnode.h                 |    3 ++-
 modules_k/dmq/message.c                 |    3 ++-
 modules_k/dmq/message.h                 |    3 ++-
 modules_k/dmq/notification_peer.c       |    1 +
 modules_k/dmq/notification_peer.h       |    3 ++-
 modules_k/dmq/peer.c                    |    3 ++-
 modules_k/dmq/peer.h                    |    3 ++-
 modules_k/dmq/worker.c                  |    1 +
 modules_k/dmq/worker.h                  |    3 ++-
 modules_k/nat_traversal/nat_traversal.c |    4 ++--
 modules_k/p_usrloc/ul_db_handle.c       |    2 +-
 modules_k/presence_xml/pidf.c           |    3 ++-
 modules_k/pv/pv_xavp.c                  |    4 ++--
 22 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/lib/srdb2/db_uri.c b/lib/srdb2/db_uri.c
index e87e8f2..0c37c89 100644
--- a/lib/srdb2/db_uri.c
+++ b/lib/srdb2/db_uri.c
@@ -71,6 +71,7 @@ db_uri_t* db_uri(const char* uri)
 	char* colon;
 	int len;
 	db_uri_t* newp;
+	char *turi;
     
 	newp = (db_uri_t*)pkg_malloc(sizeof(db_uri_t));
 	if (newp == NULL) goto error;
@@ -78,7 +79,8 @@ db_uri_t* db_uri(const char* uri)
 	if (db_gen_init(&newp->gen) < 0) goto error;	
 
 	len = strlen(uri);
-	colon = q_memchr((char *)uri, ':', len);
+	turi = (char*)uri;
+	colon = q_memchr(turi, ':', len);
 	if (colon == NULL) {
 		newp->scheme.s = pkg_malloc(len + 1);
 		if (newp->scheme.s == NULL) goto error;
diff --git a/modules_k/acc/acc_cdr.c b/modules_k/acc/acc_cdr.c
index f4b9348..88d4a22 100644
--- a/modules_k/acc/acc_cdr.c
+++ b/modules_k/acc/acc_cdr.c
@@ -242,9 +242,9 @@ static int time2string( struct timeval* time_value, str* time_str)
     buffer_length = snprintf( time_buffer,
                               TIME_BUFFER_LENGTH,
                               "%ld%c%03d",
-                              time_value->tv_sec,
+                              (long int)time_value->tv_sec,
                               time_separator,
-                              (int)time_value->tv_usec/1000);
+                              (int)(time_value->tv_usec/1000));
 
     if( buffer_length < 0)
     {
diff --git a/modules_k/dmq/bind_dmq.c b/modules_k/dmq/bind_dmq.c
index 88e02ff..472babb 100644
--- a/modules_k/dmq/bind_dmq.c
+++ b/modules_k/dmq/bind_dmq.c
@@ -8,4 +8,5 @@ int bind_dmq(dmq_api_t* api) {
 	api->send_message = send_dmq_message;
 	api->bcast_message = bcast_dmq_message;
 	return 0;
-}
\ No newline at end of file
+}
+
diff --git a/modules_k/dmq/bind_dmq.h b/modules_k/dmq/bind_dmq.h
index f15e673..d89b534 100644
--- a/modules_k/dmq/bind_dmq.h
+++ b/modules_k/dmq/bind_dmq.h
@@ -18,4 +18,5 @@ typedef int (*bind_dmq_f)(dmq_api_t* api);
 
 int bind_dmq(dmq_api_t* api);
 
-#endif
\ No newline at end of file
+#endif
+
diff --git a/modules_k/dmq/dmq.c b/modules_k/dmq/dmq.c
index c8fbff9..7a62302 100644
--- a/modules_k/dmq/dmq.c
+++ b/modules_k/dmq/dmq.c
@@ -280,4 +280,5 @@ static int parse_server_address(str* uri, struct sip_uri* parsed_uri) {
 empty:
 	uri->s = NULL;
 	return 0;
-}
\ No newline at end of file
+}
+
diff --git a/modules_k/dmq/dmq.h b/modules_k/dmq/dmq.h
index e4c639c..df92cea 100644
--- a/modules_k/dmq/dmq.h
+++ b/modules_k/dmq/dmq.h
@@ -49,4 +49,5 @@ static inline int dmq_load_api(dmq_api_t* api) {
 
 int handle_dmq_message(struct sip_msg* msg, char* str1 ,char* str2);
 
-#endif
\ No newline at end of file
+#endif
+
diff --git a/modules_k/dmq/dmq_funcs.c b/modules_k/dmq/dmq_funcs.c
index afb50f4..a71da87 100644
--- a/modules_k/dmq/dmq_funcs.c
+++ b/modules_k/dmq/dmq_funcs.c
@@ -167,3 +167,4 @@ void ping_servers(unsigned int ticks,void *param) {
 		LM_ERR("error broadcasting message\n");
 	}
 }
+
diff --git a/modules_k/dmq/dmq_funcs.h b/modules_k/dmq/dmq_funcs.h
index 8ba2503..1c6dd91 100644
--- a/modules_k/dmq/dmq_funcs.h
+++ b/modules_k/dmq/dmq_funcs.h
@@ -25,4 +25,5 @@ dmq_peer_t* register_dmq_peer(dmq_peer_t* peer);
 int send_dmq_message(dmq_peer_t* peer, str* body, dmq_node_t* node, dmq_resp_cback_t* resp_cback, int max_forwards);
 int bcast_dmq_message(dmq_peer_t* peer, str* body, dmq_node_t* except, dmq_resp_cback_t* resp_cback, int max_forwards);
 
-#endif
\ No newline at end of file
+#endif
+
diff --git a/modules_k/dmq/dmqnode.c b/modules_k/dmq/dmqnode.c
index d567a34..36971e9 100644
--- a/modules_k/dmq/dmqnode.c
+++ b/modules_k/dmq/dmqnode.c
@@ -246,3 +246,4 @@ int build_node_str(dmq_node_t* node, char* buf, int buflen) {
 	len += get_status_str(node->status)->len;
 	return len;
 }
+
diff --git a/modules_k/dmq/dmqnode.h b/modules_k/dmq/dmqnode.h
index e2c2437..43b4820 100644
--- a/modules_k/dmq/dmqnode.h
+++ b/modules_k/dmq/dmqnode.h
@@ -54,4 +54,5 @@ int build_node_str(dmq_node_t* node, char* buf, int buflen);
 extern dmq_node_t* self_node;
 extern dmq_node_t* notification_node;	
 
-#endif
\ No newline at end of file
+#endif
+
diff --git a/modules_k/dmq/message.c b/modules_k/dmq/message.c
index 434f80d..3971ab5 100644
--- a/modules_k/dmq/message.c
+++ b/modules_k/dmq/message.c
@@ -47,4 +47,5 @@ int handle_dmq_message(struct sip_msg* msg, char* str1, char* str2) {
 	return 0;
 error:
 	return -1;
-}
\ No newline at end of file
+}
+
diff --git a/modules_k/dmq/message.h b/modules_k/dmq/message.h
index 7e0cb95..e9a01a7 100644
--- a/modules_k/dmq/message.h
+++ b/modules_k/dmq/message.h
@@ -1,2 +1,3 @@
 
-int handle_dmq_message(struct sip_msg*, char*, char*);
\ No newline at end of file
+int handle_dmq_message(struct sip_msg*, char*, char*);
+
diff --git a/modules_k/dmq/notification_peer.c b/modules_k/dmq/notification_peer.c
index ea12dd8..a6d134b 100644
--- a/modules_k/dmq/notification_peer.c
+++ b/modules_k/dmq/notification_peer.c
@@ -218,3 +218,4 @@ int notification_resp_callback_f(struct sip_msg* msg, int code, dmq_node_t* node
 	}
 	return 0;
 }
+
diff --git a/modules_k/dmq/notification_peer.h b/modules_k/dmq/notification_peer.h
index 78cf190..001b530 100644
--- a/modules_k/dmq/notification_peer.h
+++ b/modules_k/dmq/notification_peer.h
@@ -23,4 +23,5 @@ dmq_node_t* add_server_and_notify(str* server_address);
 
 /* helper functions */
 extern int notification_resp_callback_f(struct sip_msg* msg, int code, dmq_node_t* node, void* param);
-extern dmq_resp_cback_t notification_callback;
\ No newline at end of file
+extern dmq_resp_cback_t notification_callback;
+
diff --git a/modules_k/dmq/peer.c b/modules_k/dmq/peer.c
index 39ae836..588445f 100644
--- a/modules_k/dmq/peer.c
+++ b/modules_k/dmq/peer.c
@@ -41,4 +41,5 @@ dmq_peer_t* find_peer(str peer_id) {
 	dmq_peer_t foo_peer;
 	foo_peer.peer_id = peer_id;
 	return search_peer_list(peer_list, &foo_peer);
-}
\ No newline at end of file
+}
+
diff --git a/modules_k/dmq/peer.h b/modules_k/dmq/peer.h
index 0d543bd..b2ec9a2 100644
--- a/modules_k/dmq/peer.h
+++ b/modules_k/dmq/peer.h
@@ -41,4 +41,5 @@ dmq_peer_t* add_peer(dmq_peer_list_t* peer_list, dmq_peer_t* peer);
 dmq_peer_t* find_peer(str peer_id);
 
 
-#endif
\ No newline at end of file
+#endif
+
diff --git a/modules_k/dmq/worker.c b/modules_k/dmq/worker.c
index fbf5443..9da3b9f 100644
--- a/modules_k/dmq/worker.c
+++ b/modules_k/dmq/worker.c
@@ -183,3 +183,4 @@ dmq_job_t* job_queue_pop(job_queue_t* queue) {
 	lock_release(&queue->lock);
 	return front;
 }
+
diff --git a/modules_k/dmq/worker.h b/modules_k/dmq/worker.h
index 61eda09..d6f8dbd 100644
--- a/modules_k/dmq/worker.h
+++ b/modules_k/dmq/worker.h
@@ -40,4 +40,5 @@ void job_queue_push(job_queue_t* queue, dmq_job_t* job);
 dmq_job_t* job_queue_pop(job_queue_t* queue);
 int job_queue_size(job_queue_t* queue);
 
-#endif
\ No newline at end of file
+#endif
+
diff --git a/modules_k/nat_traversal/nat_traversal.c b/modules_k/nat_traversal/nat_traversal.c
index 62227e4..9877766 100644
--- a/modules_k/nat_traversal/nat_traversal.c
+++ b/modules_k/nat_traversal/nat_traversal.c
@@ -1626,8 +1626,8 @@ save_keepalive_state(void)
             fprintf(f, "%s %.*s %ld %ld\n",
                     contact->uri,
                     contact->socket->sock_str.len, contact->socket->sock_str.s,
-                    contact->registration_expire,
-                    contact->subscription_expire);
+                    (long int)contact->registration_expire,
+                    (long int)contact->subscription_expire);
             contact = contact->next;
         }
     }
diff --git a/modules_k/p_usrloc/ul_db_handle.c b/modules_k/p_usrloc/ul_db_handle.c
index 3216426..49dc464 100644
--- a/modules_k/p_usrloc/ul_db_handle.c
+++ b/modules_k/p_usrloc/ul_db_handle.c
@@ -458,7 +458,7 @@ int check_handle(db_func_t * dbf, db1_con_t * dbh, ul_db_handle_t * handle){
 			} else if((handle->db[i].status == DB_ON) && handle->db[i].dbh) {
 				if((handle->db[i].failover_time < (time(NULL) - expire_time)) && (handle->db[i].failover_time != UL_DB_ZERO_TIME)){
 					LM_ERR("%s: failover_time: %ld, now: %ld, delta: %ld, now going to reset failover time\n", __FUNCTION__, 
-						handle->db[i].failover_time, time(NULL), (time(NULL) - handle->db[i].failover_time));
+						(long int)handle->db[i].failover_time, (long int)time(NULL), (long int)(time(NULL) - handle->db[i].failover_time));
 					if(db_reset_failover_time(handle, handle->db[i].no) < 0) {
 						LM_ERR("could not reset failover time for id %i, db %i.\n",
 							handle->id, handle->db[i].no);
diff --git a/modules_k/presence_xml/pidf.c b/modules_k/presence_xml/pidf.c
index 95b0a47..822ebea 100644
--- a/modules_k/presence_xml/pidf.c
+++ b/modules_k/presence_xml/pidf.c
@@ -31,6 +31,8 @@
  * \ingroup presence_xml
  */
 
+#include "../../sr_module.h"
+
 /**
  * make strptime available
  * use 600 for 'Single UNIX Specification, Version 3'
@@ -55,7 +57,6 @@
 #include <stdlib.h>
 #include <libxml/parser.h>
 #include "../../dprint.h"
-#include "../../sr_module.h"
 #include "pidf.h"
 
 xmlAttrPtr xmlNodeGetAttrByName(xmlNodePtr node, const char *name)
diff --git a/modules_k/pv/pv_xavp.c b/modules_k/pv/pv_xavp.c
index e706d04..b434794 100644
--- a/modules_k/pv/pv_xavp.c
+++ b/modules_k/pv/pv_xavp.c
@@ -42,11 +42,11 @@ int pv_xavp_get_value(struct sip_msg *msg, pv_param_t *param,
 			return pv_get_strval(msg, param, res, &avp->val.v.s);
 		break;
 		case SR_XTYPE_TIME:
-			if(snprintf(_pv_xavp_buf, 128, "%lu", avp->val.v.t)<0)
+			if(snprintf(_pv_xavp_buf, 128, "%lu", (long unsigned)avp->val.v.t)<0)
 				return pv_get_null(msg, param, res);
 		break;
 		case SR_XTYPE_LONG:
-			if(snprintf(_pv_xavp_buf, 128, "%ld", avp->val.v.l)<0)
+			if(snprintf(_pv_xavp_buf, 128, "%ld", (long unsigned)avp->val.v.l)<0)
 				return pv_get_null(msg, param, res);
 		break;
 		case SR_XTYPE_LLONG:




More information about the sr-dev mailing list