diff options
author | Matthew Jordan <mjordan@digium.com> | 2015-04-09 12:57:21 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2015-04-09 12:57:21 +0000 |
commit | ea0098724efbd64a06b3103d19bb5f711f6f3cd7 (patch) | |
tree | 80ffc2e721dd3fde80fa9ef914a5f523fdfb3df1 /res | |
parent | 2201e2734077c07648029f165d1a6a89f99e07c0 (diff) |
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.
* res_pjsip_exten_state: Use a temporary value to cache the return of
ast_hint_presence_state
* res_stasis_playback: Fix enum comparisons where the enum can never be
negative
* res_stasis_recording: Add an enum value for the case where the recording
operation is in error; fix enum comparisons
* resource_bridges: Use enum value as opposed to -1
* resource_channels: Use enum value as opposed to -1
Review: https://reviewboard.asterisk.org/r/4533
ASTERISK-24917
Reported by: dkdegroot
patches:
rb4533.patch submitted by dkdegroot (License 6600)
........
Merged revisions 434469 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 434470 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434471 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r-- | res/ari/resource_bridges.c | 2 | ||||
-rw-r--r-- | res/ari/resource_channels.c | 2 | ||||
-rw-r--r-- | res/res_pjsip_exten_state.c | 6 | ||||
-rw-r--r-- | res/res_stasis_playback.c | 4 | ||||
-rw-r--r-- | res/res_stasis_recording.c | 6 |
5 files changed, 11 insertions, 9 deletions
diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c index bcd27af14..5914a0711 100644 --- a/res/ari/resource_bridges.c +++ b/res/ari/resource_bridges.c @@ -692,7 +692,7 @@ void ast_ari_bridges_record(struct ast_variable *headers, return; } - if (options->if_exists == -1) { + if (options->if_exists == AST_RECORD_IF_EXISTS_ERROR) { ast_ari_response_error( response, 400, "Bad Request", "ifExists invalid"); diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c index fb1aa039c..594315831 100644 --- a/res/ari/resource_channels.c +++ b/res/ari/resource_channels.c @@ -626,7 +626,7 @@ void ast_ari_channels_record(struct ast_variable *headers, return; } - if (options->if_exists == -1) { + if (options->if_exists == AST_RECORD_IF_EXISTS_ERROR) { ast_ari_response_error( response, 400, "Bad Request", "ifExists invalid"); diff --git a/res/res_pjsip_exten_state.c b/res/res_pjsip_exten_state.c index 45bfff605..da9b133f9 100644 --- a/res/res_pjsip_exten_state.c +++ b/res/res_pjsip_exten_state.c @@ -401,6 +401,7 @@ static struct ast_sip_exten_state_data *exten_state_data_alloc(struct ast_sip_su struct ast_sip_exten_state_data *exten_state_data; char *subtype = NULL; char *message = NULL; + int presence_state; exten_state_data = ao2_alloc(sizeof(*exten_state_data), exten_state_data_destructor); if (!exten_state_data) { @@ -408,11 +409,12 @@ static struct ast_sip_exten_state_data *exten_state_data_alloc(struct ast_sip_su } exten_state_data->exten = exten_state_sub->exten; - if ((exten_state_data->presence_state = ast_hint_presence_state(NULL, exten_state_sub->context, - exten_state_sub->exten, &subtype, &message)) == -1) { + presence_state = ast_hint_presence_state(NULL, exten_state_sub->context, exten_state_sub->exten, &subtype, &message); + if (presence_state == -1 || presence_state == AST_PRESENCE_INVALID) { ao2_cleanup(exten_state_data); return NULL; } + exten_state_data->presence_state = presence_state; exten_state_data->presence_subtype = subtype; exten_state_data->presence_message = message; exten_state_data->user_agent = exten_state_sub->user_agent; diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c index 1de774ff5..2eac55f19 100644 --- a/res/res_stasis_playback.c +++ b/res/res_stasis_playback.c @@ -629,9 +629,9 @@ enum stasis_playback_oper_results stasis_app_playback_operation( playback_opreation_cb cb; SCOPED_AO2LOCK(lock, playback); - ast_assert(playback->state >= 0 && playback->state < STASIS_PLAYBACK_STATE_MAX); + ast_assert(playback->state < STASIS_PLAYBACK_STATE_MAX); - if (operation < 0 || operation >= STASIS_PLAYBACK_MEDIA_OP_MAX) { + if (operation >= STASIS_PLAYBACK_MEDIA_OP_MAX) { ast_log(LOG_ERROR, "Invalid playback operation %u\n", operation); return -1; } diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c index 433adb3d5..df7f8b33a 100644 --- a/res/res_stasis_recording.c +++ b/res/res_stasis_recording.c @@ -212,7 +212,7 @@ enum ast_record_if_exists stasis_app_recording_if_exists_parse( return AST_RECORD_IF_EXISTS_APPEND; } - return -1; + return AST_RECORD_IF_EXISTS_ERROR; } static void recording_publish(struct stasis_app_recording *recording, const char *cause) @@ -595,13 +595,13 @@ enum stasis_app_recording_oper_results stasis_app_recording_operation( recording_operation_cb cb; SCOPED_AO2LOCK(lock, recording); - if (recording->state < 0 || recording->state >= STASIS_APP_RECORDING_STATE_MAX) { + if (recording->state >= STASIS_APP_RECORDING_STATE_MAX) { ast_log(LOG_WARNING, "Invalid recording state %u\n", recording->state); return -1; } - if (operation < 0 || operation >= STASIS_APP_RECORDING_OPER_MAX) { + if (operation >= STASIS_APP_RECORDING_OPER_MAX) { ast_log(LOG_WARNING, "Invalid recording operation %u\n", operation); return -1; |