diff options
author | Matthew Jordan <mjordan@digium.com> | 2015-03-30 02:44:57 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2015-03-30 02:44:57 +0000 |
commit | 5f8faf16af107855e6afa2574b3e9436ed20250c (patch) | |
tree | c0f4d512da952404de20faf78a53a68d2843b021 /apps | |
parent | 09b681e344b5f40544ae0de8685a4010cba1d21e (diff) |
clang compiler warnings: Fix -Wabsolute-value warnings
This patch fixes several warnings caught by clang - in this case, usage of the
abs function on non-integer values. This patch uses labs and fabs, as
appropriate, in the various affected files.
Review: https://reviewboard.asterisk.org/r/4525
ASTERISK-24917
Reported by: dkdegroot
patches:
rb4525.patch submitted by dkdegroot (License 6600)
........
Merged revisions 433749 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433750 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_queue.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index 7b4faf0c0..9e5b8f519 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3683,7 +3683,8 @@ static int valid_exit(struct queue_ent *qe, char digit) static int say_position(struct queue_ent *qe, int ringing) { - int res = 0, avgholdmins, avgholdsecs, announceposition = 0; + int res = 0, announceposition = 0; + long avgholdmins, avgholdsecs; int say_thanks = 1; time_t now; @@ -3757,23 +3758,23 @@ static int say_position(struct queue_ent *qe, int ringing) } } /* Round hold time to nearest minute */ - avgholdmins = abs(((qe->parent->holdtime + 30) - (now - qe->start)) / 60); + avgholdmins = labs(((qe->parent->holdtime + 30) - (now - qe->start)) / 60); /* If they have specified a rounding then round the seconds as well */ if (qe->parent->roundingseconds) { - avgholdsecs = (abs(((qe->parent->holdtime + 30) - (now - qe->start))) - 60 * avgholdmins) / qe->parent->roundingseconds; + avgholdsecs = (labs(((qe->parent->holdtime + 30) - (now - qe->start))) - 60 * avgholdmins) / qe->parent->roundingseconds; avgholdsecs *= qe->parent->roundingseconds; } else { avgholdsecs = 0; } - ast_verb(3, "Hold time for %s is %d minute(s) %d seconds\n", qe->parent->name, avgholdmins, avgholdsecs); + ast_verb(3, "Hold time for %s is %ld minute(s) %ld seconds\n", qe->parent->name, avgholdmins, avgholdsecs); /* If the hold time is >1 min, if it's enabled, and if it's not supposed to be only once and we have already said it, say it */ - if ((avgholdmins+avgholdsecs) > 0 && qe->parent->announceholdtime && - ((qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE && !qe->last_pos) || - !(qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE))) { + if ((avgholdmins+avgholdsecs) > 0 && qe->parent->announceholdtime && + ((qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE && !qe->last_pos) || + !(qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE))) { res = play_file(qe->chan, qe->parent->sound_holdtime); if (res) { goto playout; @@ -6577,11 +6578,11 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a } if (!res2 && qe->parent->reportholdtime) { if (!play_file(peer, qe->parent->sound_reporthold)) { - int holdtime, holdtimesecs; + long holdtime, holdtimesecs; time(&now); - holdtime = abs((now - qe->start) / 60); - holdtimesecs = abs((now - qe->start) % 60); + holdtime = labs((now - qe->start) / 60); + holdtimesecs = labs((now - qe->start) % 60); if (holdtime > 0) { ast_say_number(peer, holdtime, AST_DIGIT_ANY, ast_channel_language(peer), NULL); if (play_file(peer, qe->parent->sound_minutes) < 0) { |