[asterisk-bugs] [JIRA] (ASTERISK-27549) [patch] translate: Avoid absolute value on unsigned substraction.
Asterisk Team (JIRA)
noreply at issues.asterisk.org
Thu Feb 22 17:27:29 CST 2018
[ https://issues.asterisk.org/jira/browse/ASTERISK-27549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Asterisk Team updated ASTERISK-27549:
-------------------------------------
Target Release Version/s: 15.3.0
> [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
> Assignee: Alexander Traud
> Labels: patch
> Target Release: 13.19.0, 13.20.0, 15.2.0, 15.3.0
>
> 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