[asterisk-bugs] [JIRA] (ASTERISK-27549) [patch] translate: Avoid absolute value on unsigned substraction.
Friendly Automation (JIRA)
noreply at issues.asterisk.org
Tue Jan 9 13:07:39 CST 2018
[ https://issues.asterisk.org/jira/browse/ASTERISK-27549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=241438#comment-241438 ]
Friendly Automation commented on ASTERISK-27549:
------------------------------------------------
Change 7816 merged by Jenkins2:
translate: Avoid absolute value on unsigned substraction.
[https://gerrit.asterisk.org/7816|https://gerrit.asterisk.org/7816]
> [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
> 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