[sr-dev] git:master:26d1426c: cdp: fix compilation warnings

Victor Seva linuxmaniac at torreviejawireless.org
Tue Jun 7 12:19:51 CEST 2016


Module: kamailio
Branch: master
Commit: 26d1426cfeb926ee440542716e7365d16b627801
URL: https://github.com/kamailio/kamailio/commit/26d1426cfeb926ee440542716e7365d16b627801

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2016-06-06T12:05:39+02:00

cdp: fix compilation warnings

> peerstatemachine.c:97:19: warning: implicit conversion from enumeration type 'peer_state_t' to different enumeration type 'peer_event_t' [-Wenum-conversion]
>                                         next_event = I_Snd_Conn_Req(p);
>                                                    ~ ^~~~~~~~~~~~~~~~~
> peerstatemachine.c:531:10: warning: implicit conversion from enumeration type 'peer_event_t' to different enumeration type 'peer_state_t' [-Wenum-conversion]
>                 return I_Rcv_Conn_NAck;
>                 ~~~~~~ ^~~~~~~~~~~~~~~
> peerstatemachine.c:534:9: warning: implicit conversion from enumeration type 'peer_event_t' to different enumeration type 'peer_state_t' [-Wenum-conversion]
>         return I_Rcv_Conn_Ack;
>         ~~~~~~ ^~~~~~~~~~~~~~
> 3 warnings generated.

---

Modified: modules/cdp/session.c

---

Diff:  https://github.com/kamailio/kamailio/commit/26d1426cfeb926ee440542716e7365d16b627801.diff
Patch: https://github.com/kamailio/kamailio/commit/26d1426cfeb926ee440542716e7365d16b627801.patch

---

diff --git a/modules/cdp/session.c b/modules/cdp/session.c
index f418204..3c904c3 100644
--- a/modules/cdp/session.c
+++ b/modules/cdp/session.c
@@ -73,7 +73,7 @@ unsigned int *session_id2;		/**< counter for second part of the session id */
 inline void AAASessionsLock(unsigned int hash)
 {
 	if(destroy_modules_phase()) return;
-	if ( hash >=0 && hash < sessions_hash_size ){
+	if ( hash < sessions_hash_size ){
 		lock_get(sessions[hash].lock);
 	}
 	else {
@@ -88,7 +88,7 @@ inline void AAASessionsUnlock(unsigned int hash)
 {
 	if(destroy_modules_phase()) return;
 
-	if ( hash >=0 && hash < sessions_hash_size ){
+	if ( hash < sessions_hash_size ){
 		lock_release(sessions[hash].lock);
 	}
 	else {
@@ -330,7 +330,7 @@ void del_session(cdp_session_t *x)
 	if (!x) return;
 
 	hash = x->hash;
-	if (hash < 0 || hash >= sessions_hash_size) {
+	if (hash >= sessions_hash_size) {
 		LM_ERR("del_session: x->hash :%d out of range of sessions_hash_size: %d !\n",hash, sessions_hash_size);
 		return;
 	}




More information about the sr-dev mailing list