summaryrefslogtreecommitdiff
path: root/channels/chan_skinny.c
diff options
context:
space:
mode:
authorDiederik de Groot <ddegroot@talon.nl>2015-04-22 11:17:56 +0200
committerMatt Jordan <mjordan@digium.com>2015-04-24 09:48:44 -0500
commitf8e21a1adf91bfa141771415b19c31236c2f1a17 (patch)
tree28c781628c9b2ed1f9585765fa90648670571fe7 /channels/chan_skinny.c
parent61c8ae548ad8a789154f3be47ec2a743ccd6ae9e (diff)
Clang: Fix some more tautological-compare warnings.
clang can warn about a so called tautological-compare, when it finds comparisons which are logically always true, and are therefor deemed unnecessary. Exanple: unsigned int x = 4; if (x > 0) // x is always going to be bigger than 0 Enum Case: Each enumeration is its own type. Enums are an integer type but they do not have to be *signed*. C leaves it up to the compiler as an implementation option what to consider the integer type of a particu- lar enumeration is. Gcc treats an enum without negative values as an int while clang treats this enum as an unsigned int. rmudgett & mmichelson: cast the enum to (unsigned int) in assert. The cast does have an effect. For gcc, which seems to treat all enums as int, the cast to unsigned int will eliminate the possibility of negative values being allowed. For clang, which seems to treat enums without any negative members as unsigned int, the cast will have no effect. If for some reason in the future a negative value is ever added to the enum the assert will still catch the negative value. ASTERISK-24917 Change-Id: Ief23ef68916192b9b72dabe702b543ecfeca0b62
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r--channels/chan_skinny.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 06878fb96..8f6f2eb7c 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -7488,6 +7488,7 @@ static void *skinny_session(void *data)
struct skinnysession *s = data;
int dlen = 0;
+ int eventmessage = 0;
struct pollfd fds[1];
if (!s) {
@@ -7544,7 +7545,8 @@ static void *skinny_session(void *data)
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;
}