Browse code

core and modules: fix compile warnings on freebsd

Daniel-Constantin Mierla authored on 18/10/2011 10:50:49
Showing 22 changed files
... ...
@@ -71,6 +71,7 @@ db_uri_t* db_uri(const char* uri)
71 71
 	char* colon;
72 72
 	int len;
73 73
 	db_uri_t* newp;
74
+	char *turi;
74 75
     
75 76
 	newp = (db_uri_t*)pkg_malloc(sizeof(db_uri_t));
76 77
 	if (newp == NULL) goto error;
... ...
@@ -78,7 +79,8 @@ db_uri_t* db_uri(const char* uri)
78 79
 	if (db_gen_init(&newp->gen) < 0) goto error;	
79 80
 
80 81
 	len = strlen(uri);
81
-	colon = q_memchr((char *)uri, ':', len);
82
+	turi = (char*)uri;
83
+	colon = q_memchr(turi, ':', len);
82 84
 	if (colon == NULL) {
83 85
 		newp->scheme.s = pkg_malloc(len + 1);
84 86
 		if (newp->scheme.s == NULL) goto error;
... ...
@@ -242,9 +242,9 @@ static int time2string( struct timeval* time_value, str* time_str)
242 242
     buffer_length = snprintf( time_buffer,
243 243
                               TIME_BUFFER_LENGTH,
244 244
                               "%ld%c%03d",
245
-                              time_value->tv_sec,
245
+                              (long int)time_value->tv_sec,
246 246
                               time_separator,
247
-                              (int)time_value->tv_usec/1000);
247
+                              (int)(time_value->tv_usec/1000));
248 248
 
249 249
     if( buffer_length < 0)
250 250
     {
... ...
@@ -8,4 +8,5 @@ int bind_dmq(dmq_api_t* api) {
8 8
 	api->send_message = send_dmq_message;
9 9
 	api->bcast_message = bcast_dmq_message;
10 10
 	return 0;
11
-}
12 11
\ No newline at end of file
12
+}
13
+
... ...
@@ -18,4 +18,5 @@ typedef int (*bind_dmq_f)(dmq_api_t* api);
18 18
 
19 19
 int bind_dmq(dmq_api_t* api);
20 20
 
21
-#endif
22 21
\ No newline at end of file
22
+#endif
23
+
... ...
@@ -280,4 +280,5 @@ static int parse_server_address(str* uri, struct sip_uri* parsed_uri) {
280 280
 empty:
281 281
 	uri->s = NULL;
282 282
 	return 0;
283
-}
284 283
\ No newline at end of file
284
+}
285
+
... ...
@@ -49,4 +49,5 @@ static inline int dmq_load_api(dmq_api_t* api) {
49 49
 
50 50
 int handle_dmq_message(struct sip_msg* msg, char* str1 ,char* str2);
51 51
 
52
-#endif
53 52
\ No newline at end of file
53
+#endif
54
+
... ...
@@ -167,3 +167,4 @@ void ping_servers(unsigned int ticks,void *param) {
167 167
 		LM_ERR("error broadcasting message\n");
168 168
 	}
169 169
 }
170
+
... ...
@@ -25,4 +25,5 @@ dmq_peer_t* register_dmq_peer(dmq_peer_t* peer);
25 25
 int send_dmq_message(dmq_peer_t* peer, str* body, dmq_node_t* node, dmq_resp_cback_t* resp_cback, int max_forwards);
26 26
 int bcast_dmq_message(dmq_peer_t* peer, str* body, dmq_node_t* except, dmq_resp_cback_t* resp_cback, int max_forwards);
27 27
 
28
-#endif
29 28
\ No newline at end of file
29
+#endif
30
+
... ...
@@ -246,3 +246,4 @@ int build_node_str(dmq_node_t* node, char* buf, int buflen) {
246 246
 	len += get_status_str(node->status)->len;
247 247
 	return len;
248 248
 }
249
+
... ...
@@ -54,4 +54,5 @@ int build_node_str(dmq_node_t* node, char* buf, int buflen);
54 54
 extern dmq_node_t* self_node;
55 55
 extern dmq_node_t* notification_node;	
56 56
 
57
-#endif
58 57
\ No newline at end of file
58
+#endif
59
+
... ...
@@ -47,4 +47,5 @@ int handle_dmq_message(struct sip_msg* msg, char* str1, char* str2) {
47 47
 	return 0;
48 48
 error:
49 49
 	return -1;
50
-}
51 50
\ No newline at end of file
51
+}
52
+
... ...
@@ -1,2 +1,3 @@
1 1
 
2
-int handle_dmq_message(struct sip_msg*, char*, char*);
3 2
\ No newline at end of file
3
+int handle_dmq_message(struct sip_msg*, char*, char*);
4
+
... ...
@@ -218,3 +218,4 @@ int notification_resp_callback_f(struct sip_msg* msg, int code, dmq_node_t* node
218 218
 	}
219 219
 	return 0;
220 220
 }
221
+
... ...
@@ -23,4 +23,5 @@ dmq_node_t* add_server_and_notify(str* server_address);
23 23
 
24 24
 /* helper functions */
25 25
 extern int notification_resp_callback_f(struct sip_msg* msg, int code, dmq_node_t* node, void* param);
26
-extern dmq_resp_cback_t notification_callback;
27 26
\ No newline at end of file
27
+extern dmq_resp_cback_t notification_callback;
28
+
... ...
@@ -41,4 +41,5 @@ dmq_peer_t* find_peer(str peer_id) {
41 41
 	dmq_peer_t foo_peer;
42 42
 	foo_peer.peer_id = peer_id;
43 43
 	return search_peer_list(peer_list, &foo_peer);
44
-}
45 44
\ No newline at end of file
45
+}
46
+
... ...
@@ -41,4 +41,5 @@ dmq_peer_t* add_peer(dmq_peer_list_t* peer_list, dmq_peer_t* peer);
41 41
 dmq_peer_t* find_peer(str peer_id);
42 42
 
43 43
 
44
-#endif
45 44
\ No newline at end of file
45
+#endif
46
+
... ...
@@ -183,3 +183,4 @@ dmq_job_t* job_queue_pop(job_queue_t* queue) {
183 183
 	lock_release(&queue->lock);
184 184
 	return front;
185 185
 }
186
+
... ...
@@ -40,4 +40,5 @@ void job_queue_push(job_queue_t* queue, dmq_job_t* job);
40 40
 dmq_job_t* job_queue_pop(job_queue_t* queue);
41 41
 int job_queue_size(job_queue_t* queue);
42 42
 
43
-#endif
44 43
\ No newline at end of file
44
+#endif
45
+
... ...
@@ -1626,8 +1626,8 @@ save_keepalive_state(void)
1626 1626
             fprintf(f, "%s %.*s %ld %ld\n",
1627 1627
                     contact->uri,
1628 1628
                     contact->socket->sock_str.len, contact->socket->sock_str.s,
1629
-                    contact->registration_expire,
1630
-                    contact->subscription_expire);
1629
+                    (long int)contact->registration_expire,
1630
+                    (long int)contact->subscription_expire);
1631 1631
             contact = contact->next;
1632 1632
         }
1633 1633
     }
... ...
@@ -458,7 +458,7 @@ int check_handle(db_func_t * dbf, db1_con_t * dbh, ul_db_handle_t * handle){
458 458
 			} else if((handle->db[i].status == DB_ON) && handle->db[i].dbh) {
459 459
 				if((handle->db[i].failover_time < (time(NULL) - expire_time)) && (handle->db[i].failover_time != UL_DB_ZERO_TIME)){
460 460
 					LM_ERR("%s: failover_time: %ld, now: %ld, delta: %ld, now going to reset failover time\n", __FUNCTION__, 
461
-						handle->db[i].failover_time, time(NULL), (time(NULL) - handle->db[i].failover_time));
461
+						(long int)handle->db[i].failover_time, (long int)time(NULL), (long int)(time(NULL) - handle->db[i].failover_time));
462 462
 					if(db_reset_failover_time(handle, handle->db[i].no) < 0) {
463 463
 						LM_ERR("could not reset failover time for id %i, db %i.\n",
464 464
 							handle->id, handle->db[i].no);
... ...
@@ -31,6 +31,8 @@
31 31
  * \ingroup presence_xml
32 32
  */
33 33
 
34
+#include "../../sr_module.h"
35
+
34 36
 /**
35 37
  * make strptime available
36 38
  * use 600 for 'Single UNIX Specification, Version 3'
... ...
@@ -55,7 +57,6 @@
55 57
 #include <stdlib.h>
56 58
 #include <libxml/parser.h>
57 59
 #include "../../dprint.h"
58
-#include "../../sr_module.h"
59 60
 #include "pidf.h"
60 61
 
61 62
 xmlAttrPtr xmlNodeGetAttrByName(xmlNodePtr node, const char *name)
... ...
@@ -42,11 +42,11 @@ int pv_xavp_get_value(struct sip_msg *msg, pv_param_t *param,
42 42
 			return pv_get_strval(msg, param, res, &avp->val.v.s);
43 43
 		break;
44 44
 		case SR_XTYPE_TIME:
45
-			if(snprintf(_pv_xavp_buf, 128, "%lu", avp->val.v.t)<0)
45
+			if(snprintf(_pv_xavp_buf, 128, "%lu", (long unsigned)avp->val.v.t)<0)
46 46
 				return pv_get_null(msg, param, res);
47 47
 		break;
48 48
 		case SR_XTYPE_LONG:
49
-			if(snprintf(_pv_xavp_buf, 128, "%ld", avp->val.v.l)<0)
49
+			if(snprintf(_pv_xavp_buf, 128, "%ld", (long unsigned)avp->val.v.l)<0)
50 50
 				return pv_get_null(msg, param, res);
51 51
 		break;
52 52
 		case SR_XTYPE_LLONG: