Browse code

fixed several warning and incomplete initializers

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@1808 689a6050-402a-0410-94f2-e92a70836424

Bogdan-Andrei Iancu authored on 10/03/2007 17:36:19
Showing 25 changed files
... ...
@@ -110,15 +110,15 @@ static stat_export_t mod_stats[] = {
110 110
 
111 111
 static mi_export_t mi_cmds[] = {
112 112
 	{ "dlg_list",  mi_print_dlgs,   MI_NO_INPUT_FLAG,  0,  0},
113
-	{ 0, 0, 0, 0}
113
+	{ 0, 0, 0, 0, 0}
114 114
 };
115 115
 
116 116
 
117 117
 static item_export_t mod_items[] = {
118
-	{ "DLG_count",    it_get_dlg_count,    100, {{0, 0}, 0} },
119
-	{ "DLG_lifetime", it_get_dlg_lifetime, 100, {{0, 0}, 0} },
120
-	{ "DLG_status",   it_get_dlg_status  , 100, {{0, 0}, 0} },
121
-	{ 0, 0, 0, {{0, 0}, 0} }
118
+	{ "DLG_count",    it_get_dlg_count,    100, {{0, 0}, 0, 0} },
119
+	{ "DLG_lifetime", it_get_dlg_lifetime, 100, {{0, 0}, 0, 0} },
120
+	{ "DLG_status",   it_get_dlg_status  , 100, {{0, 0}, 0, 0} },
121
+	{ 0, 0, 0, {{0, 0}, 0, 0} }
122 122
 };
123 123
 
124 124
 struct module_exports exports= {
... ...
@@ -172,7 +172,7 @@ static int it_get_dlg_count(struct sip_msg *msg, xl_value_t *res,
172 172
 
173 173
 static int mod_init(void)
174 174
 {
175
-	int n;
175
+	unsigned int n;
176 176
 
177 177
 	LOG(L_INFO,"Dialog module - initializing\n");
178 178
 
... ...
@@ -49,8 +49,8 @@ static struct dlg_table *d_table = 0;
49 49
 
50 50
 int init_dlg_table(unsigned int size)
51 51
 {
52
-	int n;
53
-	int i;
52
+	unsigned int n;
53
+	unsigned int i;
54 54
 
55 55
 	d_table = (struct dlg_table*)shm_malloc
56 56
 		( sizeof(struct dlg_table) + size*sizeof(struct dlg_entry));
... ...
@@ -111,7 +111,7 @@ static inline void destroy_dlg(struct dlg_cell *dlg)
111 111
 void destroy_dlg_table()
112 112
 {
113 113
 	struct dlg_cell *dlg, *l_dlg;
114
-	int i;
114
+	unsigned int i;
115 115
 
116 116
 	if (d_table==0)
117 117
 		return;
... ...
@@ -436,7 +436,8 @@ struct mi_root * mi_print_dlgs(struct mi_root *cmd_tree, void *param )
436 436
 	struct mi_node* rpl = NULL, *node= NULL;
437 437
 	struct mi_attr* attr= NULL;
438 438
 	struct mi_root* rpl_tree= NULL;
439
-	int i, len;
439
+	unsigned int i;
440
+	int len;
440 441
 	char* p;
441 442
 
442 443
 	rpl_tree = init_mi_tree( 200, MI_OK_S, MI_OK_LEN);
... ...
@@ -169,7 +169,7 @@ int update_dlg_timer( struct dlg_tl *tl, int timeout )
169 169
 
170 170
 
171 171
 
172
-static inline struct dlg_tl* get_expired_dlgs(int time)
172
+static inline struct dlg_tl* get_expired_dlgs(unsigned int time)
173 173
 {
174 174
 	struct dlg_tl *tl , *end, *ret;
175 175
 
... ...
@@ -107,7 +107,7 @@ static param_export_t params[]={
107 107
 static mi_export_t mi_cmds[] = {
108 108
 	{ "ds_set_state",   ds_mi_set,   0,                 0,  0 },
109 109
 	{ "ds_list",        ds_mi_list,  MI_NO_INPUT_FLAG,  0,  0 },
110
-	{ 0, 0, 0, 0}
110
+	{ 0, 0, 0, 0, 0}
111 111
 };
112 112
 
113 113
 
... ...
@@ -128,7 +128,7 @@ static inline int add_diversion_helper(struct sip_msg* msg, str* s)
128 128
 	char *ptr;
129 129
 
130 130
 	static struct lump* anchor = 0;
131
-	static int msg_id = 0;
131
+	static unsigned int msg_id = 0;
132 132
 
133 133
 	if (msg_id != msg->id) {
134 134
 		msg_id = msg->id;
... ...
@@ -117,7 +117,7 @@ static param_export_t params[] = {
117 117
 static mi_export_t mi_cmds[] = {
118 118
 	{ MI_DOMAIN_RELOAD, mi_domain_reload, MI_NO_INPUT_FLAG, 0, mi_child_init },
119 119
 	{ MI_DOMAIN_DUMP,   mi_domain_dump,   MI_NO_INPUT_FLAG, 0, 0             },
120
-	{ 0, 0, 0, 0}
120
+	{ 0, 0, 0, 0, 0}
121 121
 };
122 122
 
123 123
 
... ...
@@ -93,7 +93,7 @@ static param_export_t params[] = {
93 93
  */
94 94
 static mi_export_t mi_cmds[] = {
95 95
 	{ MI_FLAT_ROTATE, mi_flat_rotate_cmd,   MI_NO_INPUT_FLAG,  0,  0 },
96
-	{ 0, 0, 0, 0}
96
+	{ 0, 0, 0, 0, 0}
97 97
 };
98 98
 
99 99
 struct module_exports exports = {
... ...
@@ -100,7 +100,7 @@ static mi_export_t mi_cmds[] = {
100 100
 	{ FIFO_RESET_GFLAG, mi_reset_gflag, 0,                 0,  0 },
101 101
 	{ FIFO_IS_GFLAG,    mi_is_gflag,    0,                 0,  0 },
102 102
 	{ FIFO_GET_GFLAGS,  mi_get_gflags,  MI_NO_INPUT_FLAG,  0,  0 },
103
-	{ 0, 0, 0, 0}
103
+	{ 0, 0, 0, 0, 0}
104 104
 };
105 105
 
106 106
 struct module_exports exports = {
... ...
@@ -118,7 +118,7 @@ stat_export_t imc_stats[] = {
118 118
 static mi_export_t mi_cmds[] = {
119 119
 	{ "imc_list_rooms",    imc_mi_list_rooms,    MI_NO_INPUT_FLAG,  0,  0 },
120 120
 	{ "imc_list_members",  imc_mi_list_members,  0,                 0,  0 },
121
-	{ 0, 0, 0, 0}
121
+	{ 0, 0, 0, 0, 0}
122 122
 };
123 123
 
124 124
 
... ...
@@ -292,7 +292,7 @@ static param_export_t params[] = {
292 292
 static mi_export_t mi_cmds[] = {
293 293
 	{ MI_LCR_RELOAD,  mi_lcr_reload,   MI_NO_INPUT_FLAG,  0,  mi_child_init },
294 294
 	{ MI_LCR_DUMP,    mi_lcr_dump,     MI_NO_INPUT_FLAG,  0,  0 },
295
-	{ 0, 0, 0, 0}
295
+	{ 0, 0, 0, 0, 0}
296 296
 };
297 297
 
298 298
 
... ...
@@ -305,7 +305,7 @@ struct rtpp_node {
305 305
 	int			rn_fd;		/* control fd */
306 306
 	int			rn_disabled;	/* found unaccessible? */
307 307
 	unsigned		rn_weight;	/* for load balancing */
308
-	int			rn_recheck_ticks;
308
+	unsigned int	rn_recheck_ticks;
309 309
 	struct rtpp_node	*rn_next;
310 310
 };
311 311
 
... ...
@@ -57,7 +57,7 @@ static int opt_reply(struct sip_msg* _msg, char* _foo, char* _bar);
57 57
  */
58 58
 static cmd_export_t cmds[] = {
59 59
 	{"options_reply", (cmd_function)opt_reply, 0, 0, REQUEST_ROUTE},
60
-	{0, 0, 0, 0}
60
+	{0, 0, 0, 0, 0}
61 61
 };
62 62
 
63 63
 /*
... ...
@@ -167,7 +167,7 @@ pd_t** init_hash_entries(unsigned int hash_size)
167 167
 }
168 168
 void free_hash_entries(pd_t** hash, unsigned int hash_size)
169 169
 {
170
-    int   i;
170
+    unsigned int   i;
171 171
     pd_t *tmp, *it;
172 172
     if(hash==NULL || hash_size<=0)
173 173
 		return;
... ...
@@ -691,7 +691,7 @@ str* pdt_get_prefix(hash_list_t *hl, str*sdomain, str* sd)
691 691
 
692 692
 int check_pd(hash_t *ph, str *sp, str *sd)
693 693
 {
694
-	int i;
694
+	unsigned int i;
695 695
 	unsigned int dhash;
696 696
 	pd_t* it;
697 697
 	
... ...
@@ -759,7 +759,7 @@ int pdt_check_pd(hash_list_t *hl, str* sdomain, str *sp, str *sd)
759 759
 
760 760
 void pdt_print_hash_list(hash_list_t* hl)
761 761
 {
762
-	int i, count;
762
+	unsigned int i, count;
763 763
 	pd_t *it;
764 764
 	hash_t *hash;
765 765
 	
... ...
@@ -127,7 +127,7 @@ static mi_export_t mi_cmds[] = {
127 127
 	{ "pdt_add",     pdt_mi_add,     0,  0,  child_init },
128 128
 	{ "pdt_delete",  pdt_mi_delete,  0,  0,  0 },
129 129
 	{ "pdt_list",    pdt_mi_list,    0,  0,  0 },
130
-	{ 0, 0, 0, 0}
130
+	{ 0, 0, 0, 0, 0}
131 131
 };
132 132
 
133 133
 
... ...
@@ -960,7 +960,7 @@ struct mi_root* pdt_mi_list(struct mi_root* cmd_tree, void* param)
960 960
 {
961 961
 	str sd, sp, sdomain;
962 962
 	pd_t *it;
963
-	int i= 0;
963
+	unsigned int i= 0;
964 964
 	hash_t *h;
965 965
 	struct mi_root* rpl_tree = NULL;
966 966
 	struct mi_node* rpl = NULL;
... ...
@@ -122,7 +122,7 @@ int reload_address_table(void)
122 122
 	    (VAL_TYPE(val + 1) == DB_STRING) && !VAL_NULL(val + 1) &&
123 123
 	    inet_aton((char *)VAL_STRING(val + 1), &ip_addr) != 0 &&
124 124
 	    (VAL_TYPE(val + 2) == DB_INT) && !VAL_NULL(val + 2) && 
125
-	    ((unsigned int)VAL_INT(val + 2) >= 0) && 
125
+	    ((unsigned int)VAL_INT(val + 2) > 0) && 
126 126
 	    ((unsigned int)VAL_INT(val + 2) <= 32) &&
127 127
 	    (VAL_TYPE(val + 3) == DB_INT) && !VAL_NULL(val + 3)) {
128 128
 	    if ((unsigned int)VAL_INT(val + 2) == 32) {
... ...
@@ -184,7 +184,7 @@ static mi_export_t mi_cmds[] = {
184 184
 													mi_addr_child_init },
185 185
 	{ MI_ADDRESS_DUMP,    mi_address_dump,    MI_NO_INPUT_FLAG,  0,  0 },
186 186
 	{ MI_SUBNET_DUMP,     mi_subnet_dump,     MI_NO_INPUT_FLAG,  0,  0 },
187
-	{ 0, 0, 0, 0 }
187
+	{ 0, 0, 0, 0, 0 }
188 188
 };
189 189
 
190 190
 /* Module interface */
... ...
@@ -82,7 +82,7 @@ static param_export_t params[]={
82 82
 
83 83
 static mi_export_t mi_cmds [] = {
84 84
 	{MI_PIKE_LIST,   mi_pike_list,   MI_NO_INPUT_FLAG,  0,  0 },
85
-	{0,0,0,0}
85
+	{0,0,0,0,0}
86 86
 };
87 87
 
88 88
 
... ...
@@ -71,7 +71,7 @@ void update_in_timer(struct list_link *head, struct list_link *ll)
71 71
 
72 72
 
73 73
 /* "head" list MUST not be empty */
74
-void check_and_split_timer(struct list_link *head, int time,
74
+void check_and_split_timer(struct list_link *head, unsigned int time,
75 75
 							struct list_link *split, unsigned char *mask)
76 76
 {
77 77
 	struct list_link *ll;
... ...
@@ -50,7 +50,7 @@ void remove_from_timer(struct list_link *head, struct list_link *ll);
50 50
 
51 51
 void update_in_timer(struct list_link *head, struct list_link *ll);
52 52
 
53
-void check_and_split_timer(struct list_link *head, int time,
53
+void check_and_split_timer(struct list_link *head, unsigned int time,
54 54
 		struct list_link *split, unsigned char *mask);
55 55
 
56 56
 #endif
... ...
@@ -178,7 +178,7 @@ int encode_header(struct sip_msg *sipmsg,struct hdr_field *hdr,unsigned char *pa
178 178
 	       goto error;
179 179
 	    }
180 180
 	    memset(viabody,0,sizeof(struct via_body));
181
-	    if(parse_via(hdr->body.s,hdr->body.s+hdr->body.len+1,viabody)<0){
181
+	    if(parse_via(hdr->body.s,hdr->body.s+hdr->body.len+1,viabody)==0){
182 182
 	       myerror="encoding via \n";
183 183
 	       goto error;
184 184
 	    }
... ...
@@ -225,7 +225,7 @@ int encode_header(struct sip_msg *sipmsg,struct hdr_field *hdr,unsigned char *pa
225 225
 	       goto error;
226 226
 	    }
227 227
 	    memset(cseqbody,0,sizeof(struct cseq_body));
228
-	    if(parse_cseq(hdr->name.s,hdr->body.s+hdr->body.len+1,cseqbody)<0){
228
+	    if(parse_cseq(hdr->name.s,hdr->body.s+hdr->body.len+1,cseqbody)==0){
229 229
 	       myerror="encoding cseq header\n";
230 230
 	       goto error;
231 231
 	    }
... ...
@@ -532,7 +532,7 @@ int via_diff(struct sip_msg *req,struct sip_msg *resp)
532 532
 	    return -1;
533 533
 	 }
534 534
 	 memset(vb,0,sizeof(struct via_body));
535
-	 if(parse_via(hf->body.s,hf->body.s+hf->body.len+1,vb)<0){
535
+	 if(parse_via(hf->body.s,hf->body.s+hf->body.len+1,vb)==0){
536 536
 	    LOG(L_ERR,"Unable to parse via in via_diff!\n");
537 537
 	    pkg_free(vb);
538 538
 	    return -1;
... ...
@@ -557,7 +557,7 @@ int via_diff(struct sip_msg *req,struct sip_msg *resp)
557 557
 	    goto error;
558 558
 	 }
559 559
 	 memset(vb,0,sizeof(struct via_body));
560
-	 if(parse_via(hf->body.s,hf->body.s+hf->body.len+1,vb)<0){
560
+	 if(parse_via(hf->body.s,hf->body.s+hf->body.len+1,vb)==0){
561 561
 	    goto error;
562 562
 	 }
563 563
 	 hf->parsed=vb;
... ...
@@ -59,7 +59,7 @@ struct statstable* init_seas_stats_table()
59 59
    return seas_stats_table;
60 60
 }
61 61
 
62
-void inline destroy_seas_stats_table()
62
+inline void destroy_seas_stats_table()
63 63
 {
64 64
    /*deallocs the table*/
65 65
    if(seas_stats_table){
... ...
@@ -279,7 +279,7 @@ error:
279 279
  * 1 if stats properly started
280 280
  * -1 if error
281 281
  */
282
-int inline stop_stats_server()
282
+inline int stop_stats_server()
283 283
 {
284 284
    if(pid)
285 285
       kill(SIGTERM,pid);
... ...
@@ -51,8 +51,8 @@ extern char use_stats;
51 51
  * Initialize and destroy statistics table
52 52
  */
53 53
 struct statstable* init_seas_stats_table();
54
-int inline stop_stats_server();
55
-void inline destroy_seas_stats_table();
54
+inline int stop_stats_server();
55
+inline void destroy_seas_stats_table();
56 56
 /** Statistics server process
57 57
  * functions
58 58
  */
... ...
@@ -131,7 +131,7 @@ int print_msg_info(int fd,struct sip_msg* msg)
131 131
    char *payload=0;
132 132
    char *prefix=0;
133 133
    int retval=-1;
134
-   if((prefix=pkg_malloc(500))<=0){
134
+   if((prefix=pkg_malloc(500))==0){
135 135
       printf("OUT OF MEMORY !!!\n");
136 136
       return -1;
137 137
    }
... ...
@@ -140,7 +140,7 @@ static param_export_t params[] = {
140 140
 
141 141
 static mi_export_t mi_cmds[] = {
142 142
 	{ "sip_trace", sip_trace_mi,   0,  0,  0 },
143
-	{ 0, 0, 0, 0}
143
+	{ 0, 0, 0, 0, 0}
144 144
 };
145 145
 
146 146