changeset 1052:b3d623f04b6d

Fix a number of remaining compilation warnings
author Sebastien Decugis <sdecugis@freediameter.net>
date Wed, 24 Apr 2013 12:49:00 +0800
parents 69c6167d88d1
children 5072ddf4d38e
files extensions/app_diameap/diameap_eap.c extensions/app_diameap/diameap_plugins.c extensions/app_diameap/diameap_tls.h extensions/app_radgw/radius.c extensions/app_radgw/rgw_plugins.c extensions/app_sip/registrationtermination.c extensions/rt_ignore_dh/rt_ignore_dh.c include/freeDiameter/libfdproto.h libfdcore/p_sr.c libfdproto/dictionary.c libfdproto/dictionary_functions.c libfdproto/fdproto-internal.h
diffstat 12 files changed, 19 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/app_diameap/diameap_eap.c	Wed Apr 24 11:17:30 2013 +0800
+++ b/extensions/app_diameap/diameap_eap.c	Wed Apr 24 12:49:00 2013 +0800
@@ -451,7 +451,7 @@
 							&eap_i->aaaEapMSKData, &eap_i->aaaEapMSKLength,
 							&eap_i->aaaEapEMSKData, &eap_i->aaaEapEMSKLength))
 					{
-						TRACE_DEBUG(INFO,"%s[EAP Protocol] Generating EAP Master Key failed.",DIAMEAP_EXTENSION,eap_sm->selectedMethod->methodname)
+						TRACE_DEBUG(INFO,"%s[EAP Protocol] [%s plugin] Generating EAP Master Key failed.",DIAMEAP_EXTENSION,eap_sm->selectedMethod->methodname)
 						eap_i->aaaEapMSKLength = 0;
 						eap_i->aaaEapEMSKLength = 0;
 						eap_i->aaaEapKeyAvailable = FALSE;
@@ -475,7 +475,7 @@
 			if (diameap_ba_policygetnextmethod(eap_sm, &eap_sm->currentMethod,
 					&eap_sm->currentVendor))
 			{
-				TRACE_DEBUG(INFO,"%s[EAP Protocol] Selecting EAP Method plugin failed.",DIAMEAP_EXTENSION,eap_sm->selectedMethod->methodname);
+				TRACE_DEBUG(INFO,"%s[EAP Protocol] [%s plugin] Selecting EAP Method plugin failed.",DIAMEAP_EXTENSION,eap_sm->selectedMethod->methodname);
 
 				*non_fatal_error = TRUE;
 				eap_sm->eap_state = EAP_END;
--- a/extensions/app_diameap/diameap_plugins.c	Wed Apr 24 11:17:30 2013 +0800
+++ b/extensions/app_diameap/diameap_plugins.c	Wed Apr 24 12:49:00 2013 +0800
@@ -129,7 +129,7 @@
 		if (!diameap_plugin_register)
 		{
 			TRACE_DEBUG(INFO,
-					"%s[%s plugin] Unable to register EAP method.",DIAMEAP_EXTENSION,
+					"%s[%s plugin] Unable to register EAP method: %s.",DIAMEAP_EXTENSION,
 					plugin->methodname, dlerror());
 			return EINVAL;
 		}
--- a/extensions/app_diameap/diameap_tls.h	Wed Apr 24 11:17:30 2013 +0800
+++ b/extensions/app_diameap/diameap_tls.h	Wed Apr 24 12:49:00 2013 +0800
@@ -39,14 +39,14 @@
 #ifndef DIAMEAP_TLS_H_
 #define DIAMEAP_TLS_H_
 
- #if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 405
+#if defined(__GNUC__)
 # define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
 # define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
-# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
+# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406		/* 4.6.x */
 #  define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \
      GCC_DIAG_PRAGMA(ignored x)
 #  define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop)
-# else
+# else							/* older */
 #  define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored x)
 #  define GCC_DIAG_ON(x)  GCC_DIAG_PRAGMA(warning x)
 # endif
--- a/extensions/app_radgw/radius.c	Wed Apr 24 11:17:30 2013 +0800
+++ b/extensions/app_radgw/radius.c	Wed Apr 24 12:49:00 2013 +0800
@@ -250,7 +250,6 @@
 	int i, len;
 	unsigned char *pos;
 	u8 attrtype;
-	size_t offset = 0;
 	
 	memset(outbuf, 0, buflen);
 
--- a/extensions/app_radgw/rgw_plugins.c	Wed Apr 24 11:17:30 2013 +0800
+++ b/extensions/app_radgw/rgw_plugins.c	Wed Apr 24 12:49:00 2013 +0800
@@ -400,7 +400,6 @@
 	/* Loop in the list of extensions */
 	for (li = head->next; li != head; li = li->next) {
 		struct plg_descr * plg = ((struct plg_accel_item *) li)->plg;
-		int locstateful = 0;
 		
 		if (plg->descriptor->rgwp_diam_ans) {
 			TRACE_DEBUG(ANNOYING, "Calling next plugin: %s", plg->descriptor->rgwp_name);
--- a/extensions/app_sip/registrationtermination.c	Wed Apr 24 11:17:30 2013 +0800
+++ b/extensions/app_sip/registrationtermination.c	Wed Apr 24 12:49:00 2013 +0800
@@ -97,7 +97,6 @@
 	struct dict_object * rtr_model=NULL;
 	struct msg * message=NULL;
 	struct avp *groupedavp=NULL, *avp=NULL;
-	struct session *sess=NULL;
 	union avp_value value;
 	
 	//We must check that we have all needed value in structure
--- a/extensions/rt_ignore_dh/rt_ignore_dh.c	Wed Apr 24 11:17:30 2013 +0800
+++ b/extensions/rt_ignore_dh/rt_ignore_dh.c	Wed Apr 24 12:49:00 2013 +0800
@@ -55,7 +55,6 @@
 	struct avp *avp, *child;
 	struct avp *oh_avp = NULL;
 	struct avp *pi_avp = NULL;
-	int match;
 	void *ps, *new_oh;
 	size_t ps_len, new_oh_len = 0;
 	union avp_value val;
@@ -66,6 +65,7 @@
 	/* look for Origin-Host and Proxy-Info matching this host */
 	while (avp && (!oh_avp || !pi_avp)) {
 		struct avp_hdr * ahdr;
+		int match = 0;
 		
 		CHECK_FCT(fd_msg_avp_hdr(avp, &ahdr));
 		if (!(ahdr->avp_flags & AVP_FLAG_VENDOR)) {
@@ -76,10 +76,9 @@
 				break;
 			case AC_PROXY_INFO:
 				ps = NULL;
-				match = ps_len = 0;
+				ps_len = 0;
 				CHECK_FCT(fd_msg_parse_dict(avp, fd_g_config->cnf_dict, NULL));
 				CHECK_FCT(fd_msg_browse(avp, MSG_BRW_FIRST_CHILD, &child, NULL));
-				int match = 0;
 				while (child && (!match || !ps)) {
 					struct avp_hdr *chdr;
 					CHECK_FCT(fd_msg_avp_hdr(child, &chdr));
--- a/include/freeDiameter/libfdproto.h	Wed Apr 24 11:17:30 2013 +0800
+++ b/include/freeDiameter/libfdproto.h	Wed Apr 24 12:49:00 2013 +0800
@@ -90,14 +90,14 @@
 #endif /* SWIG */
 
 /* Remove some deprecated warnings from some gnutls versions, when possible */
-#if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 405
+#if defined(__GNUC__)
 # define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
 # define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
-# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
+# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406		/* 4.6.x */
 #  define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \
      GCC_DIAG_PRAGMA(ignored x)
 #  define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop)
-# else
+# else							/* older */
 #  define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored x)
 #  define GCC_DIAG_ON(x)  GCC_DIAG_PRAGMA(warning x)
 # endif
@@ -1914,6 +1914,10 @@
  */
 int fd_sess_fromsid ( uint8_t * sid, size_t len, struct session ** session, int * isnew);
 
+/* only use the following in specific situations, e.g. app_radgw extension. They are normally handled by the framework only */
+int fd_sess_fromsid_msg ( uint8_t * sid, size_t len, struct session ** session, int * isnew); 
+int fd_sess_ref_msg ( struct session * session );
+
 /*
  * FUNCTION:	fd_sess_getsid
  *
--- a/libfdcore/p_sr.c	Wed Apr 24 11:17:30 2013 +0800
+++ b/libfdcore/p_sr.c	Wed Apr 24 12:49:00 2013 +0800
@@ -77,8 +77,8 @@
 		uint32_t * nexthbh = li->o;
 		
 		fd_log_debug(" - Next req (hbh:%x): [since %ld.%06ld sec]", *nexthbh, 
-			(now.tv_nsec >= sr->added_on.tv_nsec) ? (now.tv_sec - sr->added_on.tv_sec) : (now.tv_sec - sr->added_on.tv_sec - 1),
-			(now.tv_nsec >= sr->added_on.tv_nsec) ? (now.tv_nsec - sr->added_on.tv_nsec) / 1000 : (now.tv_nsec - sr->added_on.tv_nsec + 1000000000) / 1000);
+			(long)((now.tv_nsec >= sr->added_on.tv_nsec) ? (now.tv_sec - sr->added_on.tv_sec) : (now.tv_sec - sr->added_on.tv_sec - 1)),
+			(long)((now.tv_nsec >= sr->added_on.tv_nsec) ? ((now.tv_nsec - sr->added_on.tv_nsec) / 1000) : ((now.tv_nsec - sr->added_on.tv_nsec + 1000000000) / 1000)));
 		
 		fd_msg_dump_one(ANNOYING + 1, sr->req);
 	}
--- a/libfdproto/dictionary.c	Wed Apr 24 11:17:30 2013 +0800
+++ b/libfdproto/dictionary.c	Wed Apr 24 12:49:00 2013 +0800
@@ -1179,7 +1179,7 @@
 				if (enumval->enum_value.os.len < LEN_MAX)
 					n = enumval->enum_value.os.len;
 				for (i=0; i < n; i++)
-					fd_log_debug("0x%02hhX/'%c' ", enumval->enum_value.os.data[i], ASCII(enumval->enum_value.os.data[i]));
+					fd_log_debug("0x%2hhX/'%c' ", enumval->enum_value.os.data[i], ASCII(enumval->enum_value.os.data[i]));
 				if (n == LEN_MAX)
 					fd_log_debug("...");
 			}
--- a/libfdproto/dictionary_functions.c	Wed Apr 24 11:17:30 2013 +0800
+++ b/libfdproto/dictionary_functions.c	Wed Apr 24 12:49:00 2013 +0800
@@ -231,7 +231,6 @@
 		with malformed AVP */
 
 		char * end = strchr(ret, '\0');
-		char * oldend = end;
 		while (end > ret) {
 			end--;
 			char b = *end;
@@ -336,7 +335,7 @@
 		snprintf(ret, STR_LEN, "[invalid length: %zd]", avp_value->os.len);
 		return ret;
 	}
-	if (diameter_string_to_time_t(avp_value->os.data, avp_value->os.len, &val) != 0) {
+	if (diameter_string_to_time_t((char *)avp_value->os.data, avp_value->os.len, &val) != 0) {
 		snprintf(ret, STR_LEN, "[time conversion error]");
 		return ret;
 	}
--- a/libfdproto/fdproto-internal.h	Wed Apr 24 11:17:30 2013 +0800
+++ b/libfdproto/fdproto-internal.h	Wed Apr 24 12:49:00 2013 +0800
@@ -65,8 +65,6 @@
 extern pthread_rwlock_t fd_disp_lock;
 
 /* Messages / sessions API */
-int fd_sess_fromsid_msg ( uint8_t * sid, size_t len, struct session ** session, int * new);
-int fd_sess_ref_msg ( struct session * session );
 int fd_sess_reclaim_msg ( struct session ** session );
 
 
"Welcome to our mercurial repository"