[Asterisk-code-review] Prevent tautological-compare warning Change-Id: Ief23ef68916... (asterisk[13])

Diederik de Groot asteriskteam at digium.com
Mon Apr 20 07:59:31 CDT 2015


Diederik de Groot has uploaded a new change for review.

  https://gerrit.asterisk.org/160

Change subject: Prevent tautological-compare warning Change-Id: Ief23ef68916192b9b72dabe702b543ecfeca0b62
......................................................................

Prevent tautological-compare warning
Change-Id: Ief23ef68916192b9b72dabe702b543ecfeca0b62
---
M channels/chan_skinny.c
M main/security_events.c
M res/res_security_log.c
3 files changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/60/160/1

diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index a089c65..ed82c7d 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -7488,6 +7488,7 @@
 	struct skinnysession *s = data;
 
 	int dlen = 0;
+	int eventmessage = 0;
 	struct pollfd fds[1];
 
 	if (!s) {
@@ -7544,7 +7545,8 @@
 				break;
 			}
 
-			if (letohl(req->e) < 0) {
+			eventmessage = letohl(req->e);
+			if (eventmessage < 0) {
 				ast_log(LOG_ERROR, "Event Message is NULL from socket %d, This is bad\n", s->fd);
 				break;
 			}
diff --git a/main/security_events.c b/main/security_events.c
index 5a8df66..1a59635 100644
--- a/main/security_events.c
+++ b/main/security_events.c
@@ -428,7 +428,7 @@
 	event_type_json = ast_json_object_get(json, "SecurityEvent");
 	event_type = ast_json_integer_get(event_type_json);
 
-	ast_assert(event_type >= 0 && event_type < AST_SECURITY_EVENT_NUM_TYPES);
+	ast_assert(event_type < AST_SECURITY_EVENT_NUM_TYPES);
 
 	if (!(str = ast_str_create(SECURITY_EVENT_BUF_INIT_LEN))) {
 		return NULL;
diff --git a/res/res_security_log.c b/res/res_security_log.c
index e56f7f7..0f7ab9e 100644
--- a/res/res_security_log.c
+++ b/res/res_security_log.c
@@ -98,7 +98,7 @@
 	event_type_json = ast_json_object_get(json, "SecurityEvent");
 	event_type = ast_json_integer_get(event_type_json);
 
-	ast_assert(event_type >= 0 && event_type < AST_SECURITY_EVENT_NUM_TYPES);
+	ast_assert(event_type < AST_SECURITY_EVENT_NUM_TYPES);
 
 	if (!(str = ast_str_thread_get(&security_event_buf,
 			SECURITY_EVENT_BUF_INIT_LEN))) {

-- 
To view, visit https://gerrit.asterisk.org/160
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief23ef68916192b9b72dabe702b543ecfeca0b62
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Diederik de Groot <dkgroot at talon.nl>



More information about the asterisk-code-review mailing list