[Home]

Summary:ASTERISK-27549: [patch] translate: Avoid absolute value on unsigned substraction.
Reporter:Alexander Traud (traud)Labels:patch
Date Opened:2018-01-05 05:48:24.000-0600Date Closed:2018-01-09 13:06:04.000-0600
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Formats/General
Versions:13.19.0 15.2.0 Frequency of
Occurrence
Related
Issues:
is caused byASTERISK-23735 Transcoding makes bad choice in high-rate translations
Environment:Attachments:( 0) clang_translate.patch
Description:The compiler _clang_ reports:
{code}translate.c:1418:24: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
                               int gap_selected = abs(ast_format_get_sample_rate(best)
                                                  ^
translate.c:1418:24: note: remove the call to 'abs' since unsigned values cannot be negative
                               int gap_selected = abs(ast_format_get_sample_rate(best)
                                                  ^~~
translate.c:1420:23: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
                               int gap_current = abs(ast_format_get_sample_rate(src)
                                                 ^
translate.c:1420:23: note: remove the call to 'abs' since unsigned values cannot be negative
                               int gap_current = abs(ast_format_get_sample_rate(src){code}Reporting my own code. I missed, that an unsigned type is returned by ast_format_get_sample_rate(.). More [details...|http://www.soundsoftware.ac.uk/c-pitfall-unsigned] The attached patch is [based on...|http://stackoverflow.com/a/27833306]
Comments:By: Friendly Automation (friendly-automation) 2018-01-09 13:06:05.277-0600

Change 7816 merged by Jenkins2:
translate: Avoid absolute value on unsigned substraction.

[https://gerrit.asterisk.org/7816|https://gerrit.asterisk.org/7816]

By: Friendly Automation (friendly-automation) 2018-01-09 13:12:27.002-0600

Change 7840 merged by Jenkins2:
translate: Avoid absolute value on unsigned substraction.

[https://gerrit.asterisk.org/7840|https://gerrit.asterisk.org/7840]

By: Friendly Automation (friendly-automation) 2018-01-09 13:17:20.389-0600

Change 7817 merged by Jenkins2:
translate: Avoid absolute value on unsigned substraction.

[https://gerrit.asterisk.org/7817|https://gerrit.asterisk.org/7817]

By: Friendly Automation (friendly-automation) 2018-01-09 13:17:55.952-0600

Change 7815 merged by Joshua Colp:
translate: Avoid absolute value on unsigned substraction.

[https://gerrit.asterisk.org/7815|https://gerrit.asterisk.org/7815]

By: Friendly Automation (friendly-automation) 2018-01-09 13:32:47.665-0600

Change 7818 merged by Jenkins2:
translate: Avoid absolute value on unsigned substraction.

[https://gerrit.asterisk.org/7818|https://gerrit.asterisk.org/7818]