Ver Fonte

Merge pull request #168 from kamailio/vseva/gcc_warnings

clean some gcc warnings
Victor Seva há 10 anos atrás
pai
commit
46cc69f229

+ 0 - 6
modules/db_berkeley/bdb_cmd.c

@@ -507,17 +507,11 @@ int bdb_cmd_first(db_res_t* res)
 
 int bdb_cmd_next(db_res_t* res)
 {
-	db_con_t *con;
-	bdb_res_t *bres;
-	bdb_con_t *bcon;
 	bdb_cmd_t *bcmd;
 	DBT key, data;
 	int ret;
 	static char dbuf[MAX_ROW_SIZE];
 
-	con = res->cmd->ctx->con[db_payload_idx];
-	bres = DB_GET_PAYLOAD(res);
-	bcon = DB_GET_PAYLOAD(con);
 	bcmd = DB_GET_PAYLOAD(res->cmd);
 
 	if (bcmd->next_flag == 2 || bcmd->next_flag == -2) return 1;

+ 0 - 3
modules/db_berkeley/bdb_con.c

@@ -49,12 +49,9 @@
  */
 static void bdb_con_free(db_con_t* con, bdb_con_t *payload)
 {
-	bdb_uri_t *buri;
 	if (!payload)
 		return;
 
-	buri = DB_GET_PAYLOAD(con->uri);
-
 	/* Delete the structure only if there are no more references
 	 * to it in the connection pool
 	 */

+ 4 - 0
modules/db_berkeley/km_bdb_res.c

@@ -429,6 +429,8 @@ int bdb_is_neq_type(db_type_t _t0, db_type_t _t1)
 		case DB1_BITMAP:
 			if (_t0==DB1_INT)
 				return 0;
+		default:
+			break;
 	}
 	return 1;
 }
@@ -545,6 +547,8 @@ int bdb_cmp_val(db_val_t* _vp, db_val_t* _v)
 		case DB1_BITMAP:
 			return (_vp->val.int_val<_v->val.bitmap_val)?-1:
 				(_vp->val.int_val>_v->val.bitmap_val)?1:0;
+		default:
+			break;
 	}
 	return -2;
 }

+ 2 - 0
modules/db_berkeley/km_bdb_val.c

@@ -173,6 +173,8 @@ int bdb_str2val(db_type_t _t, db_val_t* _v, char* _s, int _l)
 		VAL_TYPE(_v) = DB1_BLOB;
 		LM_DBG("got blob len %d\n", _l);
 		return 0;
+	default:
+		break;
 	}
 
 	return -6;

+ 4 - 4
modules/db_berkeley/km_db_berkeley.c

@@ -776,13 +776,13 @@ int bdb_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v, int _n)
 	tbl_cache_p _tbc = NULL;
 	table_p _tp = NULL;
 	char kbuf[MAX_ROW_SIZE];
-	int i, j, ret, klen;
+	int ret, klen;
 	int *lkey=NULL;
 	DBT key;
 	DB *db;
 	DBC *dbcp;
 
-	i = j = ret = 0;
+	ret = 0;
 	klen=MAX_ROW_SIZE;
 
 	if (_op)
@@ -904,13 +904,13 @@ int _bdb_delete_cursor(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v,
 	db1_res_t* _r   = NULL;
 	char kbuf[MAX_ROW_SIZE];
 	char dbuf[MAX_ROW_SIZE];
-	int i, ret, klen=MAX_ROW_SIZE;
+	int ret, klen=MAX_ROW_SIZE;
 	DBT key, data;
 	DB *db;
 	DBC *dbcp;
 	int *lkey=NULL;
 	
-	i = ret = 0;
+	ret = 0;
 	
 	if ((!_h) || !CON_TABLE(_h))
 		return -1;

+ 3 - 0
modules/db_perlvdb/perlvdb_conv.c

@@ -140,6 +140,9 @@ inline SV *valdata(db_val_t* val) {
 		case DB1_BITMAP:
 			data = newSViv(VAL_BITMAP(val));
 			break;
+
+		default:
+			break;
 	}
 
 	return data;

+ 0 - 8
modules/db_postgres/pg_cmd.c

@@ -180,10 +180,8 @@ static void free_pg_params(struct pg_params* params)
  */
 static int check_types(db_cmd_t* cmd) 
 { 
-	struct pg_cmd* pcmd; 
 	struct pg_con* pcon;
 	
-	pcmd = DB_GET_PAYLOAD(cmd);
 	/* FIXME: The function should take the connection as one of parameters */
 	pcon = DB_GET_PAYLOAD(cmd->ctx->con[db_payload_idx]);
 
@@ -369,11 +367,8 @@ int pg_cmd(db_cmd_t* cmd)
 
 int pg_getopt(db_cmd_t* cmd, char* optname, va_list ap)
 {
-	struct pg_cmd* pcmd;
 	long long* id;
 
-	pcmd = (struct pg_cmd*)DB_GET_PAYLOAD(cmd);
-
 	if (!strcasecmp("last_id", optname)) {
 		id = va_arg(ap, long long*);
 		if (id == NULL) {
@@ -393,9 +388,6 @@ int pg_getopt(db_cmd_t* cmd, char* optname, va_list ap)
 
 int pg_setopt(db_cmd_t* cmd, char* optname, va_list ap)
 {
-	struct pg_cmd* pcmd;
-
-	pcmd = (struct pg_cmd*)DB_GET_PAYLOAD(cmd);
 	return 1;
 }
 

+ 6 - 6
modules/db_text/dbt_raw_util.c

@@ -166,7 +166,7 @@ int dbt_build_where(char* where, db_key_t** _k, db_op_t** _o, db_val_t** _v)
 	char** _o1 = NULL;
 	db_val_t* _v1 = NULL;
 	regmatch_t* matches = NULL;
-	int n, l;
+	int l;
 	int len;
 	regex_t preg;
 	int offset = 0;
@@ -233,11 +233,11 @@ int dbt_build_where(char* where, db_key_t** _k, db_op_t** _o, db_val_t** _v)
 			_v1[idx].val.str_val.s = pkg_malloc(l+1);
 			strncpy(_v1[idx].val.str_val.s, buffer+matches[5].rm_so, l);
 		}
-
-//		for(n=0; n < MAX_MATCH; n++) {
-//			LM_ERR("MATCH RESULT %d - %d,%d\n", n, matches[n].rm_so, matches[n].rm_eo);
-//		}
-
+/*		int n;
+		for(n=0; n < MAX_MATCH; n++) {
+			LM_ERR("MATCH RESULT %d - %d,%d\n", n, matches[n].rm_so, matches[n].rm_eo);
+		}
+*/
 		if(matches[0].rm_eo != -1)
 			offset += matches[0].rm_eo;
 

+ 1 - 1
modules/ims_isc/mark.c

@@ -313,7 +313,7 @@ inline int isc_mark_write_route(struct sip_msg *msg, str *as, str *iscmark) {
  */
 int isc_mark_write_psu(struct sip_msg *msg, isc_mark *mark) {
     struct lump *l = msg->add_rm;
-    int hlen;
+    size_t hlen;
     char * hstr = NULL;
     const str *regstate, *sescase;
 

+ 11 - 12
modules/pua_reginfo/usrloc_cb.c

@@ -65,7 +65,6 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c, int type) {
 	str * body= NULL;
 	ucontact_t * ptr;
 	char buf[512];
-	int buf_len;
 	int reg_active = 0;
 	time_t cur_time = time(0);
 
@@ -99,7 +98,7 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c, int type) {
 
 	/* Add the properties to this Node for AOR and ID: */
 	xmlNewProp(registration_node, BAD_CAST "aor", BAD_CAST uri.s);
-	buf_len = snprintf(buf, sizeof(buf), "%p", record);
+	snprintf(buf, sizeof(buf), "%p", record);
 	xmlNewProp(registration_node, BAD_CAST "id", BAD_CAST buf);
 
 	ptr = record->contacts;
@@ -113,7 +112,7 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c, int type) {
 				goto error;
 			}
 			memset(buf, 0, sizeof(buf));
-			buf_len = snprintf(buf, sizeof(buf), "%p", ptr);
+			snprintf(buf, sizeof(buf), "%p", ptr);
 			xmlNewProp(contact_node, BAD_CAST "id", BAD_CAST buf);
 			/* Check, if this is the modified contact: */
 			if (ptr == c) {
@@ -128,50 +127,50 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c, int type) {
 				else if (type & UL_CONTACT_DELETE) xmlNewProp(contact_node, BAD_CAST "event", BAD_CAST "unregistered");
 				else xmlNewProp(contact_node, BAD_CAST "event", BAD_CAST "unknown");
 				memset(buf, 0, sizeof(buf));
-				buf_len = snprintf(buf, sizeof(buf), "%i", (int)(ptr->expires-cur_time));
+				snprintf(buf, sizeof(buf), "%i", (int)(ptr->expires-cur_time));
 				xmlNewProp(contact_node, BAD_CAST "expires", BAD_CAST buf);
 			} else {
 				reg_active = 1;
 				xmlNewProp(contact_node, BAD_CAST "state", BAD_CAST "active");
 				xmlNewProp(contact_node, BAD_CAST "event", BAD_CAST "registered");
 				memset(buf, 0, sizeof(buf));
-				buf_len = snprintf(buf, sizeof(buf), "%i", (int)(ptr->expires-cur_time));
+				snprintf(buf, sizeof(buf), "%i", (int)(ptr->expires-cur_time));
 				xmlNewProp(contact_node, BAD_CAST "expires", BAD_CAST buf);
 			}
 			if (ptr->q != Q_UNSPECIFIED) {
 				float q = (float)ptr->q/1000;
 				memset(buf, 0, sizeof(buf));
-				buf_len = snprintf(buf, sizeof(buf), "%.3f", q);
+				snprintf(buf, sizeof(buf), "%.3f", q);
 				xmlNewProp(contact_node, BAD_CAST "q", BAD_CAST buf);
 			}
 			/* CallID Attribute */
 			memset(buf, 0, sizeof(buf));
-			buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->callid.len, ptr->callid.s);
+			snprintf(buf, sizeof(buf), "%.*s", ptr->callid.len, ptr->callid.s);
 			xmlNewProp(contact_node, BAD_CAST "callid", BAD_CAST buf);
 
 			/* CSeq Attribute */
 			memset(buf, 0, sizeof(buf));
-			buf_len = snprintf(buf, sizeof(buf), "%d", ptr->cseq);
+			snprintf(buf, sizeof(buf), "%d", ptr->cseq);
 			xmlNewProp(contact_node, BAD_CAST "cseq", BAD_CAST buf);
 
 			/* received Attribute */
 			memset(buf, 0, sizeof(buf));
-	                buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->received.len, ptr->received.s);
+	                snprintf(buf, sizeof(buf), "%.*s", ptr->received.len, ptr->received.s);
          	       	xmlNewProp(contact_node, BAD_CAST "received", BAD_CAST buf);
 			
 			/* path Attribute */
 			memset(buf, 0, sizeof(buf));
-			buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->path.len, ptr->path.s);
+			snprintf(buf, sizeof(buf), "%.*s", ptr->path.len, ptr->path.s);
 			xmlNewProp(contact_node, BAD_CAST "path", BAD_CAST buf);
 
 			/* user_agent Attribute */
 			memset(buf, 0, sizeof(buf));
-			buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->user_agent.len, ptr->user_agent.s);
+			snprintf(buf, sizeof(buf), "%.*s", ptr->user_agent.len, ptr->user_agent.s);
 			xmlNewProp(contact_node, BAD_CAST "user_agent", BAD_CAST buf);
 
 			/* URI-Node */
 			memset(buf, 0, sizeof(buf));
-			buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->c.len, ptr->c.s);
+			snprintf(buf, sizeof(buf), "%.*s", ptr->c.len, ptr->c.s);
 			uri_node = xmlNewChild(contact_node, NULL, BAD_CAST "uri", BAD_CAST buf) ;
 			if(uri_node == NULL) {
 				LM_ERR("while adding child\n");

+ 2 - 2
modules/purple/hashtable.c

@@ -36,11 +36,11 @@ static int *get_counter(char *key) {
 	if (d == NULL) {
 		gchar *k = g_strdup(key);
 		d = (int*) pkg_malloc(sizeof(int));
-		LM_DBG("counter created @0x%08x\n", (unsigned int)d);
+		LM_DBG("counter created @0x%p\n", d);
 		*d = 0;
 		g_hash_table_insert(hash, k, d);
 	}
-	LM_DBG("counter@0x%08x: key: %s ; value: %d\n", (unsigned int)d, key, *d);
+	LM_DBG("counter@0x%p: key: %s ; value: %d\n", d, key, *d);
 	return d;
 }
 

+ 2 - 2
modules/purple/purple_sip.c

@@ -74,7 +74,7 @@ static str* build_pidf(char *uri, char *id, enum purple_publish_basic basic, enu
 	xmlNodePtr root_node = NULL, status_node = NULL;
 	xmlNodePtr tuple_node = NULL, basic_node = NULL;
 	xmlNodePtr person_node = NULL, activities_node = NULL;
-	xmlNsPtr pidf_ns, dm_ns, rpid_ns, cipid_ns;
+	xmlNsPtr pidf_ns, dm_ns, rpid_ns;
 	char* entity = NULL;
 
 	entity = (char*)pkg_malloc(7+ strlen(uri)*sizeof(char));
@@ -104,7 +104,7 @@ static str* build_pidf(char *uri, char *id, enum purple_publish_basic basic, enu
 	pidf_ns = xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:pidf", NULL);
 	dm_ns = xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:pidf:data-model", BAD_CAST "dm");
 	rpid_ns = xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:pidf:rpid", BAD_CAST "rpid");
-	cipid_ns = xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:pidf:cipid", BAD_CAST "c");
+	xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:pidf:cipid", BAD_CAST "c");
 	
 	tuple_node = xmlNewChild(root_node, NULL, BAD_CAST "tuple", NULL);
 	if( tuple_node == NULL) {

+ 0 - 2
modules/snmpstats/hashTable.c

@@ -165,7 +165,6 @@ void deleteUser(hashSlot_t *theTable, char *aor, int hashTableSize)
 	int hashIndex = calculateHashSlot(aor, hashTableSize);
 	int searchStringLength = strlen(aor);
 
-	aorToIndexStruct_t *previousRecord = theTable[hashIndex].first;
 	aorToIndexStruct_t *currentRecord  = theTable[hashIndex].first;
 
 	while (currentRecord != NULL) {
@@ -227,7 +226,6 @@ void deleteUser(hashSlot_t *theTable, char *aor, int hashTableSize)
 		}
 
 		/* Advance to the next records. */
-		previousRecord = currentRecord;
 		currentRecord = currentRecord->next;
 	}
 

+ 0 - 5
modules/snmpstats/kamailioNet.c

@@ -977,11 +977,6 @@ handle_kamailioNetTcpKeepIdle(netsnmp_mib_handler *handler,
     
     switch(reqinfo->mode) {
 
-    struct cfg_group_tcp t;
-    unsigned int value;
-
-    tcp_options_get(&t);
-    value = t.con_lifetime;
         case MODE_GET:
             snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 			 (u_char *) &value, sizeof(int));

+ 0 - 3
modules/snmpstats/snmpSIPRegUserLookupTable.c

@@ -459,15 +459,12 @@ void kamailioSIPRegUserLookupTable_set_reserve2( netsnmp_request_group *rg )
 
 	netsnmp_request_group_item *current;
 
-	netsnmp_variable_list *var;
-
 	int rc;
 
 	rg->rg_void = rg->list->ri;
 
 	for( current = rg->list; current; current = current->next ) {
 
-		var = current->ri->requestvb;
 		rc = SNMP_ERR_NOERROR;
 
 		switch(current->tri->colnum) 

+ 0 - 2
modules/snmpstats/snmpSIPStatusCodesTable.c

@@ -490,7 +490,6 @@ void kamailioSIPStatusCodesTable_set_reserve2( netsnmp_request_group *rg )
 		(kamailioSIPStatusCodesTable_context *)rg->undo_info;
 
 	netsnmp_request_group_item *current;
-	netsnmp_variable_list      *var;
 
 	int rc;
 
@@ -498,7 +497,6 @@ void kamailioSIPStatusCodesTable_set_reserve2( netsnmp_request_group *rg )
 
 	for( current = rg->list; current; current = current->next ) {
 
-		var = current->ri->requestvb;
 		rc = SNMP_ERR_NOERROR;
 
 		switch(current->tri->colnum)