clang compiler warnings: Fix autological comparisons

This fixes autological comparison warnings in the following:
 * chan_skinny: letohl may return a signed or unsigned value, depending on the
   macro chosen
 * func_curl: Provide a specific cast to CURLoption to prevent mismatch
 * cel: Fix enum comparisons where the enum can never be negative
 * enum: Fix comparison of return result of dn_expand, which returns a signed
   int value
 * event: Fix enum comparisons where the enum can never be negative
 * indications: tone_data.freq1 and freq2 are unsigned, and hence can never be
   negative
 * presencestate: Use the actual enum value for INVALID state
 * security_events: Fix enum comparisons where the enum can never be negative
 * udptl: Don't bother to check if the return value from encode_length is less
   than 0, as it returns an unsigned int
 * translate: Since the parameters are unsigned int, don't bother checking
   to see if they are negative. The cast to unsigned int would already blow
   past the matrix bounds.

Review: https://reviewboard.asterisk.org/r/4533
ASTERISK-24917
Reported by: dkdegroot
patches:
  rb4533.patch submitted by dkdegroot (License 6600)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@434469 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2015-04-09 12:47:09 +00:00
parent 6b399f72dc
commit 7c4efc490a
11 changed files with 33 additions and 31 deletions

View File

@@ -295,7 +295,7 @@ const char *ast_event_get_type_name(const struct ast_event *event)
type = ast_event_get_type(event);
if (type < 0 || type >= ARRAY_LEN(event_names)) {
if (type >= ARRAY_LEN(event_names)) {
ast_log(LOG_ERROR, "Invalid event type - '%u'\n", type);
return "";
}
@@ -725,6 +725,7 @@ void ast_event_report_subs(const struct ast_event_sub *event_sub)
struct ast_event *event;
struct ast_event_sub *sub;
enum ast_event_type event_type = -1;
int found = 0;
struct ast_event_ie_val *ie_val;
if (event_sub->type != AST_EVENT_SUB)
@@ -733,12 +734,14 @@ void ast_event_report_subs(const struct ast_event_sub *event_sub)
AST_LIST_TRAVERSE(&event_sub->ie_vals, ie_val, entry) {
if (ie_val->ie_type == AST_EVENT_IE_EVENTTYPE) {
event_type = ie_val->payload.uint;
found = 1;
break;
}
}
if (event_type == -1)
if (!found) {
return;
}
AST_RWDLLIST_RDLOCK(&ast_event_subs[event_type]);
AST_RWDLLIST_TRAVERSE(&ast_event_subs[event_type], sub, entry) {
@@ -763,7 +766,7 @@ struct ast_event_sub *ast_event_subscribe_new(enum ast_event_type type,
{
struct ast_event_sub *sub;
if (type < 0 || type >= AST_EVENT_TOTAL) {
if (type >= AST_EVENT_TOTAL) {
ast_log(LOG_ERROR, "%u is an invalid type!\n", type);
return NULL;
}