[asterisk-bugs] [JIRA] (ASTERISK-27549) [patch] translate: Avoid absolute value on unsigned substraction.

Asterisk Team (JIRA) noreply at issues.asterisk.org
Fri Jan 5 05:49:39 CST 2018


    [ https://issues.asterisk.org/jira/browse/ASTERISK-27549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=241363#comment-241363 ] 

Asterisk Team commented on ASTERISK-27549:
------------------------------------------

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

> [patch] translate: Avoid absolute value on unsigned substraction.
> -----------------------------------------------------------------
>
>                 Key: ASTERISK-27549
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27549
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Formats/General
>    Affects Versions: 13.19.0, 15.2.0
>            Reporter: Alexander Traud
>              Labels: patch
>         Attachments: clang_translate.patch
>
>
> 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]



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list